diff --git a/README.md b/README.md index dbdf747d994..e0b36ac90e5 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,35 @@ const k8sApi = kc.makeApiClient(k8s.CoreV1Api); ... ``` +## Call APIs with protocol buffers + +```javascript +const k8s = require('@kubernetes/client-node'); + +const kc = new k8s.KubeConfig(); +kc.loadFromDefault(); + +const protoClient = new k8s.ProtoClient(kc); +const result = await protoClient.get(k8s.MetaV1.Status.decode, '/version'); + +if (result.status) { + console.log(result.status.message); +} else { + console.log(result.object); +} +``` + +`ProtoClient` uses Kubernetes protocol-buffer framing (`application/vnd.kubernetes.protobuf`) and +returns either the decoded object (`result.object`) or a decoded `v1.Status` (`result.status`). +The bundled protobuf files are generated from Kubernetes proto definitions with: + +```bash +npm run generate:proto +``` + +`generate-protobuf.sh` fetches and uses upstream `kubernetes-client/gen/proto/generate.sh` +and `dependencies.sh` directly so the proto source list stays in sync. + # Documentation 📖 **[View Documentation](https://kubernetes-client.github.io/javascript/)** diff --git a/generate-protobuf.sh b/generate-protobuf.sh new file mode 100755 index 00000000000..ad3a63ac06e --- /dev/null +++ b/generate-protobuf.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROTO_ROOT="${ROOT_DIR}/src/proto/generated" +RELEASE="${1:-master}" +WORK_DIR="$(mktemp -d /tmp/k8s-proto.XXXXXX)" +UPSTREAM_PROTO_DIR="${WORK_DIR}/gen-proto" +UPSTREAM_BASE_URL="https://raw.githubusercontent.com/kubernetes-client/gen/master/proto" + +cleanup() { + rm -rf "${WORK_DIR}" +} +trap cleanup EXIT + +mkdir -p "${UPSTREAM_PROTO_DIR}" + +curl --fail -sSL "${UPSTREAM_BASE_URL}/generate.sh" -o "${UPSTREAM_PROTO_DIR}/generate.sh" +curl --fail -sSL "${UPSTREAM_BASE_URL}/dependencies.sh" -o "${UPSTREAM_PROTO_DIR}/dependencies.sh" +curl --fail -sSL "${UPSTREAM_BASE_URL}/install.sh" -o "${UPSTREAM_PROTO_DIR}/install.sh" +chmod +x "${UPSTREAM_PROTO_DIR}/generate.sh" "${UPSTREAM_PROTO_DIR}/dependencies.sh" "${UPSTREAM_PROTO_DIR}/install.sh" + +if ! command -v protoc >/dev/null 2>&1; then + ( + cd "${UPSTREAM_PROTO_DIR}" + ./install.sh + ) + PROTOC_BIN="${UPSTREAM_PROTO_DIR}/bin/protoc" +else + PROTOC_BIN="$(command -v protoc)" +fi + +if [[ ! -x "${ROOT_DIR}/node_modules/.bin/protoc-gen-ts_proto" ]]; then + echo "Missing ts-proto plugin at ${ROOT_DIR}/node_modules/.bin/protoc-gen-ts_proto. Run npm ci first." >&2 + exit 1 +fi + +( + cd "${UPSTREAM_PROTO_DIR}" + ./dependencies.sh "${RELEASE}" +) + +fetch_missing_import() { + local imported_file="$1" + local destination="${UPSTREAM_PROTO_DIR}/${imported_file}" + local source_url + + if [[ "${imported_file}" == k8s.io/apimachinery/* ]]; then + source_url="https://raw.githubusercontent.com/kubernetes/apimachinery/${RELEASE}/${imported_file#k8s.io/apimachinery/}" + elif [[ "${imported_file}" == k8s.io/apiextensions-apiserver/* ]]; then + source_url="https://raw.githubusercontent.com/kubernetes/apiextensions-apiserver/master/${imported_file#k8s.io/apiextensions-apiserver/}" + elif [[ "${imported_file}" == k8s.io/api/* ]]; then + source_url="https://raw.githubusercontent.com/kubernetes/api/master/${imported_file#k8s.io/api/}" + else + return + fi + + mkdir -p "$(dirname "${destination}")" + curl --fail -sSL "${source_url}" -o "${destination}" +} + +while true; do + mapfile -t imported_files < <( + find "${UPSTREAM_PROTO_DIR}/k8s.io" -name 'generated.proto' -type f -print0 \ + | xargs -0 grep -hoE '^import "k8s\.io/.+generated\.proto";' \ + | sed -E 's/^import "(k8s\.io\/.+)";$/\1/' \ + | sort -u + ) + + missing_count=0 + for imported_file in "${imported_files[@]}"; do + if [[ ! -f "${UPSTREAM_PROTO_DIR}/${imported_file}" ]]; then + fetch_missing_import "${imported_file}" + ((missing_count += 1)) + fi + done + + if [[ "${missing_count}" -eq 0 ]]; then + break + fi +done + +mapfile -t proto_files < <(grep -oE 'k8s\.io[^ ;"]+generated\.proto' "${UPSTREAM_PROTO_DIR}/generate.sh") + +if [[ "${#proto_files[@]}" -eq 0 ]]; then + echo "Failed to discover proto files from upstream generate.sh" >&2 + exit 1 +fi + +rm -rf "${PROTO_ROOT}" +mkdir -p "${PROTO_ROOT}" + +proto_paths=() +for file in "${proto_files[@]}"; do + proto_paths+=("${UPSTREAM_PROTO_DIR}/${file}") +done + +"${PROTOC_BIN}" -I"${UPSTREAM_PROTO_DIR}" \ + --plugin="protoc-gen-ts_proto=${ROOT_DIR}/node_modules/.bin/protoc-gen-ts_proto" \ + --ts_proto_out="${PROTO_ROOT}" \ + --ts_proto_opt=esModuleInterop=true,outputServices=none,useOptionals=none,exportCommonSymbols=false,importSuffix=.js \ + "${proto_paths[@]}" + +echo "Generated protobuf TypeScript files under ${PROTO_ROOT}" diff --git a/package-lock.json b/package-lock.json index fcbe5ccc3c1..2fa64bb9208 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "2.0.0", "license": "Apache-2.0", "dependencies": { + "@bufbuild/protobuf": "^2.14.1", "@types/js-yaml": "^4.0.1", "@types/node": "^26.0.0", "@types/stream-buffers": "^3.0.3", @@ -34,6 +35,7 @@ "prettier": "^3.0.0", "pretty-quick": "^4.0.0", "ts-mockito": "^2.3.1", + "ts-proto": "^2.12.1", "tsx": "^4.21.0", "typescript": "~7.0.2" } @@ -48,6 +50,12 @@ "node": ">=18" } }, + "node_modules/@bufbuild/protobuf": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.14.1.tgz", + "integrity": "sha512-agRJn3+EJDUe8AvxTx/LnHA/GErvLE62pSaSk7+MwFOtOv8eWBu/qCq2qoZjBjVZ3C2aiFJCveuSs17KMkYGOw==", + "license": "(Apache-2.0 AND BSD-3-Clause)" + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.28.1", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", @@ -1168,6 +1176,19 @@ "node": ">= 0.4" } }, + "node_modules/case-anything": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz", + "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, "node_modules/cliui": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz", @@ -1243,6 +1264,29 @@ "node": ">=0.4.0" } }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/dprint-node": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/dprint-node/-/dprint-node-1.0.8.tgz", + "integrity": "sha512-iVKnUtYfGrYcW1ZAlfR/F59cUVL8QIhWoBJoSjkkdua/dkWIgjZfiLMeTjiB06X0ZLkQ0M2C1VbUj/CxkIf1zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-libc": "^1.0.3" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -2303,6 +2347,42 @@ "lodash": "^4.17.5" } }, + "node_modules/ts-poet": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.12.0.tgz", + "integrity": "sha512-xo+iRNMWqyvXpFTaOAvLPA5QAWO6TZrSUs5s4Odaya3epqofBu/fMLHEWl8jPmjhA0s9sgj9sNvF1BmaQlmQkA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "dprint-node": "^1.0.8" + } + }, + "node_modules/ts-proto": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-2.12.1.tgz", + "integrity": "sha512-IEFvmib22yVlXbagL/UXcfliCPilgqXs3J0/ajDhUslfezMRhhhZvwgc63W0ZrKxCj+8jMHxvrN6G13A5UGFVg==", + "dev": true, + "license": "ISC", + "dependencies": { + "@bufbuild/protobuf": "^2.10.2", + "case-anything": "^2.1.13", + "ts-poet": "^6.12.0", + "ts-proto-descriptors": "2.1.0" + }, + "bin": { + "protoc-gen-ts_proto": "protoc-gen-ts_proto" + } + }, + "node_modules/ts-proto-descriptors": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-2.1.0.tgz", + "integrity": "sha512-S5EZYEQ6L9KLFfjSRpZWDIXDV/W7tAj8uW7pLsihIxyr62EAVSiKuVPwE8iWnr849Bqa53enex1jhDUcpgquzA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@bufbuild/protobuf": "^2.0.0" + } + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", diff --git a/package.json b/package.json index aacd3598c31..34b95738fa3 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "build": "tsc", "build-with-tests": "tsc --project tsconfig-with-tests.json && cp 'src/test/echo space.js' dist/test", "generate": "./generate-client.sh", + "generate:proto": "./generate-protobuf.sh", "watch": "tsc --watch", "test": "c8 node --test --test-reporter=spec --import tsx src/*_test.ts", "test-no-coverage": "node --test --test-reporter=spec --import tsx src/*_test.ts", @@ -56,6 +57,7 @@ "author": "Kubernetes Authors", "license": "Apache-2.0", "dependencies": { + "@bufbuild/protobuf": "^2.14.1", "@types/js-yaml": "^4.0.1", "@types/node": "^26.0.0", "@types/stream-buffers": "^3.0.3", @@ -81,6 +83,7 @@ "prettier": "^3.0.0", "pretty-quick": "^4.0.0", "ts-mockito": "^2.3.1", + "ts-proto": "^2.12.1", "tsx": "^4.21.0", "typescript": "~7.0.2" }, diff --git a/src/index.ts b/src/index.ts index 746abcb71c2..4a3f2d08b73 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,4 +18,6 @@ export * from './object.js'; export * from './health.js'; export * from './middleware.js'; export * from './patch.js'; +export * from './proto-client.js'; +export * from './proto.js'; export { type ConfigOptions, type User, type Cluster, type Context } from './config_types.js'; diff --git a/src/proto-client.ts b/src/proto-client.ts index 98203d8e1a9..6b2eecdea83 100644 --- a/src/proto-client.ts +++ b/src/proto-client.ts @@ -1,35 +1,214 @@ import http from 'node:http'; +import https from 'node:https'; import { KubeConfig } from './config.js'; +import { DeleteOptions, Status } from './proto/generated/k8s.io/apimachinery/pkg/apis/meta/v1/generated.js'; +import { Unknown } from './proto/generated/k8s.io/apimachinery/pkg/runtime/generated.js'; + +const MAGIC_PREFIX = Uint8Array.from([0x6b, 0x38, 0x73, 0x00]); +const PROTO_MEDIA_TYPE = 'application/vnd.kubernetes.protobuf'; + +export type ProtoRequestBody = Uint8Array | { serializeBinary(): Uint8Array }; + +export type ProtoDecoder = + | ((input: Uint8Array) => T) + | { decode(input: Uint8Array): T } + | { deserializeBinary(input: Uint8Array): T }; + +export interface ObjectOrStatus { + object: T | null; + status: Status | null; +} export class ProtoClient { - public readonly 'config': KubeConfig; - - public async get(msgType: any, requestPath: string): Promise { - const server = this.config.getCurrentCluster()!.server; - const u = new URL(server); - const options = { - path: requestPath, - hostname: u.hostname, - protocol: u.protocol, + public readonly config: KubeConfig; + + constructor(config: KubeConfig) { + this.config = config; + } + + public async get(decoder: ProtoDecoder, requestPath: string): Promise> { + return this.request('GET', decoder, requestPath); + } + + public async list(decoder: ProtoDecoder, requestPath: string): Promise> { + return this.get(decoder, requestPath); + } + + public async create( + decoder: ProtoDecoder, + requestPath: string, + body: ProtoRequestBody, + apiVersion: string, + kind: string, + ): Promise> { + return this.request('POST', decoder, requestPath, body, apiVersion, kind); + } + + public async update( + decoder: ProtoDecoder, + requestPath: string, + body: ProtoRequestBody, + apiVersion: string, + kind: string, + ): Promise> { + return this.request('PUT', decoder, requestPath, body, apiVersion, kind); + } + + public async merge( + decoder: ProtoDecoder, + requestPath: string, + body: ProtoRequestBody, + apiVersion: string, + kind: string, + ): Promise> { + return this.request('PATCH', decoder, requestPath, body, apiVersion, kind); + } + + public async delete( + decoder: ProtoDecoder, + requestPath: string, + deleteOptions?: Partial, + ): Promise> { + if (!deleteOptions) { + return this.request('DELETE', decoder, requestPath); + } + + const normalizedDeleteOptions = DeleteOptions.fromPartial({ dryRun: [], ...deleteOptions }); + const deleteBody = DeleteOptions.encode(normalizedDeleteOptions).finish(); + return this.request('DELETE', decoder, requestPath, deleteBody, 'v1', 'DeleteOptions'); + } + + public async request( + method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', + decoder: ProtoDecoder, + requestPath: string, + body?: ProtoRequestBody, + apiVersion?: string, + kind?: string, + ): Promise> { + const cluster = this.config.getCurrentCluster(); + if (!cluster) { + throw new Error('No active cluster!'); + } + + const url = new URL(requestPath, cluster.server); + const headers: Record = { + Accept: PROTO_MEDIA_TYPE, + }; + + let encodedBody: Uint8Array | undefined; + if (body !== undefined) { + if (!apiVersion || !kind) { + throw new Error('apiVersion and kind are required when a request body is provided.'); + } + headers['Content-Type'] = PROTO_MEDIA_TYPE; + encodedBody = this.encode(body, apiVersion, kind); + } + + const options: https.RequestOptions = { + protocol: url.protocol, + hostname: url.hostname, + port: url.port, + path: `${url.pathname}${url.search}`, + method, + headers, }; + await this.config.applyToHTTPSOptions(options); - const req = http.request(options); - - const result = await new Promise((resolve, reject) => { - let data = ''; - req.on('data', (chunk) => { - data = data + chunk; - }); - req.on('end', () => { - const obj = msgType.deserializeBinary(data); - resolve(obj); - }); - req.on('error', (err) => { - reject(err); - }); - }); - req.end(); - return result; + + const data = await new Promise<{ body: Buffer; contentType: string | undefined }>( + (resolve, reject) => { + const requestFn = url.protocol === 'https:' ? https.request : http.request; + const req = requestFn(options, (res) => { + const chunks: Buffer[] = []; + res.on('data', (chunk: Buffer | string) => { + chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)); + }); + res.on('end', () => { + resolve({ + body: Buffer.concat(chunks), + contentType: asStringHeader(res.headers['content-type']), + }); + }); + res.on('error', reject); + }); + + req.on('error', reject); + if (encodedBody !== undefined) { + req.write(encodedBody); + } + req.end(); + }, + ); + + if (!data.contentType?.includes(PROTO_MEDIA_TYPE)) { + const bodyAsText = data.body.toString('utf8').trim(); + const contentType = data.contentType ?? 'unknown'; + throw new Error(`Unexpected content type '${contentType}' from API server: ${bodyAsText}`); + } + + const response = this.parseResponse(data.body); + if (response.typeMeta?.apiVersion === 'v1' && response.typeMeta?.kind === 'Status') { + return { + object: null, + status: Status.decode(response.raw ?? new Uint8Array()), + }; + } + + if (!response.raw) { + throw new Error('Protocol buffer response did not include a raw payload.'); + } + + return { + object: decode(decoder, response.raw), + status: null, + }; + } + + private encode(message: ProtoRequestBody, apiVersion: string, kind: string): Uint8Array { + const raw = message instanceof Uint8Array ? message : message.serializeBinary(); + const unknown = Unknown.encode({ + typeMeta: { apiVersion, kind }, + raw, + }).finish(); + + const encoded = new Uint8Array(MAGIC_PREFIX.length + unknown.length); + encoded.set(MAGIC_PREFIX, 0); + encoded.set(unknown, MAGIC_PREFIX.length); + return encoded; + } + + private parseResponse(data: Buffer): Unknown { + if (data.length < MAGIC_PREFIX.length) { + throw new Error('Truncated protocol buffer response: missing magic prefix.'); + } + + for (let i = 0; i < MAGIC_PREFIX.length; i++) { + if (data[i] !== MAGIC_PREFIX[i]) { + throw new Error('Unexpected protocol buffer response: magic prefix mismatch.'); + } + } + + return Unknown.decode(data.subarray(MAGIC_PREFIX.length)); + } +} + +function decode(decoder: ProtoDecoder, raw: Uint8Array): T { + if (typeof decoder === 'function') { + return decoder(raw); + } + + if ('deserializeBinary' in decoder) { + return decoder.deserializeBinary(raw); + } + + return decoder.decode(raw); +} + +function asStringHeader(value: string | string[] | undefined): string | undefined { + if (Array.isArray(value)) { + return value.join(','); } + return value; } diff --git a/src/proto-client_test.ts b/src/proto-client_test.ts new file mode 100644 index 00000000000..95c524faad3 --- /dev/null +++ b/src/proto-client_test.ts @@ -0,0 +1,203 @@ +import { strictEqual, deepStrictEqual, ok, rejects } from 'node:assert'; +import http, { IncomingMessage, ServerResponse } from 'node:http'; +import { AddressInfo } from 'node:net'; +import { describe, it } from 'node:test'; + +import { KubeConfig } from './config.js'; +import { ProtoClient } from './proto-client.js'; +import { Status } from './proto/generated/k8s.io/apimachinery/pkg/apis/meta/v1/generated.js'; +import { Unknown } from './proto/generated/k8s.io/apimachinery/pkg/runtime/generated.js'; + +const MAGIC_PREFIX = Uint8Array.from([0x6b, 0x38, 0x73, 0x00]); +const PROTO_MEDIA_TYPE = 'application/vnd.kubernetes.protobuf'; + +describe('ProtoClient', () => { + it('decodes regular protobuf object responses', async () => { + const expectedBody = 'hello-proto'; + const responseBody = wrapUnknown({ + apiVersion: 'v1', + kind: 'ConfigMap', + raw: Buffer.from(expectedBody, 'utf8'), + }); + + await withProtoServer( + (req, res) => { + strictEqual(req.method, 'GET'); + strictEqual(req.headers.accept, PROTO_MEDIA_TYPE); + res.writeHead(200, { 'Content-Type': PROTO_MEDIA_TYPE }); + res.end(responseBody); + }, + async (url) => { + const client = new ProtoClient(makeKubeConfig(url)); + const result = await client.get( + (bytes: Uint8Array) => Buffer.from(bytes).toString('utf8'), + '/api/v1', + ); + + strictEqual(result.object, expectedBody); + strictEqual(result.status, null); + }, + ); + }); + + it('decodes status responses into status objects', async () => { + const statusPayload = Status.encode({ + status: 'Failure', + reason: 'NotFound', + code: 404, + message: 'pods "missing" not found', + }).finish(); + + await withProtoServer( + (_req, res) => { + res.writeHead(404, { 'Content-Type': PROTO_MEDIA_TYPE }); + res.end( + wrapUnknown({ + apiVersion: 'v1', + kind: 'Status', + raw: statusPayload, + }), + ); + }, + async (url) => { + const client = new ProtoClient(makeKubeConfig(url)); + const result = await client.get(() => { + throw new Error('decoder should not be called for Status responses'); + }, '/api/v1/namespaces/default/pods/missing'); + + strictEqual(result.object, null); + ok(result.status); + strictEqual(result.status?.status, 'Failure'); + strictEqual(result.status?.reason, 'NotFound'); + strictEqual(result.status?.code, 404); + }, + ); + }); + + it('encodes create requests with Kubernetes protobuf envelope', async () => { + const requestBody = Uint8Array.from([9, 8, 7]); + + await withProtoServer( + async (req, res) => { + strictEqual(req.method, 'POST'); + strictEqual(req.headers.accept, PROTO_MEDIA_TYPE); + strictEqual(req.headers['content-type'], PROTO_MEDIA_TYPE); + + const body = await readBody(req); + const parsed = parseUnknown(body); + strictEqual(parsed.typeMeta?.apiVersion, 'v1'); + strictEqual(parsed.typeMeta?.kind, 'ConfigMap'); + deepStrictEqual(Array.from(parsed.raw ?? []), Array.from(requestBody)); + + res.writeHead(201, { 'Content-Type': PROTO_MEDIA_TYPE }); + res.end( + wrapUnknown({ + apiVersion: 'v1', + kind: 'ConfigMap', + raw: Buffer.from('created', 'utf8'), + }), + ); + }, + async (url) => { + const client = new ProtoClient(makeKubeConfig(url)); + const result = await client.create( + (bytes: Uint8Array) => Buffer.from(bytes).toString('utf8'), + '/api/v1/namespaces/default/configmaps', + requestBody, + 'v1', + 'ConfigMap', + ); + + strictEqual(result.status, null); + strictEqual(result.object, 'created'); + }, + ); + }); + + it('throws for non-protobuf responses', async () => { + await withProtoServer( + (_req, res) => { + res.writeHead(500, { 'Content-Type': 'application/json' }); + res.end('{"kind":"Status","message":"boom"}'); + }, + async (url) => { + const client = new ProtoClient(makeKubeConfig(url)); + await rejects( + client.get(() => 'ignored', '/api/v1'), + /Unexpected content type 'application\/json' from API server/, + ); + }, + ); + }); +}); + +function wrapUnknown(input: { apiVersion: string; kind: string; raw: Uint8Array }): Buffer { + const unknown = Unknown.encode({ + typeMeta: { + apiVersion: input.apiVersion, + kind: input.kind, + }, + raw: input.raw, + }).finish(); + + return Buffer.concat([Buffer.from(MAGIC_PREFIX), Buffer.from(unknown)]); +} + +function parseUnknown(data: Buffer) { + for (let i = 0; i < MAGIC_PREFIX.length; i++) { + strictEqual(data[i], MAGIC_PREFIX[i]); + } + return Unknown.decode(data.subarray(MAGIC_PREFIX.length)); +} + +async function withProtoServer( + handler: (req: IncomingMessage, res: ServerResponse) => Promise | void, + fn: (url: string) => Promise, +): Promise { + const server = http.createServer((req, res) => { + Promise.resolve(handler(req, res)).catch((err: Error) => { + res.statusCode = 500; + res.end(err.message); + }); + }); + + await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)); + + try { + const address = server.address() as AddressInfo; + await fn(`http://127.0.0.1:${address.port}`); + } finally { + await new Promise((resolve, reject) => server.close((err) => (err ? reject(err) : resolve()))); + } +} + +function makeKubeConfig(serverUrl: string): KubeConfig { + const kc = new KubeConfig(); + kc.loadFromOptions({ + clusters: [ + { + name: 'cluster', + server: serverUrl, + skipTLSVerify: true, + }, + ], + users: [{ name: 'user' }], + contexts: [ + { + name: 'context', + cluster: 'cluster', + user: 'user', + }, + ], + currentContext: 'context', + }); + return kc; +} + +async function readBody(req: IncomingMessage): Promise { + const chunks: Buffer[] = []; + for await (const chunk of req) { + chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)); + } + return Buffer.concat(chunks); +} diff --git a/src/proto.ts b/src/proto.ts new file mode 100644 index 00000000000..5a756f9d141 --- /dev/null +++ b/src/proto.ts @@ -0,0 +1,34 @@ +export * as MetaV1 from './proto/generated/k8s.io/apimachinery/pkg/apis/meta/v1/generated.js'; +export * as Runtime from './proto/generated/k8s.io/apimachinery/pkg/runtime/generated.js'; +export * as ProtoRuntimeSchema from './proto/generated/k8s.io/apimachinery/pkg/runtime/schema/generated.js'; +export * as ProtoIntStr from './proto/generated/k8s.io/apimachinery/pkg/util/intstr/generated.js'; +export * as ProtoResourceQuantity from './proto/generated/k8s.io/apimachinery/pkg/api/resource/generated.js'; +export * as ProtoV1Admission from './proto/generated/k8s.io/api/admission/v1/generated.js'; +export * as ProtoV1Admissionregistration from './proto/generated/k8s.io/api/admissionregistration/v1/generated.js'; +export * as ProtoV2Apidiscovery from './proto/generated/k8s.io/api/apidiscovery/v2/generated.js'; +export * as ProtoV2beta1Apidiscovery from './proto/generated/k8s.io/api/apidiscovery/v2beta1/generated.js'; +export * as ProtoV1alpha1Apiserverinternal from './proto/generated/k8s.io/api/apiserverinternal/v1alpha1/generated.js'; +export * as ProtoV1Apps from './proto/generated/k8s.io/api/apps/v1/generated.js'; +export * as ProtoV1Authentication from './proto/generated/k8s.io/api/authentication/v1/generated.js'; +export * as ProtoV1Authorization from './proto/generated/k8s.io/api/authorization/v1/generated.js'; +export * as ProtoV1Autoscaling from './proto/generated/k8s.io/api/autoscaling/v1/generated.js'; +export * as ProtoV2Autoscaling from './proto/generated/k8s.io/api/autoscaling/v2/generated.js'; +export * as ProtoV1Batch from './proto/generated/k8s.io/api/batch/v1/generated.js'; +export * as ProtoV1Certificates from './proto/generated/k8s.io/api/certificates/v1/generated.js'; +export * as ProtoV1Coordination from './proto/generated/k8s.io/api/coordination/v1/generated.js'; +export * as ProtoV1Core from './proto/generated/k8s.io/api/core/v1/generated.js'; +export * as ProtoV1Discovery from './proto/generated/k8s.io/api/discovery/v1/generated.js'; +export * as ProtoV1Events from './proto/generated/k8s.io/api/events/v1/generated.js'; +export * as ProtoV1beta1Extensions from './proto/generated/k8s.io/api/extensions/v1beta1/generated.js'; +export * as ProtoV1Flowcontrol from './proto/generated/k8s.io/api/flowcontrol/v1/generated.js'; +export * as ProtoV1alpha1Imagepolicy from './proto/generated/k8s.io/api/imagepolicy/v1alpha1/generated.js'; +export * as ProtoV1Networking from './proto/generated/k8s.io/api/networking/v1/generated.js'; +export * as ProtoV1Node from './proto/generated/k8s.io/api/node/v1/generated.js'; +export * as ProtoV1Policy from './proto/generated/k8s.io/api/policy/v1/generated.js'; +export * as ProtoV1Rbac from './proto/generated/k8s.io/api/rbac/v1/generated.js'; +export * as ProtoV1Resource from './proto/generated/k8s.io/api/resource/v1/generated.js'; +export * as ProtoV1Scheduling from './proto/generated/k8s.io/api/scheduling/v1/generated.js'; +export * as ProtoV1alpha3Scheduling from './proto/generated/k8s.io/api/scheduling/v1alpha3/generated.js'; +export * as ProtoV1Storage from './proto/generated/k8s.io/api/storage/v1/generated.js'; +export * as ProtoV1beta1Storagemigration from './proto/generated/k8s.io/api/storagemigration/v1beta1/generated.js'; +export * as ProtoV1Apiextensions from './proto/generated/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/generated.js'; diff --git a/src/proto/generated/k8s.io/api/admission/v1/generated.ts b/src/proto/generated/k8s.io/api/admission/v1/generated.ts new file mode 100644 index 00000000000..b9a3c86d145 --- /dev/null +++ b/src/proto/generated/k8s.io/api/admission/v1/generated.ts @@ -0,0 +1,985 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/admission/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { + GroupVersionKind, + GroupVersionResource, + Status, +} from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; +import { RawExtension } from '../../../apimachinery/pkg/runtime/generated.js'; +import { UserInfo } from '../../authentication/v1/generated.js'; + +/** AdmissionRequest describes the admission.Attributes for the admission request. */ +export interface AdmissionRequest { + /** + * uid is an identifier for the individual request/response. It allows us to distinguish instances of requests which are + * otherwise identical (parallel requests, requests when earlier requests did not modify etc) + * The UID is meant to track the round trip (request/response) between the KAS and the WebHook, not the user request. + * It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging. + * +optional + */ + uid?: string | undefined; + /** + * kind is the fully-qualified type of object being submitted (for example, v1.Pod or autoscaling.v1.Scale) + * +optional + */ + kind?: GroupVersionKind | undefined; + /** + * resource is the fully-qualified resource being requested (for example, v1.pods) + * +optional + */ + resource?: GroupVersionResource | undefined; + /** + * subResource is the subresource being requested, if any (for example, "status" or "scale") + * +optional + */ + subResource?: string | undefined; + /** + * requestKind is the fully-qualified type of the original API request (for example, v1.Pod or autoscaling.v1.Scale). + * If this is specified and differs from the value in "kind", an equivalent match and conversion was performed. + * + * For example, if deployments can be modified via apps/v1 and apps/v1beta1, and a webhook registered a rule of + * `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]` and `matchPolicy: Equivalent`, + * an API request to apps/v1beta1 deployments would be converted and sent to the webhook + * with `kind: {group:"apps", version:"v1", kind:"Deployment"}` (matching the rule the webhook registered for), + * and `requestKind: {group:"apps", version:"v1beta1", kind:"Deployment"}` (indicating the kind of the original API request). + * + * See documentation for the "matchPolicy" field in the webhook configuration type for more details. + * +optional + */ + requestKind?: GroupVersionKind | undefined; + /** + * requestResource is the fully-qualified resource of the original API request (for example, v1.pods). + * If this is specified and differs from the value in "resource", an equivalent match and conversion was performed. + * + * For example, if deployments can be modified via apps/v1 and apps/v1beta1, and a webhook registered a rule of + * `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]` and `matchPolicy: Equivalent`, + * an API request to apps/v1beta1 deployments would be converted and sent to the webhook + * with `resource: {group:"apps", version:"v1", resource:"deployments"}` (matching the resource the webhook registered for), + * and `requestResource: {group:"apps", version:"v1beta1", resource:"deployments"}` (indicating the resource of the original API request). + * + * See documentation for the "matchPolicy" field in the webhook configuration type. + * +optional + */ + requestResource?: GroupVersionResource | undefined; + /** + * requestSubResource is the name of the subresource of the original API request, if any (for example, "status" or "scale") + * If this is specified and differs from the value in "subResource", an equivalent match and conversion was performed. + * See documentation for the "matchPolicy" field in the webhook configuration type. + * +optional + */ + requestSubResource?: string | undefined; + /** + * name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and + * rely on the server to generate the name. If that is the case, this field will contain an empty string. + * +optional + */ + name?: string | undefined; + /** + * namespace is the namespace associated with the request (if any). + * +optional + */ + namespace?: string | undefined; + /** + * operation is the operation being performed. This may be different than the operation + * requested. e.g. a patch can result in either a CREATE or UPDATE Operation. + * +optional + */ + operation?: string | undefined; + /** + * userInfo is information about the requesting user + * +optional + */ + userInfo?: UserInfo | undefined; + /** + * object is the object from the incoming request. + * +optional + */ + object?: RawExtension | undefined; + /** + * oldObject is the existing object. Only populated for DELETE and UPDATE requests. + * +optional + */ + oldObject?: RawExtension | undefined; + /** + * dryRun indicates that modifications will definitely not be persisted for this request. + * Defaults to false. + * +optional + */ + dryRun?: boolean | undefined; + /** + * options is the operation option structure of the operation being performed. + * e.g. `meta.k8s.io/v1.DeleteOptions` or `meta.k8s.io/v1.CreateOptions`. This may be + * different than the options the caller provided. e.g. for a patch request the performed + * Operation might be a CREATE, in which case the Options will a + * `meta.k8s.io/v1.CreateOptions` even though the caller provided `meta.k8s.io/v1.PatchOptions`. + * +optional + */ + options?: RawExtension | undefined; +} + +/** AdmissionResponse describes an admission response. */ +export interface AdmissionResponse { + /** + * uid is an identifier for the individual request/response. + * This must be copied over from the corresponding AdmissionRequest. + * +optional + */ + uid?: string | undefined; + /** + * allowed indicates whether or not the admission request was permitted. + * +optional + */ + allowed?: boolean | undefined; + /** + * status is the result contains extra details into why an admission request was denied. + * This field IS NOT consulted in any way if "Allowed" is "true". + * +optional + */ + status?: Status | undefined; + /** + * patch is the patch body. Currently we only support "JSONPatch" which implements RFC 6902. + * +optional + */ + patch?: Uint8Array | undefined; + /** + * patchType is the type of Patch. Currently we only allow "JSONPatch". + * +optional + */ + patchType?: string | undefined; + /** + * auditAnnotations is an unstructured key value map set by remote admission controller (e.g. error=image-blacklisted). + * MutatingAdmissionWebhook and ValidatingAdmissionWebhook admission controller will prefix the keys with + * admission webhook name (e.g. imagepolicy.example.com/error=image-blacklisted). AuditAnnotations will be provided by + * the admission webhook to add additional context to the audit log for this request. + * +optional + */ + auditAnnotations: { [key: string]: string }; + /** + * warnings is a list of warning messages to return to the requesting API client. + * Warning messages describe a problem the client making the API request should correct or be aware of. + * Limit warnings to 120 characters if possible. + * Warnings over 256 characters and large numbers of warnings may be truncated. + * +optional + * +listType=atomic + */ + warnings: string[]; +} + +export interface AdmissionResponse_AuditAnnotationsEntry { + key: string; + value: string; +} + +/** AdmissionReview describes an admission review request/response. */ +export interface AdmissionReview { + /** + * request describes the attributes for the admission request. + * +optional + */ + request?: AdmissionRequest | undefined; + /** + * response describes the attributes for the admission response. + * +optional + */ + response?: AdmissionResponse | undefined; +} + +function createBaseAdmissionRequest(): AdmissionRequest { + return { + uid: '', + kind: undefined, + resource: undefined, + subResource: '', + requestKind: undefined, + requestResource: undefined, + requestSubResource: '', + name: '', + namespace: '', + operation: '', + userInfo: undefined, + object: undefined, + oldObject: undefined, + dryRun: false, + options: undefined, + }; +} + +export const AdmissionRequest: MessageFns = { + encode(message: AdmissionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.uid !== undefined && message.uid !== '') { + writer.uint32(10).string(message.uid); + } + if (message.kind !== undefined) { + GroupVersionKind.encode(message.kind, writer.uint32(18).fork()).join(); + } + if (message.resource !== undefined) { + GroupVersionResource.encode(message.resource, writer.uint32(26).fork()).join(); + } + if (message.subResource !== undefined && message.subResource !== '') { + writer.uint32(34).string(message.subResource); + } + if (message.requestKind !== undefined) { + GroupVersionKind.encode(message.requestKind, writer.uint32(106).fork()).join(); + } + if (message.requestResource !== undefined) { + GroupVersionResource.encode(message.requestResource, writer.uint32(114).fork()).join(); + } + if (message.requestSubResource !== undefined && message.requestSubResource !== '') { + writer.uint32(122).string(message.requestSubResource); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(42).string(message.name); + } + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(50).string(message.namespace); + } + if (message.operation !== undefined && message.operation !== '') { + writer.uint32(58).string(message.operation); + } + if (message.userInfo !== undefined) { + UserInfo.encode(message.userInfo, writer.uint32(66).fork()).join(); + } + if (message.object !== undefined) { + RawExtension.encode(message.object, writer.uint32(74).fork()).join(); + } + if (message.oldObject !== undefined) { + RawExtension.encode(message.oldObject, writer.uint32(82).fork()).join(); + } + if (message.dryRun !== undefined && message.dryRun !== false) { + writer.uint32(88).bool(message.dryRun); + } + if (message.options !== undefined) { + RawExtension.encode(message.options, writer.uint32(98).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AdmissionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAdmissionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.uid = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.kind = GroupVersionKind.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.resource = GroupVersionResource.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.subResource = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.requestKind = GroupVersionKind.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.requestResource = GroupVersionResource.decode(reader, reader.uint32()); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.requestSubResource = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.name = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.namespace = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.operation = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.userInfo = UserInfo.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.object = RawExtension.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.oldObject = RawExtension.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + + message.dryRun = reader.bool(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.options = RawExtension.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AdmissionRequest { + return { + uid: isSet(object.uid) ? globalThis.String(object.uid) : '', + kind: isSet(object.kind) ? GroupVersionKind.fromJSON(object.kind) : undefined, + resource: isSet(object.resource) ? GroupVersionResource.fromJSON(object.resource) : undefined, + subResource: isSet(object.subResource) ? globalThis.String(object.subResource) : '', + requestKind: isSet(object.requestKind) + ? GroupVersionKind.fromJSON(object.requestKind) + : undefined, + requestResource: isSet(object.requestResource) + ? GroupVersionResource.fromJSON(object.requestResource) + : undefined, + requestSubResource: isSet(object.requestSubResource) + ? globalThis.String(object.requestSubResource) + : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + operation: isSet(object.operation) ? globalThis.String(object.operation) : '', + userInfo: isSet(object.userInfo) ? UserInfo.fromJSON(object.userInfo) : undefined, + object: isSet(object.object) ? RawExtension.fromJSON(object.object) : undefined, + oldObject: isSet(object.oldObject) ? RawExtension.fromJSON(object.oldObject) : undefined, + dryRun: isSet(object.dryRun) ? globalThis.Boolean(object.dryRun) : false, + options: isSet(object.options) ? RawExtension.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: AdmissionRequest): unknown { + const obj: any = {}; + if (message.uid !== undefined && message.uid !== '') { + obj.uid = message.uid; + } + if (message.kind !== undefined) { + obj.kind = GroupVersionKind.toJSON(message.kind); + } + if (message.resource !== undefined) { + obj.resource = GroupVersionResource.toJSON(message.resource); + } + if (message.subResource !== undefined && message.subResource !== '') { + obj.subResource = message.subResource; + } + if (message.requestKind !== undefined) { + obj.requestKind = GroupVersionKind.toJSON(message.requestKind); + } + if (message.requestResource !== undefined) { + obj.requestResource = GroupVersionResource.toJSON(message.requestResource); + } + if (message.requestSubResource !== undefined && message.requestSubResource !== '') { + obj.requestSubResource = message.requestSubResource; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + if (message.operation !== undefined && message.operation !== '') { + obj.operation = message.operation; + } + if (message.userInfo !== undefined) { + obj.userInfo = UserInfo.toJSON(message.userInfo); + } + if (message.object !== undefined) { + obj.object = RawExtension.toJSON(message.object); + } + if (message.oldObject !== undefined) { + obj.oldObject = RawExtension.toJSON(message.oldObject); + } + if (message.dryRun !== undefined && message.dryRun !== false) { + obj.dryRun = message.dryRun; + } + if (message.options !== undefined) { + obj.options = RawExtension.toJSON(message.options); + } + return obj; + }, + + create, I>>(base?: I): AdmissionRequest { + return AdmissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AdmissionRequest { + const message = createBaseAdmissionRequest(); + message.uid = object.uid ?? ''; + message.kind = + object.kind !== undefined && object.kind !== null + ? GroupVersionKind.fromPartial(object.kind) + : undefined; + message.resource = + object.resource !== undefined && object.resource !== null + ? GroupVersionResource.fromPartial(object.resource) + : undefined; + message.subResource = object.subResource ?? ''; + message.requestKind = + object.requestKind !== undefined && object.requestKind !== null + ? GroupVersionKind.fromPartial(object.requestKind) + : undefined; + message.requestResource = + object.requestResource !== undefined && object.requestResource !== null + ? GroupVersionResource.fromPartial(object.requestResource) + : undefined; + message.requestSubResource = object.requestSubResource ?? ''; + message.name = object.name ?? ''; + message.namespace = object.namespace ?? ''; + message.operation = object.operation ?? ''; + message.userInfo = + object.userInfo !== undefined && object.userInfo !== null + ? UserInfo.fromPartial(object.userInfo) + : undefined; + message.object = + object.object !== undefined && object.object !== null + ? RawExtension.fromPartial(object.object) + : undefined; + message.oldObject = + object.oldObject !== undefined && object.oldObject !== null + ? RawExtension.fromPartial(object.oldObject) + : undefined; + message.dryRun = object.dryRun ?? false; + message.options = + object.options !== undefined && object.options !== null + ? RawExtension.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseAdmissionResponse(): AdmissionResponse { + return { + uid: '', + allowed: false, + status: undefined, + patch: new Uint8Array(0), + patchType: '', + auditAnnotations: {}, + warnings: [], + }; +} + +export const AdmissionResponse: MessageFns = { + encode(message: AdmissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.uid !== undefined && message.uid !== '') { + writer.uint32(10).string(message.uid); + } + if (message.allowed !== undefined && message.allowed !== false) { + writer.uint32(16).bool(message.allowed); + } + if (message.status !== undefined) { + Status.encode(message.status, writer.uint32(26).fork()).join(); + } + if (message.patch !== undefined && message.patch.length !== 0) { + writer.uint32(34).bytes(message.patch); + } + if (message.patchType !== undefined && message.patchType !== '') { + writer.uint32(42).string(message.patchType); + } + globalThis.Object.entries(message.auditAnnotations).forEach(([key, value]: [string, string]) => { + AdmissionResponse_AuditAnnotationsEntry.encode( + { key: key as any, value }, + writer.uint32(50).fork(), + ).join(); + }); + for (const v of message.warnings) { + writer.uint32(58).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AdmissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAdmissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.uid = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.allowed = reader.bool(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = Status.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.patch = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.patchType = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + const entry6 = AdmissionResponse_AuditAnnotationsEntry.decode( + reader, + reader.uint32(), + ); + if (entry6.value !== undefined) { + message.auditAnnotations[entry6.key] = entry6.value; + } + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.warnings.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AdmissionResponse { + return { + uid: isSet(object.uid) ? globalThis.String(object.uid) : '', + allowed: isSet(object.allowed) ? globalThis.Boolean(object.allowed) : false, + status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, + patch: isSet(object.patch) ? bytesFromBase64(object.patch) : new Uint8Array(0), + patchType: isSet(object.patchType) ? globalThis.String(object.patchType) : '', + auditAnnotations: isObject(object.auditAnnotations) + ? (globalThis.Object.entries(object.auditAnnotations) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + warnings: globalThis.Array.isArray(object?.warnings) + ? object.warnings.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: AdmissionResponse): unknown { + const obj: any = {}; + if (message.uid !== undefined && message.uid !== '') { + obj.uid = message.uid; + } + if (message.allowed !== undefined && message.allowed !== false) { + obj.allowed = message.allowed; + } + if (message.status !== undefined) { + obj.status = Status.toJSON(message.status); + } + if (message.patch !== undefined && message.patch.length !== 0) { + obj.patch = base64FromBytes(message.patch); + } + if (message.patchType !== undefined && message.patchType !== '') { + obj.patchType = message.patchType; + } + if (message.auditAnnotations) { + const entries = globalThis.Object.entries(message.auditAnnotations) as [string, string][]; + if (entries.length > 0) { + obj.auditAnnotations = {}; + entries.forEach(([k, v]) => { + obj.auditAnnotations[k] = v; + }); + } + } + if (message.warnings?.length) { + obj.warnings = message.warnings; + } + return obj; + }, + + create, I>>(base?: I): AdmissionResponse { + return AdmissionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AdmissionResponse { + const message = createBaseAdmissionResponse(); + message.uid = object.uid ?? ''; + message.allowed = object.allowed ?? false; + message.status = + object.status !== undefined && object.status !== null + ? Status.fromPartial(object.status) + : undefined; + message.patch = object.patch ?? new Uint8Array(0); + message.patchType = object.patchType ?? ''; + message.auditAnnotations = ( + globalThis.Object.entries(object.auditAnnotations ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.warnings = object.warnings?.map((e) => e) || []; + return message; + }, +}; + +function createBaseAdmissionResponse_AuditAnnotationsEntry(): AdmissionResponse_AuditAnnotationsEntry { + return { key: '', value: '' }; +} + +export const AdmissionResponse_AuditAnnotationsEntry: MessageFns = { + encode( + message: AdmissionResponse_AuditAnnotationsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AdmissionResponse_AuditAnnotationsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAdmissionResponse_AuditAnnotationsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AdmissionResponse_AuditAnnotationsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: AdmissionResponse_AuditAnnotationsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): AdmissionResponse_AuditAnnotationsEntry { + return AdmissionResponse_AuditAnnotationsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): AdmissionResponse_AuditAnnotationsEntry { + const message = createBaseAdmissionResponse_AuditAnnotationsEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBaseAdmissionReview(): AdmissionReview { + return { request: undefined, response: undefined }; +} + +export const AdmissionReview: MessageFns = { + encode(message: AdmissionReview, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.request !== undefined) { + AdmissionRequest.encode(message.request, writer.uint32(10).fork()).join(); + } + if (message.response !== undefined) { + AdmissionResponse.encode(message.response, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AdmissionReview { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAdmissionReview(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.request = AdmissionRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.response = AdmissionResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AdmissionReview { + return { + request: isSet(object.request) ? AdmissionRequest.fromJSON(object.request) : undefined, + response: isSet(object.response) ? AdmissionResponse.fromJSON(object.response) : undefined, + }; + }, + + toJSON(message: AdmissionReview): unknown { + const obj: any = {}; + if (message.request !== undefined) { + obj.request = AdmissionRequest.toJSON(message.request); + } + if (message.response !== undefined) { + obj.response = AdmissionResponse.toJSON(message.response); + } + return obj; + }, + + create, I>>(base?: I): AdmissionReview { + return AdmissionReview.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AdmissionReview { + const message = createBaseAdmissionReview(); + message.request = + object.request !== undefined && object.request !== null + ? AdmissionRequest.fromPartial(object.request) + : undefined; + message.response = + object.response !== undefined && object.response !== null + ? AdmissionResponse.fromPartial(object.response) + : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from((globalThis as any).Buffer.from(b64, 'base64')); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return (globalThis as any).Buffer.from(arr).toString('base64'); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join('')); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/admissionregistration/v1/generated.ts b/src/proto/generated/k8s.io/api/admissionregistration/v1/generated.ts new file mode 100644 index 00000000000..3a6f844b2ed --- /dev/null +++ b/src/proto/generated/k8s.io/api/admissionregistration/v1/generated.ts @@ -0,0 +1,5751 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/admissionregistration/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { + Condition, + LabelSelector, + ListMeta, + ObjectMeta, +} from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** ApplyConfiguration defines the desired configuration values of an object. */ +export interface ApplyConfiguration { + /** + * expression will be evaluated by CEL to create an apply configuration. + * ref: https://github.com/google/cel-spec + * + * Apply configurations are declared in CEL using object initialization. For example, this CEL expression + * returns an apply configuration to set a single field: + * + * Object{ + * spec: Object.spec{ + * serviceAccountName: "example" + * } + * } + * + * Apply configurations may not modify atomic structs, maps or arrays due to the risk of accidental deletion of + * values not included in the apply configuration. + * + * CEL expressions have access to the object types needed to create apply configurations: + * + * - 'Object' - CEL type of the resource object. + * - 'Object.' - CEL type of object field (such as 'Object.spec') + * - 'Object.....` - CEL type of nested field (such as 'Object.spec.containers') + * + * CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables: + * + * - 'object' - The object from the incoming request. The value is null for DELETE requests. + * - 'oldObject' - The existing object. The value is null for CREATE requests. + * - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). + * - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. + * - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. + * - 'variables' - Map of composited variables, from its name to its lazily evaluated value. + * For example, a variable named 'foo' can be accessed as 'variables.foo'. + * - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + * See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + * - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + * request resource. + * + * The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the + * object. No other metadata properties are accessible. + * + * Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. + * Required. + */ + expression?: string | undefined; +} + +/** AuditAnnotation describes how to produce an audit annotation for an API request. */ +export interface AuditAnnotation { + /** + * key specifies the audit annotation key. The audit annotation keys of + * a ValidatingAdmissionPolicy must be unique. The key must be a qualified + * name ([A-Za-z0-9][-A-Za-z0-9_.]*) no more than 63 bytes in length. + * + * The key is combined with the resource name of the + * ValidatingAdmissionPolicy to construct an audit annotation key: + * "{ValidatingAdmissionPolicy name}/{key}". + * + * If an admission webhook uses the same resource name as this ValidatingAdmissionPolicy + * and the same audit annotation key, the annotation key will be identical. + * In this case, the first annotation written with the key will be included + * in the audit event and all subsequent annotations with the same key + * will be discarded. + * + * Required. + */ + key?: string | undefined; + /** + * valueExpression represents the expression which is evaluated by CEL to + * produce an audit annotation value. The expression must evaluate to either + * a string or null value. If the expression evaluates to a string, the + * audit annotation is included with the string value. If the expression + * evaluates to null or empty string the audit annotation will be omitted. + * The valueExpression may be no longer than 5kb in length. + * If the result of the valueExpression is more than 10kb in length, it + * will be truncated to 10kb. + * + * If multiple ValidatingAdmissionPolicyBinding resources match an + * API request, then the valueExpression will be evaluated for + * each binding. All unique values produced by the valueExpressions + * will be joined together in a comma-separated list. + * + * Required. + */ + valueExpression?: string | undefined; +} + +/** ExpressionWarning is a warning information that targets a specific expression. */ +export interface ExpressionWarning { + /** + * fieldRef is the path to the field that refers to the expression. + * For example, the reference to the expression of the first item of + * validations is "spec.validations[0].expression" + */ + fieldRef?: string | undefined; + /** + * warning contains the content of type checking information in a human-readable form. + * Each line of the warning contains the type that the expression is checked + * against, followed by the type check error from the compiler. + */ + warning?: string | undefined; +} + +/** JSONPatch defines a JSON Patch. */ +export interface JSONPatch { + /** + * expression will be evaluated by CEL to create a [JSON patch](https://jsonpatch.com/). + * ref: https://github.com/google/cel-spec + * + * expression must return an array of JSONPatch values. + * + * For example, this CEL expression returns a JSON patch to conditionally modify a value: + * + * [ + * JSONPatch{op: "test", path: "/spec/example", value: "Red"}, + * JSONPatch{op: "replace", path: "/spec/example", value: "Green"} + * ] + * + * To define an object for the patch value, use Object types. For example: + * + * [ + * JSONPatch{ + * op: "add", + * path: "/spec/selector", + * value: Object.spec.selector{matchLabels: {"environment": "test"}} + * } + * ] + * + * To use strings containing '/' and '~' as JSONPatch path keys, use "jsonpatch.escapeKey". For example: + * + * [ + * JSONPatch{ + * op: "add", + * path: "/metadata/labels/" + jsonpatch.escapeKey("example.com/environment"), + * value: "test" + * }, + * ] + * + * CEL expressions have access to the types needed to create JSON patches and objects: + * + * - 'JSONPatch' - CEL type of JSON Patch operations. JSONPatch has the fields 'op', 'from', 'path' and 'value'. + * See [JSON patch](https://jsonpatch.com/) for more details. The 'value' field may be set to any of: string, + * integer, array, map or object. If set, the 'path' and 'from' fields must be set to a + * [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901/) string, where the 'jsonpatch.escapeKey()' CEL + * function may be used to escape path keys containing '/' and '~'. + * - 'Object' - CEL type of the resource object. + * - 'Object.' - CEL type of object field (such as 'Object.spec') + * - 'Object.....` - CEL type of nested field (such as 'Object.spec.containers') + * + * CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables: + * + * - 'object' - The object from the incoming request. The value is null for DELETE requests. + * - 'oldObject' - The existing object. The value is null for CREATE requests. + * - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). + * - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. + * - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. + * - 'variables' - Map of composited variables, from its name to its lazily evaluated value. + * For example, a variable named 'foo' can be accessed as 'variables.foo'. + * - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + * See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + * - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + * request resource. + * + * CEL expressions have access to [Kubernetes CEL function libraries](https://kubernetes.io/docs/reference/using-api/cel/#cel-options-language-features-and-libraries) + * as well as: + * + * - 'jsonpatch.escapeKey' - Performs JSONPatch key escaping. '~' and '/' are escaped as '~0' and `~1' respectively). + * + * Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. + * Required. + */ + expression?: string | undefined; +} + +/** MatchCondition represents a condition which must by fulfilled for a request to be sent to a webhook. */ +export interface MatchCondition { + /** + * name is an identifier for this match condition, used for strategic merging of MatchConditions, + * as well as providing an identifier for logging purposes. A good name should be descriptive of + * the associated expression. + * Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and + * must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or + * '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an + * optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName') + * + * Required. + */ + name?: string | undefined; + /** + * expression represents the expression which will be evaluated by CEL. Must evaluate to bool. + * CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables: + * + * 'object' - The object from the incoming request. The value is null for DELETE requests. + * 'oldObject' - The existing object. The value is null for CREATE requests. + * 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). + * 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + * See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + * 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + * request resource. + * Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/ + * + * Required. + */ + expression?: string | undefined; +} + +/** + * 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) + * +structType=atomic + */ +export interface MatchResources { + /** + * namespaceSelector decides whether to run the admission control policy on an object based + * on whether the namespace for that object matches the selector. If the + * object itself is a namespace, the matching is performed on + * object.metadata.labels. If the object is another cluster scoped resource, + * it never skips the policy. + * + * For example, to run the webhook on any objects whose namespace is not + * associated with "runlevel" of "0" or "1"; you will set the selector as + * follows: + * "namespaceSelector": { + * "matchExpressions": [ + * { + * "key": "runlevel", + * "operator": "NotIn", + * "values": [ + * "0", + * "1" + * ] + * } + * ] + * } + * + * If instead you want to only run the policy on any objects whose + * namespace is associated with the "environment" of "prod" or "staging"; + * you will set the selector as follows: + * "namespaceSelector": { + * "matchExpressions": [ + * { + * "key": "environment", + * "operator": "In", + * "values": [ + * "prod", + * "staging" + * ] + * } + * ] + * } + * + * See + * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + * for more examples of label selectors. + * + * Default to the empty LabelSelector, which matches everything. + * +optional + */ + namespaceSelector?: LabelSelector | undefined; + /** + * objectSelector decides whether to run the validation based on if the + * object has matching labels. objectSelector is evaluated against both + * the oldObject and newObject that would be sent to the cel validation, and + * is considered to match if either object matches the selector. A null + * object (oldObject in the case of create, or newObject in the case of + * delete) or an object that cannot have labels (like a + * DeploymentRollback or a PodProxyOptions object) is not considered to + * match. + * Use the object selector only if the webhook is opt-in, because end + * users may skip the admission webhook by setting the labels. + * Default to the empty LabelSelector, which matches everything. + * +optional + */ + objectSelector?: LabelSelector | undefined; + /** + * resourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. + * The policy cares about an operation if it matches _any_ Rule. + * +listType=atomic + * +optional + */ + resourceRules: NamedRuleWithOperations[]; + /** + * excludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. + * The exclude rules take precedence over include rules (if a resource matches both, it is excluded) + * +listType=atomic + * +optional + */ + excludeResourceRules: NamedRuleWithOperations[]; + /** + * matchPolicy defines how the "MatchResources" list is used to match incoming requests. + * Allowed values are "Exact" or "Equivalent". + * + * - Exact: match a request only if it exactly matches a specified rule. + * For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, + * but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, + * a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy. + * + * - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. + * For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, + * and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, + * a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy. + * + * Defaults to "Equivalent" + * +optional + */ + matchPolicy?: string | undefined; +} + +/** MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. */ +export interface MutatingAdmissionPolicy { + /** + * metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** spec defines the desired behavior of the MutatingAdmissionPolicy. */ + spec?: MutatingAdmissionPolicySpec | undefined; +} + +/** + * MutatingAdmissionPolicyBinding binds the MutatingAdmissionPolicy with parametrized resources. + * MutatingAdmissionPolicyBinding and the optional parameter resource 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. + * Each evaluation is constrained by a [runtime cost budget](https://kubernetes.io/docs/reference/using-api/cel/#runtime-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 MutatingAdmissionPolicyBinding { + /** + * metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** spec defines the desired behavior of the MutatingAdmissionPolicyBinding. */ + spec?: MutatingAdmissionPolicyBindingSpec | undefined; +} + +/** MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding. */ +export interface MutatingAdmissionPolicyBindingList { + /** + * metadata is the standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of PolicyBinding. */ + items: MutatingAdmissionPolicyBinding[]; +} + +/** MutatingAdmissionPolicyBindingSpec defines the specification of the MutatingAdmissionPolicyBinding. */ +export interface MutatingAdmissionPolicyBindingSpec { + /** + * policyName references a MutatingAdmissionPolicy name which the MutatingAdmissionPolicyBinding binds to. + * If the referenced resource does not exist, this binding is considered invalid and will be ignored + * Required. + */ + policyName?: string | undefined; + /** + * paramRef specifies the parameter resource used to configure the admission control policy. + * It should point to a resource of the type specified in spec.ParamKind of the bound MutatingAdmissionPolicy. + * If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the MutatingAdmissionPolicy applied. + * If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param. + * +optional + */ + paramRef?: ParamRef | undefined; + /** + * matchResources limits what resources match this binding and may be mutated by it. + * Note that if matchResources matches a resource, the resource must also match a policy's matchConstraints and + * matchConditions before the resource may be mutated. + * When matchResources is unset, it does not constrain resource matching, and only the policy's matchConstraints + * and matchConditions must match for the resource to be mutated. + * Additionally, matchResources.resourceRules are optional and do not constraint matching when unset. + * Note that this is differs from MutatingAdmissionPolicy matchConstraints, where resourceRules are required. + * The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched. + * '*' matches CREATE, UPDATE and CONNECT. + * +optional + */ + matchResources?: MatchResources | undefined; +} + +/** MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy. */ +export interface MutatingAdmissionPolicyList { + /** + * metadata is the standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of ValidatingAdmissionPolicy. */ + items: MutatingAdmissionPolicy[]; +} + +/** MutatingAdmissionPolicySpec defines the desired behavior of the admission policy. */ +export interface MutatingAdmissionPolicySpec { + /** + * paramKind specifies the kind of resources used to parameterize this policy. + * If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. + * If paramKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. + * If paramKind is specified but paramRef is unset in MutatingAdmissionPolicyBinding, the params variable will be null. + * +optional + */ + paramKind?: ParamKind | undefined; + /** + * matchConstraints specifies what resources this policy is designed to validate. + * The MutatingAdmissionPolicy cares about a request if it matches _all_ Constraints. + * However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API + * MutatingAdmissionPolicy cannot match MutatingAdmissionPolicy and MutatingAdmissionPolicyBinding. + * The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched. + * '*' matches CREATE, UPDATE and CONNECT. + * Required. + */ + matchConstraints?: MatchResources | undefined; + /** + * variables contain definitions of variables that can be used in composition of other expressions. + * Each variable is defined as a named CEL expression. + * The variables defined here will be available under `variables` in other expressions of the policy + * except matchConditions because matchConditions are evaluated before the rest of the policy. + * + * The expression of a variable can refer to other variables defined earlier in the list but not those after. + * Thus, variables must be sorted by the order of first appearance and acyclic. + * +listType=atomic + * +optional + */ + variables: Variable[]; + /** + * mutations contain operations to perform on matching objects. + * mutations may not be empty; a minimum of one mutation is required. + * mutations are evaluated in order, and are reinvoked according to + * the reinvocationPolicy. + * The mutations of a policy are invoked for each binding of this policy + * and reinvocation of mutations occurs on a per binding basis. + * + * +listType=atomic + * +optional + */ + mutations: Mutation[]; + /** + * failurePolicy defines how to handle failures for the admission policy. Failures can + * occur from CEL expression parse errors, type check errors, runtime errors and invalid + * or mis-configured policy definitions or bindings. + * + * A policy is invalid if paramKind refers to a non-existent Kind. + * A binding is invalid if paramRef.name refers to a non-existent resource. + * + * failurePolicy does not define how validations that evaluate to false are handled. + * + * Allowed values are Ignore or Fail. Defaults to Fail. + * +optional + */ + failurePolicy?: string | undefined; + /** + * matchConditions is a list of conditions that must be met for a request to be validated. + * Match conditions filter requests that have already been matched by the matchConstraints. + * An empty list of matchConditions matches all requests. + * There are a maximum of 64 match conditions allowed. + * + * If a parameter object is provided, it can be accessed via the `params` handle in the same + * manner as validation expressions. + * + * The exact matching logic is (in order): + * 1. If ANY matchCondition evaluates to FALSE, the policy is skipped. + * 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated. + * 3. If any matchCondition evaluates to an error (but none are FALSE): + * - If failurePolicy=Fail, reject the request + * - If failurePolicy=Ignore, the policy is skipped + * + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + * +optional + */ + matchConditions: MatchCondition[]; + /** + * reinvocationPolicy indicates whether mutations may be called multiple times per MutatingAdmissionPolicyBinding + * as part of a single admission evaluation. + * Allowed values are "Never" and "IfNeeded". + * + * Never: These mutations will not be called more than once per binding in a single admission evaluation. + * + * IfNeeded: These mutations may be invoked more than once per binding for a single admission request and there is no guarantee of + * order with respect to other admission plugins, admission webhooks, bindings of this policy and admission policies. Mutations are only + * reinvoked when mutations change the object after this mutation is invoked. + * Required. + */ + reinvocationPolicy?: string | undefined; +} + +/** MutatingWebhook describes an admission webhook and the resources and operations it applies to. */ +export interface MutatingWebhook { + /** + * name is the name of the admission webhook. + * Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where + * "imagepolicy" is the name of the webhook, and kubernetes.io is the name + * of the organization. + * Required. + */ + name?: string | undefined; + /** + * clientConfig defines how to communicate with the hook. + * Required + */ + clientConfig?: WebhookClientConfig | undefined; + /** + * rules describes what operations on what resources/subresources the webhook cares about. + * The webhook cares about an operation if it matches _any_ Rule. + * However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks + * from putting the cluster in a state which cannot be recovered from without completely + * disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called + * on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects. + * +listType=atomic + */ + rules: RuleWithOperations[]; + /** + * failurePolicy defines how unrecognized errors from the admission endpoint are handled - + * allowed values are Ignore or Fail. Defaults to Fail. + * +optional + */ + failurePolicy?: string | undefined; + /** + * matchPolicy defines how the "rules" list is used to match incoming requests. + * Allowed values are "Exact" or "Equivalent". + * + * - Exact: match a request only if it exactly matches a specified rule. + * For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, + * but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, + * a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook. + * + * - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. + * For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, + * and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, + * a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook. + * + * Defaults to "Equivalent" + * +optional + */ + matchPolicy?: string | undefined; + /** + * namespaceSelector decides whether to run the webhook on an object based + * on whether the namespace for that object matches the selector. If the + * object itself is a namespace, the matching is performed on + * object.metadata.labels. If the object is another cluster scoped resource, + * it never skips the webhook. + * + * For example, to run the webhook on any objects whose namespace is not + * associated with "runlevel" of "0" or "1"; you will set the selector as + * follows: + * "namespaceSelector": { + * "matchExpressions": [ + * { + * "key": "runlevel", + * "operator": "NotIn", + * "values": [ + * "0", + * "1" + * ] + * } + * ] + * } + * + * If instead you want to only run the webhook on any objects whose + * namespace is associated with the "environment" of "prod" or "staging"; + * you will set the selector as follows: + * "namespaceSelector": { + * "matchExpressions": [ + * { + * "key": "environment", + * "operator": "In", + * "values": [ + * "prod", + * "staging" + * ] + * } + * ] + * } + * + * See + * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + * for more examples of label selectors. + * + * Default to the empty LabelSelector, which matches everything. + * +optional + */ + namespaceSelector?: LabelSelector | undefined; + /** + * objectSelector decides whether to run the webhook based on if the + * object has matching labels. objectSelector is evaluated against both + * the oldObject and newObject that would be sent to the webhook, and + * is considered to match if either object matches the selector. A null + * object (oldObject in the case of create, or newObject in the case of + * delete) or an object that cannot have labels (like a + * DeploymentRollback or a PodProxyOptions object) is not considered to + * match. + * Use the object selector only if the webhook is opt-in, because end + * users may skip the admission webhook by setting the labels. + * Default to the empty LabelSelector, which matches everything. + * +optional + */ + objectSelector?: LabelSelector | undefined; + /** + * sideEffects states whether this webhook has side effects. + * Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). + * Webhooks with side effects MUST implement a reconciliation system, since a request may be + * rejected by a future step in the admission chain and the side effects therefore need to be undone. + * Requests with the dryRun attribute will be auto-rejected if they match a webhook with + * sideEffects == Unknown or Some. + */ + sideEffects?: string | undefined; + /** + * timeoutSeconds specifies the timeout for this webhook. After the timeout passes, + * the webhook call will be ignored or the API call will fail based on the + * failure policy. + * The timeout value must be between 1 and 30 seconds. + * Default to 10 seconds. + * +optional + */ + timeoutSeconds?: number | undefined; + /** + * admissionReviewVersions is an ordered list of preferred `AdmissionReview` + * versions the Webhook expects. API server will try to use first version in + * the list which it supports. If none of the versions specified in this list + * supported by API server, validation will fail for this object. + * If a persisted webhook configuration specifies allowed versions and does not + * include any versions known to the API Server, calls to the webhook will fail + * and be subject to the failure policy. + * +listType=atomic + */ + admissionReviewVersions: string[]; + /** + * reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation. + * Allowed values are "Never" and "IfNeeded". + * + * Never: the webhook will not be called more than once in a single admission evaluation. + * + * IfNeeded: the webhook will be called at least one additional time as part of the admission evaluation + * if the object being admitted is modified by other admission plugins after the initial webhook call. + * Webhooks that specify this option *must* be idempotent, able to process objects they previously admitted. + * Note: + * * the number of additional invocations is not guaranteed to be exactly one. + * * if additional invocations result in further modifications to the object, webhooks are not guaranteed to be invoked again. + * * webhooks that use this option may be reordered to minimize the number of additional invocations. + * * to validate an object after all mutations are guaranteed complete, use a validating admission webhook instead. + * + * Defaults to "Never". + * +optional + */ + reinvocationPolicy?: string | undefined; + /** + * matchConditions is a list of conditions that must be met for a request to be sent to this + * webhook. Match conditions filter requests that have already been matched by the rules, + * namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. + * There are a maximum of 64 match conditions allowed. + * + * The exact matching logic is (in order): + * 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped. + * 2. If ALL matchConditions evaluate to TRUE, the webhook is called. + * 3. If any matchCondition evaluates to an error (but none are FALSE): + * - If failurePolicy=Fail, reject the request + * - If failurePolicy=Ignore, the error is ignored and the webhook is skipped + * + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + * +optional + */ + matchConditions: MatchCondition[]; +} + +/** MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. */ +export interface MutatingWebhookConfiguration { + /** + * metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * webhooks is a list of webhooks and the affected resources and operations. + * +optional + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + */ + Webhooks: MutatingWebhook[]; +} + +/** MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration. */ +export interface MutatingWebhookConfigurationList { + /** + * metadata is the standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of MutatingWebhookConfiguration. */ + items: MutatingWebhookConfiguration[]; +} + +/** Mutation specifies the CEL expression which is used to apply the Mutation. */ +export interface Mutation { + /** + * patchType indicates the patch strategy used. + * Allowed values are "ApplyConfiguration" and "JSONPatch". + * Required. + * + * +unionDiscriminator + */ + patchType?: string | undefined; + /** + * applyConfiguration defines the desired configuration values of an object. + * The configuration is applied to the admission object using + * [structured merge diff](https://github.com/kubernetes-sigs/structured-merge-diff). + * A CEL expression is used to create apply configuration. + */ + applyConfiguration?: ApplyConfiguration | undefined; + /** + * jsonPatch defines a [JSON patch](https://jsonpatch.com/) operation to perform a mutation to the object. + * A CEL expression is used to create the JSON patch. + */ + jsonPatch?: JSONPatch | undefined; +} + +/** + * NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. + * +structType=atomic + */ +export interface NamedRuleWithOperations { + /** + * resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + * +listType=atomic + * +optional + */ + resourceNames: string[]; + /** RuleWithOperations is a tuple of Operations and Resources. */ + ruleWithOperations?: RuleWithOperations | undefined; +} + +/** + * ParamKind is a tuple of Group Kind and Version. + * +structType=atomic + */ +export interface ParamKind { + /** + * apiVersion is the API group version the resources belong to. + * In format of "group/version". + * Required. + */ + apiVersion?: string | undefined; + /** + * kind is the API kind the resources belong to. + * Required. + */ + kind?: string | undefined; +} + +/** + * ParamRef describes how to locate the params to be used as input to + * expressions of rules applied by a policy binding. + * +structType=atomic + */ +export interface ParamRef { + /** + * name is the name of the resource being referenced. + * + * One of `name` or `selector` must be set, but `name` and `selector` are + * mutually exclusive properties. If one is set, the other must be unset. + * + * A single parameter used for all admission requests can be configured + * by setting the `name` field, leaving `selector` blank, and setting namespace + * if `paramKind` is namespace-scoped. + */ + name?: string | undefined; + /** + * namespace is the namespace of the referenced resource. Allows limiting + * the search for params to a specific namespace. Applies to both `name` and + * `selector` fields. + * + * A per-namespace parameter may be used by specifying a namespace-scoped + * `paramKind` in the policy and leaving this field empty. + * + * - If `paramKind` is cluster-scoped, this field MUST be unset. Setting this + * field results in a configuration error. + * + * - If `paramKind` is namespace-scoped, the namespace of the object being + * evaluated for admission will be used when this field is left unset. Take + * care that if this is left empty the binding must not match any cluster-scoped + * resources, which will result in an error. + * + * +optional + */ + namespace?: string | undefined; + /** + * selector can be used to match multiple param objects based on their labels. + * Supply selector: {} to match all resources of the ParamKind. + * + * If multiple params are found, they are all evaluated with the policy expressions + * and the results are ANDed together. + * + * One of `name` or `selector` must be set, but `name` and `selector` are + * mutually exclusive properties. If one is set, the other must be unset. + * + * +optional + */ + selector?: LabelSelector | undefined; + /** + * parameterNotFoundAction controls the behavior of the binding when the resource + * exists, and name or selector is valid, but there are no parameters + * matched by the binding. If the value is set to `Allow`, then no + * matched parameters will be treated as successful validation by the binding. + * If set to `Deny`, then no matched parameters will be subject to the + * `failurePolicy` of the policy. + * + * Allowed values are `Allow` or `Deny` + * + * Required + */ + parameterNotFoundAction?: string | undefined; +} + +/** + * Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended + * to make sure that all the tuple expansions are valid. + */ +export interface Rule { + /** + * apiGroups is the API groups the resources belong to. '*' is all groups. + * If '*' is present, the length of the slice must be one. + * Required. + * +listType=atomic + */ + apiGroups: string[]; + /** + * apiVersions is the API versions the resources belong to. '*' is all versions. + * If '*' is present, the length of the slice must be one. + * Required. + * +listType=atomic + */ + apiVersions: string[]; + /** + * resources is a list of resources this rule applies to. + * + * For example: + * 'pods' means pods. + * 'pods/log' means the log subresource of pods. + * '*' means all resources, but not subresources. + * 'pods/*' means all subresources of pods. + * '* /scale' means all scale subresources. + * '* /*' means all resources and their subresources. + * + * If wildcard is present, the validation rule will ensure resources do not + * overlap with each other. + * + * Depending on the enclosing object, subresources might not be allowed. + * Required. + * +listType=atomic + */ + resources: string[]; + /** + * scope specifies the scope of this rule. + * Valid values are "Cluster", "Namespaced", and "*" + * "Cluster" means that only cluster-scoped resources will match this rule. + * Namespace API objects are cluster-scoped. + * "Namespaced" means that only namespaced resources will match this rule. + * "*" means that there are no scope restrictions. + * Subresources match the scope of their parent resource. + * Default is "*". + * + * +optional + */ + scope?: string | undefined; +} + +/** + * RuleWithOperations is a tuple of Operations and Resources. It is recommended to make + * sure that all the tuple expansions are valid. + */ +export interface RuleWithOperations { + /** + * operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * + * for all of those operations and any future admission operations that are added. + * If '*' is present, the length of the slice must be one. + * Required. + * +listType=atomic + */ + operations: string[]; + /** + * Rule is embedded, it describes other criteria of the rule, like + * APIGroups, APIVersions, Resources, etc. + */ + rule?: Rule | undefined; +} + +/** ServiceReference holds a reference to Service.legacy.k8s.io */ +export interface ServiceReference { + /** + * namespace is the namespace of the service. + * Required + */ + namespace?: string | undefined; + /** + * name is the name of the service. + * Required + */ + name?: string | undefined; + /** + * path is an optional URL path which will be sent in any request to + * this service. + * +optional + */ + path?: string | undefined; + /** + * port is the port on the service that hosts the webhook. + * Default to 443 for backward compatibility. + * `port` should be a valid port number (1-65535, inclusive). + * +optional + */ + port?: number | undefined; +} + +/** + * TypeChecking contains results of type checking the expressions in the + * ValidatingAdmissionPolicy + */ +export interface TypeChecking { + /** + * expressionWarnings contains the type checking warnings for each expression. + * +optional + * +listType=atomic + */ + expressionWarnings: ExpressionWarning[]; +} + +/** + * ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. + * +k8s:supportsSubresource="/status" + */ +export interface ValidatingAdmissionPolicy { + /** + * metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** spec defines the desired behavior of the ValidatingAdmissionPolicy. */ + spec?: ValidatingAdmissionPolicySpec | undefined; + /** + * status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy + * behaves in the expected way. + * Populated by the system. + * Read-only. + * +optional + */ + status?: ValidatingAdmissionPolicyStatus | 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 { + /** + * metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. + * +required + */ + spec?: ValidatingAdmissionPolicyBindingSpec | undefined; +} + +/** ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding. */ +export interface ValidatingAdmissionPolicyBindingList { + /** + * metadata is the standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of PolicyBinding. */ + items: ValidatingAdmissionPolicyBinding[]; +} + +/** ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. */ +export interface ValidatingAdmissionPolicyBindingSpec { + /** + * policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. + * If the referenced resource does not exist, this binding is considered invalid and will be ignored + * Required. + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + policyName?: string | undefined; + /** + * paramRef specifies the parameter resource used to configure the admission control policy. + * It should point to a resource of the type specified in ParamKind of the bound ValidatingAdmissionPolicy. + * If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. + * If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param. + * +optional + */ + paramRef?: ParamRef | undefined; + /** + * matchResources declares what resources match this binding and will be validated by it. + * Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. + * If this is unset, all resources matched by the policy are validated by this binding + * When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. + * Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required. + * +optional + */ + matchResources?: MatchResources | undefined; + /** + * validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced. + * If a validation evaluates to false it is always enforced according to these actions. + * + * Failures defined by the ValidatingAdmissionPolicy's FailurePolicy are enforced according + * to these actions only if the FailurePolicy is set to Fail, otherwise the failures are + * ignored. This includes compilation errors, runtime errors and misconfigurations of the policy. + * + * validationActions is declared as a set of action values. Order does + * not matter. validationActions may not contain duplicates of the same action. + * + * The supported actions values are: + * + * "Deny" specifies that a validation failure results in a denied request. + * + * "Warn" specifies that a validation failure is reported to the request client + * in HTTP Warning headers, with a warning code of 299. Warnings can be sent + * both for allowed or denied admission responses. + * + * "Audit" specifies that a validation failure is included in the published + * audit event for the request. The audit event will contain a + * `validation.policy.admission.k8s.io/validation_failure` audit annotation + * with a value containing the details of the validation failures, formatted as + * a JSON list of objects, each with the following fields: + * - message: The validation failure message string + * - policy: The resource name of the ValidatingAdmissionPolicy + * - binding: The resource name of the ValidatingAdmissionPolicyBinding + * - expressionIndex: The index of the failed validations in the ValidatingAdmissionPolicy + * - validationActions: The enforcement actions enacted for the validation failure + * Example audit annotation: + * `"validation.policy.admission.k8s.io/validation_failure": "[{\"message\": \"Invalid value\", {\"policy\": \"policy.example.com\", {\"binding\": \"policybinding.example.com\", {\"expressionIndex\": \"1\", {\"validationActions\": [\"Audit\"]}]"` + * + * Clients should expect to handle additional values by ignoring + * any values not recognized. + * + * "Deny" and "Warn" may not be used together since this combination + * needlessly duplicates the validation failure both in the + * API response body and the HTTP warning headers. + * + * Required. + * +listType=set + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + validationActions: string[]; +} + +/** ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy. */ +export interface ValidatingAdmissionPolicyList { + /** + * metadata is the standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of ValidatingAdmissionPolicy. */ + items: ValidatingAdmissionPolicy[]; +} + +/** ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. */ +export interface ValidatingAdmissionPolicySpec { + /** + * paramKind specifies the kind of resources used to parameterize this policy. + * If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. + * If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. + * If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. + * +optional + */ + paramKind?: ParamKind | undefined; + /** + * matchConstraints specifies what resources this policy is designed to validate. + * The AdmissionPolicy cares about a request if it matches _all_ Constraints. + * However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API + * ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. + * Required. + */ + matchConstraints?: MatchResources | undefined; + /** + * validations contain CEL expressions which is used to apply the validation. + * Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is + * required. + * +listType=atomic + * +optional + */ + validations: Validation[]; + /** + * failurePolicy defines how to handle failures for the admission policy. Failures can + * occur from CEL expression parse errors, type check errors, runtime errors and invalid + * or mis-configured policy definitions or bindings. + * + * A policy is invalid if spec.paramKind refers to a non-existent Kind. + * A binding is invalid if spec.paramRef.name refers to a non-existent resource. + * + * failurePolicy does not define how validations that evaluate to false are handled. + * + * When failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions + * define how failures are enforced. + * + * Allowed values are Ignore or Fail. Defaults to Fail. + * +optional + */ + failurePolicy?: string | undefined; + /** + * auditAnnotations contains CEL expressions which are used to produce audit + * annotations for the audit event of the API request. + * validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is + * required. + * +listType=atomic + * +optional + */ + auditAnnotations: AuditAnnotation[]; + /** + * matchConditions is a list of conditions that must be met for a request to be validated. + * Match conditions filter requests that have already been matched by the rules, + * namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. + * There are a maximum of 64 match conditions allowed. + * + * If a parameter object is provided, it can be accessed via the `params` handle in the same + * manner as validation expressions. + * + * The exact matching logic is (in order): + * 1. If ANY matchCondition evaluates to FALSE, the policy is skipped. + * 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated. + * 3. If any matchCondition evaluates to an error (but none are FALSE): + * - If failurePolicy=Fail, reject the request + * - If failurePolicy=Ignore, the policy is skipped + * + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + * +optional + */ + matchConditions: MatchCondition[]; + /** + * variables contain definitions of variables that can be used in composition of other expressions. + * Each variable is defined as a named CEL expression. + * The variables defined here will be available under `variables` in other expressions of the policy + * except MatchConditions because MatchConditions are evaluated before the rest of the policy. + * + * The expression of a variable can refer to other variables defined earlier in the list but not those after. + * Thus, Variables must be sorted by the order of first appearance and acyclic. + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + * +optional + */ + variables: Variable[]; +} + +/** ValidatingAdmissionPolicyStatus represents the status of an admission validation policy. */ +export interface ValidatingAdmissionPolicyStatus { + /** + * observedGeneration is the generation observed by the controller. + * +optional + */ + observedGeneration?: number | undefined; + /** + * typeChecking contains the results of type checking for each expression. + * Presence of this field indicates the completion of the type checking. + * +optional + */ + typeChecking?: TypeChecking | undefined; + /** + * conditions represent the latest available observations of a policy's current state. + * +optional + * +listType=map + * +listMapKey=type + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:listType=map + * +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + */ + conditions: Condition[]; +} + +/** ValidatingWebhook describes an admission webhook and the resources and operations it applies to. */ +export interface ValidatingWebhook { + /** + * name is the name of the admission webhook. + * Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where + * "imagepolicy" is the name of the webhook, and kubernetes.io is the name + * of the organization. + * Required. + */ + name?: string | undefined; + /** + * clientConfig defines how to communicate with the hook. + * Required + */ + clientConfig?: WebhookClientConfig | undefined; + /** + * rules describes what operations on what resources/subresources the webhook cares about. + * The webhook cares about an operation if it matches _any_ Rule. + * However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks + * from putting the cluster in a state which cannot be recovered from without completely + * disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called + * on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects. + * +listType=atomic + */ + rules: RuleWithOperations[]; + /** + * failurePolicy defines how unrecognized errors from the admission endpoint are handled - + * allowed values are Ignore or Fail. Defaults to Fail. + * +optional + */ + failurePolicy?: string | undefined; + /** + * matchPolicy defines how the "rules" list is used to match incoming requests. + * Allowed values are "Exact" or "Equivalent". + * + * - Exact: match a request only if it exactly matches a specified rule. + * For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, + * but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, + * a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook. + * + * - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. + * For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, + * and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, + * a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook. + * + * Defaults to "Equivalent" + * +optional + */ + matchPolicy?: string | undefined; + /** + * namespaceSelector decides whether to run the webhook on an object based + * on whether the namespace for that object matches the selector. If the + * object itself is a namespace, the matching is performed on + * object.metadata.labels. If the object is another cluster scoped resource, + * it never skips the webhook. + * + * For example, to run the webhook on any objects whose namespace is not + * associated with "runlevel" of "0" or "1"; you will set the selector as + * follows: + * "namespaceSelector": { + * "matchExpressions": [ + * { + * "key": "runlevel", + * "operator": "NotIn", + * "values": [ + * "0", + * "1" + * ] + * } + * ] + * } + * + * If instead you want to only run the webhook on any objects whose + * namespace is associated with the "environment" of "prod" or "staging"; + * you will set the selector as follows: + * "namespaceSelector": { + * "matchExpressions": [ + * { + * "key": "environment", + * "operator": "In", + * "values": [ + * "prod", + * "staging" + * ] + * } + * ] + * } + * + * See + * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + * for more examples of label selectors. + * + * Default to the empty LabelSelector, which matches everything. + * +optional + */ + namespaceSelector?: LabelSelector | undefined; + /** + * objectSelector decides whether to run the webhook based on if the + * object has matching labels. objectSelector is evaluated against both + * the oldObject and newObject that would be sent to the webhook, and + * is considered to match if either object matches the selector. A null + * object (oldObject in the case of create, or newObject in the case of + * delete) or an object that cannot have labels (like a + * DeploymentRollback or a PodProxyOptions object) is not considered to + * match. + * Use the object selector only if the webhook is opt-in, because end + * users may skip the admission webhook by setting the labels. + * Default to the empty LabelSelector, which matches everything. + * +optional + */ + objectSelector?: LabelSelector | undefined; + /** + * sideEffects states whether this webhook has side effects. + * Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). + * Webhooks with side effects MUST implement a reconciliation system, since a request may be + * rejected by a future step in the admission chain and the side effects therefore need to be undone. + * Requests with the dryRun attribute will be auto-rejected if they match a webhook with + * sideEffects == Unknown or Some. + */ + sideEffects?: string | undefined; + /** + * timeoutSeconds specifies the timeout for this webhook. After the timeout passes, + * the webhook call will be ignored or the API call will fail based on the + * failure policy. + * The timeout value must be between 1 and 30 seconds. + * Default to 10 seconds. + * +optional + */ + timeoutSeconds?: number | undefined; + /** + * admissionReviewVersions is an ordered list of preferred `AdmissionReview` + * versions the Webhook expects. API server will try to use first version in + * the list which it supports. If none of the versions specified in this list + * supported by API server, validation will fail for this object. + * If a persisted webhook configuration specifies allowed versions and does not + * include any versions known to the API Server, calls to the webhook will fail + * and be subject to the failure policy. + * +listType=atomic + */ + admissionReviewVersions: string[]; + /** + * matchConditions is a list of conditions that must be met for a request to be sent to this + * webhook. Match conditions filter requests that have already been matched by the rules, + * namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. + * There are a maximum of 64 match conditions allowed. + * + * The exact matching logic is (in order): + * 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped. + * 2. If ALL matchConditions evaluate to TRUE, the webhook is called. + * 3. If any matchCondition evaluates to an error (but none are FALSE): + * - If failurePolicy=Fail, reject the request + * - If failurePolicy=Ignore, the error is ignored and the webhook is skipped + * + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + * +optional + */ + matchConditions: MatchCondition[]; +} + +/** ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. */ +export interface ValidatingWebhookConfiguration { + /** + * metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * webhooks is a list of webhooks and the affected resources and operations. + * +optional + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + */ + Webhooks: ValidatingWebhook[]; +} + +/** ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration. */ +export interface ValidatingWebhookConfigurationList { + /** + * metadata is the standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of ValidatingWebhookConfiguration. */ + items: ValidatingWebhookConfiguration[]; +} + +/** Validation specifies the CEL expression which is used to apply the validation. */ +export interface Validation { + /** + * expression represents the expression which will be evaluated by CEL. + * ref: https://github.com/google/cel-spec + * CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: + * + * - 'object' - The object from the incoming request. The value is null for DELETE requests. + * - 'oldObject' - The existing object. The value is null for CREATE requests. + * - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). + * - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. + * - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. + * - 'variables' - Map of composited variables, from its name to its lazily evaluated value. + * For example, a variable named 'foo' can be accessed as 'variables.foo'. + * - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + * See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + * - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + * request resource. + * + * The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the + * object. No other metadata properties are accessible. + * + * Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. + * Accessible property names are escaped according to the following rules when accessed in the expression: + * - '__' escapes to '__underscores__' + * - '.' escapes to '__dot__' + * - '-' escapes to '__dash__' + * - '/' escapes to '__slash__' + * - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are: + * "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if", + * "import", "let", "loop", "package", "namespace", "return". + * Examples: + * - Expression accessing a property named "namespace": {"Expression": "object.__namespace__ > 0"} + * - Expression accessing a property named "x-prop": {"Expression": "object.x__dash__prop > 0"} + * - Expression accessing a property named "redact__d": {"Expression": "object.redact__underscores__d > 0"} + * + * Equality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. + * Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type: + * - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and + * non-intersecting elements in `Y` are appended, retaining their partial order. + * - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values + * are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with + * non-intersecting keys are appended, retaining their partial order. + * Required. + */ + Expression?: string | undefined; + /** + * message represents the message displayed when validation fails. The message is required if the Expression contains + * line breaks. The message must not contain line breaks. + * If unset, the message is "failed rule: {Rule}". + * e.g. "must be a URL with the host matching spec.host" + * If the Expression contains line breaks. Message is required. + * The message must not contain line breaks. + * If unset, the message is "failed Expression: {Expression}". + * +optional + */ + message?: string | undefined; + /** + * reason represents a machine-readable description of why this validation failed. + * If this is the first validation in the list to fail, this reason, as well as the + * corresponding HTTP response code, are used in the + * HTTP response to the client. + * The currently supported reasons are: "Unauthorized", "Forbidden", "Invalid", "RequestEntityTooLarge". + * If not set, StatusReasonInvalid is used in the response to the client. + * +optional + */ + reason?: string | undefined; + /** + * messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. + * Since messageExpression is used as a failure message, it must evaluate to a string. + * If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails. + * If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced + * as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string + * that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and + * the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. + * messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'. + * Example: + * "object.x must be less than max ("+string(params.max)+")" + * +optional + */ + messageExpression?: string | undefined; +} + +/** + * Variable is the definition of a variable that is used for composition. A variable is defined as a named expression. + * +structType=atomic + */ +export interface Variable { + /** + * name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. + * The variable can be accessed in other expressions through `variables` + * For example, if name is "foo", the variable will be available as `variables.foo` + */ + Name?: string | undefined; + /** + * expression is the expression that will be evaluated as the value of the variable. + * The CEL expression has access to the same identifiers as the CEL expressions in Validation. + */ + Expression?: string | undefined; +} + +/** + * WebhookClientConfig contains the information to make a TLS + * connection with the webhook + */ +export interface WebhookClientConfig { + /** + * url gives the location of the webhook, in standard URL form + * (`scheme://host:port/path`). Exactly one of `url` or `service` + * must be specified. + * + * The `host` should not refer to a service running in the cluster; use + * the `service` field instead. The host might be resolved via external + * DNS in some apiservers (e.g., `kube-apiserver` cannot resolve + * in-cluster DNS as that would be a layering violation). `host` may + * also be an IP address. + * + * Please note that using `localhost` or `127.0.0.1` as a `host` is + * risky unless you take great care to run this webhook on all hosts + * which run an apiserver which might need to make calls to this + * webhook. Such installs are likely to be non-portable, i.e., not easy + * to turn up in a new cluster. + * + * The scheme must be "https"; the URL must begin with "https://". + * + * A path is optional, and if present may be any string permissible in + * a URL. You may use the path to pass an arbitrary string to the + * webhook, for example, a cluster identifier. + * + * Attempting to use a user or basic auth e.g. "user:password@" is not + * allowed. Fragments ("#...") and query parameters ("?...") are not + * allowed, either. + * + * +optional + */ + url?: string | undefined; + /** + * service is a reference to the service for this webhook. Either + * `service` or `url` must be specified. + * + * If the webhook is running within the cluster, then you should use `service`. + * + * +optional + */ + service?: ServiceReference | undefined; + /** + * caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. + * If unspecified, system trust roots on the apiserver are used. + * +optional + */ + caBundle?: Uint8Array | undefined; +} + +function createBaseApplyConfiguration(): ApplyConfiguration { + return { expression: '' }; +} + +export const ApplyConfiguration: MessageFns = { + encode(message: ApplyConfiguration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.expression !== undefined && message.expression !== '') { + writer.uint32(10).string(message.expression); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ApplyConfiguration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApplyConfiguration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.expression = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ApplyConfiguration { + return { expression: isSet(object.expression) ? globalThis.String(object.expression) : '' }; + }, + + toJSON(message: ApplyConfiguration): unknown { + const obj: any = {}; + if (message.expression !== undefined && message.expression !== '') { + obj.expression = message.expression; + } + return obj; + }, + + create, I>>(base?: I): ApplyConfiguration { + return ApplyConfiguration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ApplyConfiguration { + const message = createBaseApplyConfiguration(); + message.expression = object.expression ?? ''; + return message; + }, +}; + +function createBaseAuditAnnotation(): AuditAnnotation { + return { key: '', valueExpression: '' }; +} + +export const AuditAnnotation: MessageFns = { + encode(message: AuditAnnotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined && message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.valueExpression !== undefined && message.valueExpression !== '') { + writer.uint32(18).string(message.valueExpression); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuditAnnotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuditAnnotation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.valueExpression = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AuditAnnotation { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + valueExpression: isSet(object.valueExpression) ? globalThis.String(object.valueExpression) : '', + }; + }, + + toJSON(message: AuditAnnotation): unknown { + const obj: any = {}; + if (message.key !== undefined && message.key !== '') { + obj.key = message.key; + } + if (message.valueExpression !== undefined && message.valueExpression !== '') { + obj.valueExpression = message.valueExpression; + } + return obj; + }, + + create, I>>(base?: I): AuditAnnotation { + return AuditAnnotation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuditAnnotation { + const message = createBaseAuditAnnotation(); + message.key = object.key ?? ''; + message.valueExpression = object.valueExpression ?? ''; + return message; + }, +}; + +function createBaseExpressionWarning(): ExpressionWarning { + return { fieldRef: '', warning: '' }; +} + +export const ExpressionWarning: MessageFns = { + encode(message: ExpressionWarning, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldRef !== undefined && message.fieldRef !== '') { + writer.uint32(18).string(message.fieldRef); + } + if (message.warning !== undefined && message.warning !== '') { + writer.uint32(26).string(message.warning); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExpressionWarning { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExpressionWarning(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + + message.fieldRef = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.warning = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ExpressionWarning { + return { + fieldRef: isSet(object.fieldRef) ? globalThis.String(object.fieldRef) : '', + warning: isSet(object.warning) ? globalThis.String(object.warning) : '', + }; + }, + + toJSON(message: ExpressionWarning): unknown { + const obj: any = {}; + if (message.fieldRef !== undefined && message.fieldRef !== '') { + obj.fieldRef = message.fieldRef; + } + if (message.warning !== undefined && message.warning !== '') { + obj.warning = message.warning; + } + return obj; + }, + + create, I>>(base?: I): ExpressionWarning { + return ExpressionWarning.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExpressionWarning { + const message = createBaseExpressionWarning(); + message.fieldRef = object.fieldRef ?? ''; + message.warning = object.warning ?? ''; + return message; + }, +}; + +function createBaseJSONPatch(): JSONPatch { + return { expression: '' }; +} + +export const JSONPatch: MessageFns = { + encode(message: JSONPatch, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.expression !== undefined && message.expression !== '') { + writer.uint32(10).string(message.expression); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): JSONPatch { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJSONPatch(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.expression = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): JSONPatch { + return { expression: isSet(object.expression) ? globalThis.String(object.expression) : '' }; + }, + + toJSON(message: JSONPatch): unknown { + const obj: any = {}; + if (message.expression !== undefined && message.expression !== '') { + obj.expression = message.expression; + } + return obj; + }, + + create, I>>(base?: I): JSONPatch { + return JSONPatch.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): JSONPatch { + const message = createBaseJSONPatch(); + message.expression = object.expression ?? ''; + return message; + }, +}; + +function createBaseMatchCondition(): MatchCondition { + return { name: '', expression: '' }; +} + +export const MatchCondition: MessageFns = { + encode(message: MatchCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.expression !== undefined && message.expression !== '') { + writer.uint32(18).string(message.expression); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MatchCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMatchCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.expression = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MatchCondition { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + expression: isSet(object.expression) ? globalThis.String(object.expression) : '', + }; + }, + + toJSON(message: MatchCondition): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.expression !== undefined && message.expression !== '') { + obj.expression = message.expression; + } + return obj; + }, + + create, I>>(base?: I): MatchCondition { + return MatchCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MatchCondition { + const message = createBaseMatchCondition(); + message.name = object.name ?? ''; + message.expression = object.expression ?? ''; + return message; + }, +}; + +function createBaseMatchResources(): MatchResources { + return { + namespaceSelector: undefined, + objectSelector: undefined, + resourceRules: [], + excludeResourceRules: [], + matchPolicy: '', + }; +} + +export const MatchResources: MessageFns = { + encode(message: MatchResources, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.namespaceSelector !== undefined) { + LabelSelector.encode(message.namespaceSelector, writer.uint32(10).fork()).join(); + } + if (message.objectSelector !== undefined) { + LabelSelector.encode(message.objectSelector, writer.uint32(18).fork()).join(); + } + for (const v of message.resourceRules) { + NamedRuleWithOperations.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.excludeResourceRules) { + NamedRuleWithOperations.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.matchPolicy !== undefined && message.matchPolicy !== '') { + writer.uint32(58).string(message.matchPolicy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MatchResources { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMatchResources(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.namespaceSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.objectSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.resourceRules.push(NamedRuleWithOperations.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.excludeResourceRules.push( + NamedRuleWithOperations.decode(reader, reader.uint32()), + ); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.matchPolicy = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MatchResources { + return { + namespaceSelector: isSet(object.namespaceSelector) + ? LabelSelector.fromJSON(object.namespaceSelector) + : undefined, + objectSelector: isSet(object.objectSelector) + ? LabelSelector.fromJSON(object.objectSelector) + : undefined, + resourceRules: globalThis.Array.isArray(object?.resourceRules) + ? object.resourceRules.map((e: any) => NamedRuleWithOperations.fromJSON(e)) + : [], + excludeResourceRules: globalThis.Array.isArray(object?.excludeResourceRules) + ? object.excludeResourceRules.map((e: any) => NamedRuleWithOperations.fromJSON(e)) + : [], + matchPolicy: isSet(object.matchPolicy) ? globalThis.String(object.matchPolicy) : '', + }; + }, + + toJSON(message: MatchResources): unknown { + const obj: any = {}; + if (message.namespaceSelector !== undefined) { + obj.namespaceSelector = LabelSelector.toJSON(message.namespaceSelector); + } + if (message.objectSelector !== undefined) { + obj.objectSelector = LabelSelector.toJSON(message.objectSelector); + } + if (message.resourceRules?.length) { + obj.resourceRules = message.resourceRules.map((e) => NamedRuleWithOperations.toJSON(e)); + } + if (message.excludeResourceRules?.length) { + obj.excludeResourceRules = message.excludeResourceRules.map((e) => + NamedRuleWithOperations.toJSON(e), + ); + } + if (message.matchPolicy !== undefined && message.matchPolicy !== '') { + obj.matchPolicy = message.matchPolicy; + } + return obj; + }, + + create, I>>(base?: I): MatchResources { + return MatchResources.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MatchResources { + const message = createBaseMatchResources(); + message.namespaceSelector = + object.namespaceSelector !== undefined && object.namespaceSelector !== null + ? LabelSelector.fromPartial(object.namespaceSelector) + : undefined; + message.objectSelector = + object.objectSelector !== undefined && object.objectSelector !== null + ? LabelSelector.fromPartial(object.objectSelector) + : undefined; + message.resourceRules = + object.resourceRules?.map((e) => NamedRuleWithOperations.fromPartial(e)) || []; + message.excludeResourceRules = + object.excludeResourceRules?.map((e) => NamedRuleWithOperations.fromPartial(e)) || []; + message.matchPolicy = object.matchPolicy ?? ''; + return message; + }, +}; + +function createBaseMutatingAdmissionPolicy(): MutatingAdmissionPolicy { + return { metadata: undefined, spec: undefined }; +} + +export const MutatingAdmissionPolicy: MessageFns = { + encode(message: MutatingAdmissionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + MutatingAdmissionPolicySpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MutatingAdmissionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMutatingAdmissionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = MutatingAdmissionPolicySpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MutatingAdmissionPolicy { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? MutatingAdmissionPolicySpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: MutatingAdmissionPolicy): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = MutatingAdmissionPolicySpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>(base?: I): MutatingAdmissionPolicy { + return MutatingAdmissionPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MutatingAdmissionPolicy { + const message = createBaseMutatingAdmissionPolicy(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? MutatingAdmissionPolicySpec.fromPartial(object.spec) + : undefined; + return message; + }, +}; + +function createBaseMutatingAdmissionPolicyBinding(): MutatingAdmissionPolicyBinding { + return { metadata: undefined, spec: undefined }; +} + +export const MutatingAdmissionPolicyBinding: MessageFns = { + encode(message: MutatingAdmissionPolicyBinding, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + MutatingAdmissionPolicyBindingSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MutatingAdmissionPolicyBinding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMutatingAdmissionPolicyBinding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = MutatingAdmissionPolicyBindingSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MutatingAdmissionPolicyBinding { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? MutatingAdmissionPolicyBindingSpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: MutatingAdmissionPolicyBinding): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = MutatingAdmissionPolicyBindingSpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>( + base?: I, + ): MutatingAdmissionPolicyBinding { + return MutatingAdmissionPolicyBinding.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MutatingAdmissionPolicyBinding { + const message = createBaseMutatingAdmissionPolicyBinding(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? MutatingAdmissionPolicyBindingSpec.fromPartial(object.spec) + : undefined; + return message; + }, +}; + +function createBaseMutatingAdmissionPolicyBindingList(): MutatingAdmissionPolicyBindingList { + return { metadata: undefined, items: [] }; +} + +export const MutatingAdmissionPolicyBindingList: MessageFns = { + encode( + message: MutatingAdmissionPolicyBindingList, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + MutatingAdmissionPolicyBinding.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MutatingAdmissionPolicyBindingList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMutatingAdmissionPolicyBindingList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(MutatingAdmissionPolicyBinding.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MutatingAdmissionPolicyBindingList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => MutatingAdmissionPolicyBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MutatingAdmissionPolicyBindingList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => MutatingAdmissionPolicyBinding.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MutatingAdmissionPolicyBindingList { + return MutatingAdmissionPolicyBindingList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MutatingAdmissionPolicyBindingList { + const message = createBaseMutatingAdmissionPolicyBindingList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => MutatingAdmissionPolicyBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMutatingAdmissionPolicyBindingSpec(): MutatingAdmissionPolicyBindingSpec { + return { policyName: '', paramRef: undefined, matchResources: undefined }; +} + +export const MutatingAdmissionPolicyBindingSpec: MessageFns = { + encode( + message: MutatingAdmissionPolicyBindingSpec, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.policyName !== undefined && message.policyName !== '') { + writer.uint32(10).string(message.policyName); + } + if (message.paramRef !== undefined) { + ParamRef.encode(message.paramRef, writer.uint32(18).fork()).join(); + } + if (message.matchResources !== undefined) { + MatchResources.encode(message.matchResources, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MutatingAdmissionPolicyBindingSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMutatingAdmissionPolicyBindingSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.policyName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.paramRef = ParamRef.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.matchResources = MatchResources.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MutatingAdmissionPolicyBindingSpec { + return { + policyName: isSet(object.policyName) ? globalThis.String(object.policyName) : '', + paramRef: isSet(object.paramRef) ? ParamRef.fromJSON(object.paramRef) : undefined, + matchResources: isSet(object.matchResources) + ? MatchResources.fromJSON(object.matchResources) + : undefined, + }; + }, + + toJSON(message: MutatingAdmissionPolicyBindingSpec): unknown { + const obj: any = {}; + if (message.policyName !== undefined && message.policyName !== '') { + obj.policyName = message.policyName; + } + if (message.paramRef !== undefined) { + obj.paramRef = ParamRef.toJSON(message.paramRef); + } + if (message.matchResources !== undefined) { + obj.matchResources = MatchResources.toJSON(message.matchResources); + } + return obj; + }, + + create, I>>( + base?: I, + ): MutatingAdmissionPolicyBindingSpec { + return MutatingAdmissionPolicyBindingSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MutatingAdmissionPolicyBindingSpec { + const message = createBaseMutatingAdmissionPolicyBindingSpec(); + message.policyName = object.policyName ?? ''; + message.paramRef = + object.paramRef !== undefined && object.paramRef !== null + ? ParamRef.fromPartial(object.paramRef) + : undefined; + message.matchResources = + object.matchResources !== undefined && object.matchResources !== null + ? MatchResources.fromPartial(object.matchResources) + : undefined; + return message; + }, +}; + +function createBaseMutatingAdmissionPolicyList(): MutatingAdmissionPolicyList { + return { metadata: undefined, items: [] }; +} + +export const MutatingAdmissionPolicyList: MessageFns = { + encode(message: MutatingAdmissionPolicyList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + MutatingAdmissionPolicy.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MutatingAdmissionPolicyList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMutatingAdmissionPolicyList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(MutatingAdmissionPolicy.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MutatingAdmissionPolicyList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => MutatingAdmissionPolicy.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MutatingAdmissionPolicyList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => MutatingAdmissionPolicy.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MutatingAdmissionPolicyList { + return MutatingAdmissionPolicyList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MutatingAdmissionPolicyList { + const message = createBaseMutatingAdmissionPolicyList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => MutatingAdmissionPolicy.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMutatingAdmissionPolicySpec(): MutatingAdmissionPolicySpec { + return { + paramKind: undefined, + matchConstraints: undefined, + variables: [], + mutations: [], + failurePolicy: '', + matchConditions: [], + reinvocationPolicy: '', + }; +} + +export const MutatingAdmissionPolicySpec: MessageFns = { + encode(message: MutatingAdmissionPolicySpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.paramKind !== undefined) { + ParamKind.encode(message.paramKind, writer.uint32(10).fork()).join(); + } + if (message.matchConstraints !== undefined) { + MatchResources.encode(message.matchConstraints, writer.uint32(18).fork()).join(); + } + for (const v of message.variables) { + Variable.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.mutations) { + Mutation.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.failurePolicy !== undefined && message.failurePolicy !== '') { + writer.uint32(42).string(message.failurePolicy); + } + for (const v of message.matchConditions) { + MatchCondition.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.reinvocationPolicy !== undefined && message.reinvocationPolicy !== '') { + writer.uint32(58).string(message.reinvocationPolicy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MutatingAdmissionPolicySpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMutatingAdmissionPolicySpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.paramKind = ParamKind.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.matchConstraints = MatchResources.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.variables.push(Variable.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.mutations.push(Mutation.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.failurePolicy = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.matchConditions.push(MatchCondition.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.reinvocationPolicy = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MutatingAdmissionPolicySpec { + return { + paramKind: isSet(object.paramKind) ? ParamKind.fromJSON(object.paramKind) : undefined, + matchConstraints: isSet(object.matchConstraints) + ? MatchResources.fromJSON(object.matchConstraints) + : undefined, + variables: globalThis.Array.isArray(object?.variables) + ? object.variables.map((e: any) => Variable.fromJSON(e)) + : [], + mutations: globalThis.Array.isArray(object?.mutations) + ? object.mutations.map((e: any) => Mutation.fromJSON(e)) + : [], + failurePolicy: isSet(object.failurePolicy) ? globalThis.String(object.failurePolicy) : '', + matchConditions: globalThis.Array.isArray(object?.matchConditions) + ? object.matchConditions.map((e: any) => MatchCondition.fromJSON(e)) + : [], + reinvocationPolicy: isSet(object.reinvocationPolicy) + ? globalThis.String(object.reinvocationPolicy) + : '', + }; + }, + + toJSON(message: MutatingAdmissionPolicySpec): unknown { + const obj: any = {}; + if (message.paramKind !== undefined) { + obj.paramKind = ParamKind.toJSON(message.paramKind); + } + if (message.matchConstraints !== undefined) { + obj.matchConstraints = MatchResources.toJSON(message.matchConstraints); + } + if (message.variables?.length) { + obj.variables = message.variables.map((e) => Variable.toJSON(e)); + } + if (message.mutations?.length) { + obj.mutations = message.mutations.map((e) => Mutation.toJSON(e)); + } + if (message.failurePolicy !== undefined && message.failurePolicy !== '') { + obj.failurePolicy = message.failurePolicy; + } + if (message.matchConditions?.length) { + obj.matchConditions = message.matchConditions.map((e) => MatchCondition.toJSON(e)); + } + if (message.reinvocationPolicy !== undefined && message.reinvocationPolicy !== '') { + obj.reinvocationPolicy = message.reinvocationPolicy; + } + return obj; + }, + + create, I>>( + base?: I, + ): MutatingAdmissionPolicySpec { + return MutatingAdmissionPolicySpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MutatingAdmissionPolicySpec { + const message = createBaseMutatingAdmissionPolicySpec(); + message.paramKind = + object.paramKind !== undefined && object.paramKind !== null + ? ParamKind.fromPartial(object.paramKind) + : undefined; + message.matchConstraints = + object.matchConstraints !== undefined && object.matchConstraints !== null + ? MatchResources.fromPartial(object.matchConstraints) + : undefined; + message.variables = object.variables?.map((e) => Variable.fromPartial(e)) || []; + message.mutations = object.mutations?.map((e) => Mutation.fromPartial(e)) || []; + message.failurePolicy = object.failurePolicy ?? ''; + message.matchConditions = object.matchConditions?.map((e) => MatchCondition.fromPartial(e)) || []; + message.reinvocationPolicy = object.reinvocationPolicy ?? ''; + return message; + }, +}; + +function createBaseMutatingWebhook(): MutatingWebhook { + return { + name: '', + clientConfig: undefined, + rules: [], + failurePolicy: '', + matchPolicy: '', + namespaceSelector: undefined, + objectSelector: undefined, + sideEffects: '', + timeoutSeconds: 0, + admissionReviewVersions: [], + reinvocationPolicy: '', + matchConditions: [], + }; +} + +export const MutatingWebhook: MessageFns = { + encode(message: MutatingWebhook, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.clientConfig !== undefined) { + WebhookClientConfig.encode(message.clientConfig, writer.uint32(18).fork()).join(); + } + for (const v of message.rules) { + RuleWithOperations.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.failurePolicy !== undefined && message.failurePolicy !== '') { + writer.uint32(34).string(message.failurePolicy); + } + if (message.matchPolicy !== undefined && message.matchPolicy !== '') { + writer.uint32(74).string(message.matchPolicy); + } + if (message.namespaceSelector !== undefined) { + LabelSelector.encode(message.namespaceSelector, writer.uint32(42).fork()).join(); + } + if (message.objectSelector !== undefined) { + LabelSelector.encode(message.objectSelector, writer.uint32(90).fork()).join(); + } + if (message.sideEffects !== undefined && message.sideEffects !== '') { + writer.uint32(50).string(message.sideEffects); + } + if (message.timeoutSeconds !== undefined && message.timeoutSeconds !== 0) { + writer.uint32(56).int32(message.timeoutSeconds); + } + for (const v of message.admissionReviewVersions) { + writer.uint32(66).string(v!); + } + if (message.reinvocationPolicy !== undefined && message.reinvocationPolicy !== '') { + writer.uint32(82).string(message.reinvocationPolicy); + } + for (const v of message.matchConditions) { + MatchCondition.encode(v!, writer.uint32(98).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MutatingWebhook { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMutatingWebhook(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.clientConfig = WebhookClientConfig.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.rules.push(RuleWithOperations.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.failurePolicy = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.matchPolicy = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.namespaceSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.objectSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.sideEffects = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.timeoutSeconds = reader.int32(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.admissionReviewVersions.push(reader.string()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.reinvocationPolicy = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.matchConditions.push(MatchCondition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MutatingWebhook { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + clientConfig: isSet(object.clientConfig) + ? WebhookClientConfig.fromJSON(object.clientConfig) + : undefined, + rules: globalThis.Array.isArray(object?.rules) + ? object.rules.map((e: any) => RuleWithOperations.fromJSON(e)) + : [], + failurePolicy: isSet(object.failurePolicy) ? globalThis.String(object.failurePolicy) : '', + matchPolicy: isSet(object.matchPolicy) ? globalThis.String(object.matchPolicy) : '', + namespaceSelector: isSet(object.namespaceSelector) + ? LabelSelector.fromJSON(object.namespaceSelector) + : undefined, + objectSelector: isSet(object.objectSelector) + ? LabelSelector.fromJSON(object.objectSelector) + : undefined, + sideEffects: isSet(object.sideEffects) ? globalThis.String(object.sideEffects) : '', + timeoutSeconds: isSet(object.timeoutSeconds) ? globalThis.Number(object.timeoutSeconds) : 0, + admissionReviewVersions: globalThis.Array.isArray(object?.admissionReviewVersions) + ? object.admissionReviewVersions.map((e: any) => globalThis.String(e)) + : [], + reinvocationPolicy: isSet(object.reinvocationPolicy) + ? globalThis.String(object.reinvocationPolicy) + : '', + matchConditions: globalThis.Array.isArray(object?.matchConditions) + ? object.matchConditions.map((e: any) => MatchCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MutatingWebhook): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.clientConfig !== undefined) { + obj.clientConfig = WebhookClientConfig.toJSON(message.clientConfig); + } + if (message.rules?.length) { + obj.rules = message.rules.map((e) => RuleWithOperations.toJSON(e)); + } + if (message.failurePolicy !== undefined && message.failurePolicy !== '') { + obj.failurePolicy = message.failurePolicy; + } + if (message.matchPolicy !== undefined && message.matchPolicy !== '') { + obj.matchPolicy = message.matchPolicy; + } + if (message.namespaceSelector !== undefined) { + obj.namespaceSelector = LabelSelector.toJSON(message.namespaceSelector); + } + if (message.objectSelector !== undefined) { + obj.objectSelector = LabelSelector.toJSON(message.objectSelector); + } + if (message.sideEffects !== undefined && message.sideEffects !== '') { + obj.sideEffects = message.sideEffects; + } + if (message.timeoutSeconds !== undefined && message.timeoutSeconds !== 0) { + obj.timeoutSeconds = Math.round(message.timeoutSeconds); + } + if (message.admissionReviewVersions?.length) { + obj.admissionReviewVersions = message.admissionReviewVersions; + } + if (message.reinvocationPolicy !== undefined && message.reinvocationPolicy !== '') { + obj.reinvocationPolicy = message.reinvocationPolicy; + } + if (message.matchConditions?.length) { + obj.matchConditions = message.matchConditions.map((e) => MatchCondition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MutatingWebhook { + return MutatingWebhook.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MutatingWebhook { + const message = createBaseMutatingWebhook(); + message.name = object.name ?? ''; + message.clientConfig = + object.clientConfig !== undefined && object.clientConfig !== null + ? WebhookClientConfig.fromPartial(object.clientConfig) + : undefined; + message.rules = object.rules?.map((e) => RuleWithOperations.fromPartial(e)) || []; + message.failurePolicy = object.failurePolicy ?? ''; + message.matchPolicy = object.matchPolicy ?? ''; + message.namespaceSelector = + object.namespaceSelector !== undefined && object.namespaceSelector !== null + ? LabelSelector.fromPartial(object.namespaceSelector) + : undefined; + message.objectSelector = + object.objectSelector !== undefined && object.objectSelector !== null + ? LabelSelector.fromPartial(object.objectSelector) + : undefined; + message.sideEffects = object.sideEffects ?? ''; + message.timeoutSeconds = object.timeoutSeconds ?? 0; + message.admissionReviewVersions = object.admissionReviewVersions?.map((e) => e) || []; + message.reinvocationPolicy = object.reinvocationPolicy ?? ''; + message.matchConditions = object.matchConditions?.map((e) => MatchCondition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMutatingWebhookConfiguration(): MutatingWebhookConfiguration { + return { metadata: undefined, Webhooks: [] }; +} + +export const MutatingWebhookConfiguration: MessageFns = { + encode(message: MutatingWebhookConfiguration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.Webhooks) { + MutatingWebhook.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MutatingWebhookConfiguration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMutatingWebhookConfiguration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.Webhooks.push(MutatingWebhook.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MutatingWebhookConfiguration { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + Webhooks: globalThis.Array.isArray(object?.Webhooks) + ? object.Webhooks.map((e: any) => MutatingWebhook.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MutatingWebhookConfiguration): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.Webhooks?.length) { + obj.Webhooks = message.Webhooks.map((e) => MutatingWebhook.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MutatingWebhookConfiguration { + return MutatingWebhookConfiguration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MutatingWebhookConfiguration { + const message = createBaseMutatingWebhookConfiguration(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.Webhooks = object.Webhooks?.map((e) => MutatingWebhook.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMutatingWebhookConfigurationList(): MutatingWebhookConfigurationList { + return { metadata: undefined, items: [] }; +} + +export const MutatingWebhookConfigurationList: MessageFns = { + encode( + message: MutatingWebhookConfigurationList, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + MutatingWebhookConfiguration.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MutatingWebhookConfigurationList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMutatingWebhookConfigurationList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(MutatingWebhookConfiguration.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MutatingWebhookConfigurationList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => MutatingWebhookConfiguration.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MutatingWebhookConfigurationList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => MutatingWebhookConfiguration.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): MutatingWebhookConfigurationList { + return MutatingWebhookConfigurationList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MutatingWebhookConfigurationList { + const message = createBaseMutatingWebhookConfigurationList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => MutatingWebhookConfiguration.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMutation(): Mutation { + return { patchType: '', applyConfiguration: undefined, jsonPatch: undefined }; +} + +export const Mutation: MessageFns = { + encode(message: Mutation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.patchType !== undefined && message.patchType !== '') { + writer.uint32(18).string(message.patchType); + } + if (message.applyConfiguration !== undefined) { + ApplyConfiguration.encode(message.applyConfiguration, writer.uint32(26).fork()).join(); + } + if (message.jsonPatch !== undefined) { + JSONPatch.encode(message.jsonPatch, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Mutation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMutation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + + message.patchType = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.applyConfiguration = ApplyConfiguration.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.jsonPatch = JSONPatch.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Mutation { + return { + patchType: isSet(object.patchType) ? globalThis.String(object.patchType) : '', + applyConfiguration: isSet(object.applyConfiguration) + ? ApplyConfiguration.fromJSON(object.applyConfiguration) + : undefined, + jsonPatch: isSet(object.jsonPatch) ? JSONPatch.fromJSON(object.jsonPatch) : undefined, + }; + }, + + toJSON(message: Mutation): unknown { + const obj: any = {}; + if (message.patchType !== undefined && message.patchType !== '') { + obj.patchType = message.patchType; + } + if (message.applyConfiguration !== undefined) { + obj.applyConfiguration = ApplyConfiguration.toJSON(message.applyConfiguration); + } + if (message.jsonPatch !== undefined) { + obj.jsonPatch = JSONPatch.toJSON(message.jsonPatch); + } + return obj; + }, + + create, I>>(base?: I): Mutation { + return Mutation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Mutation { + const message = createBaseMutation(); + message.patchType = object.patchType ?? ''; + message.applyConfiguration = + object.applyConfiguration !== undefined && object.applyConfiguration !== null + ? ApplyConfiguration.fromPartial(object.applyConfiguration) + : undefined; + message.jsonPatch = + object.jsonPatch !== undefined && object.jsonPatch !== null + ? JSONPatch.fromPartial(object.jsonPatch) + : undefined; + return message; + }, +}; + +function createBaseNamedRuleWithOperations(): NamedRuleWithOperations { + return { resourceNames: [], ruleWithOperations: undefined }; +} + +export const NamedRuleWithOperations: MessageFns = { + encode(message: NamedRuleWithOperations, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.resourceNames) { + writer.uint32(10).string(v!); + } + if (message.ruleWithOperations !== undefined) { + RuleWithOperations.encode(message.ruleWithOperations, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NamedRuleWithOperations { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNamedRuleWithOperations(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resourceNames.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.ruleWithOperations = RuleWithOperations.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NamedRuleWithOperations { + return { + resourceNames: globalThis.Array.isArray(object?.resourceNames) + ? object.resourceNames.map((e: any) => globalThis.String(e)) + : [], + ruleWithOperations: isSet(object.ruleWithOperations) + ? RuleWithOperations.fromJSON(object.ruleWithOperations) + : undefined, + }; + }, + + toJSON(message: NamedRuleWithOperations): unknown { + const obj: any = {}; + if (message.resourceNames?.length) { + obj.resourceNames = message.resourceNames; + } + if (message.ruleWithOperations !== undefined) { + obj.ruleWithOperations = RuleWithOperations.toJSON(message.ruleWithOperations); + } + return obj; + }, + + create, I>>(base?: I): NamedRuleWithOperations { + return NamedRuleWithOperations.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NamedRuleWithOperations { + const message = createBaseNamedRuleWithOperations(); + message.resourceNames = object.resourceNames?.map((e) => e) || []; + message.ruleWithOperations = + object.ruleWithOperations !== undefined && object.ruleWithOperations !== null + ? RuleWithOperations.fromPartial(object.ruleWithOperations) + : undefined; + return message; + }, +}; + +function createBaseParamKind(): ParamKind { + return { apiVersion: '', kind: '' }; +} + +export const ParamKind: MessageFns = { + encode(message: ParamKind, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.apiVersion !== undefined && message.apiVersion !== '') { + writer.uint32(10).string(message.apiVersion); + } + if (message.kind !== undefined && message.kind !== '') { + writer.uint32(18).string(message.kind); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParamKind { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParamKind(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.apiVersion = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.kind = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ParamKind { + return { + apiVersion: isSet(object.apiVersion) ? globalThis.String(object.apiVersion) : '', + kind: isSet(object.kind) ? globalThis.String(object.kind) : '', + }; + }, + + toJSON(message: ParamKind): unknown { + const obj: any = {}; + if (message.apiVersion !== undefined && message.apiVersion !== '') { + obj.apiVersion = message.apiVersion; + } + if (message.kind !== undefined && message.kind !== '') { + obj.kind = message.kind; + } + return obj; + }, + + create, I>>(base?: I): ParamKind { + return ParamKind.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ParamKind { + const message = createBaseParamKind(); + message.apiVersion = object.apiVersion ?? ''; + message.kind = object.kind ?? ''; + return message; + }, +}; + +function createBaseParamRef(): ParamRef { + return { name: '', namespace: '', selector: undefined, parameterNotFoundAction: '' }; +} + +export const ParamRef: MessageFns = { + encode(message: ParamRef, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(18).string(message.namespace); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(26).fork()).join(); + } + if (message.parameterNotFoundAction !== undefined && message.parameterNotFoundAction !== '') { + writer.uint32(34).string(message.parameterNotFoundAction); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParamRef { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParamRef(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.namespace = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.parameterNotFoundAction = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ParamRef { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + parameterNotFoundAction: isSet(object.parameterNotFoundAction) + ? globalThis.String(object.parameterNotFoundAction) + : '', + }; + }, + + toJSON(message: ParamRef): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.parameterNotFoundAction !== undefined && message.parameterNotFoundAction !== '') { + obj.parameterNotFoundAction = message.parameterNotFoundAction; + } + return obj; + }, + + create, I>>(base?: I): ParamRef { + return ParamRef.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ParamRef { + const message = createBaseParamRef(); + message.name = object.name ?? ''; + message.namespace = object.namespace ?? ''; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.parameterNotFoundAction = object.parameterNotFoundAction ?? ''; + return message; + }, +}; + +function createBaseRule(): Rule { + return { apiGroups: [], apiVersions: [], resources: [], scope: '' }; +} + +export const Rule: MessageFns = { + encode(message: Rule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.apiGroups) { + writer.uint32(10).string(v!); + } + for (const v of message.apiVersions) { + writer.uint32(18).string(v!); + } + for (const v of message.resources) { + writer.uint32(26).string(v!); + } + if (message.scope !== undefined && message.scope !== '') { + writer.uint32(34).string(message.scope); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Rule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.apiGroups.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.apiVersions.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.resources.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.scope = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Rule { + return { + apiGroups: globalThis.Array.isArray(object?.apiGroups) + ? object.apiGroups.map((e: any) => globalThis.String(e)) + : [], + apiVersions: globalThis.Array.isArray(object?.apiVersions) + ? object.apiVersions.map((e: any) => globalThis.String(e)) + : [], + resources: globalThis.Array.isArray(object?.resources) + ? object.resources.map((e: any) => globalThis.String(e)) + : [], + scope: isSet(object.scope) ? globalThis.String(object.scope) : '', + }; + }, + + toJSON(message: Rule): unknown { + const obj: any = {}; + if (message.apiGroups?.length) { + obj.apiGroups = message.apiGroups; + } + if (message.apiVersions?.length) { + obj.apiVersions = message.apiVersions; + } + if (message.resources?.length) { + obj.resources = message.resources; + } + if (message.scope !== undefined && message.scope !== '') { + obj.scope = message.scope; + } + return obj; + }, + + create, I>>(base?: I): Rule { + return Rule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Rule { + const message = createBaseRule(); + message.apiGroups = object.apiGroups?.map((e) => e) || []; + message.apiVersions = object.apiVersions?.map((e) => e) || []; + message.resources = object.resources?.map((e) => e) || []; + message.scope = object.scope ?? ''; + return message; + }, +}; + +function createBaseRuleWithOperations(): RuleWithOperations { + return { operations: [], rule: undefined }; +} + +export const RuleWithOperations: MessageFns = { + encode(message: RuleWithOperations, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.operations) { + writer.uint32(10).string(v!); + } + if (message.rule !== undefined) { + Rule.encode(message.rule, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RuleWithOperations { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRuleWithOperations(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.operations.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.rule = Rule.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RuleWithOperations { + return { + operations: globalThis.Array.isArray(object?.operations) + ? object.operations.map((e: any) => globalThis.String(e)) + : [], + rule: isSet(object.rule) ? Rule.fromJSON(object.rule) : undefined, + }; + }, + + toJSON(message: RuleWithOperations): unknown { + const obj: any = {}; + if (message.operations?.length) { + obj.operations = message.operations; + } + if (message.rule !== undefined) { + obj.rule = Rule.toJSON(message.rule); + } + return obj; + }, + + create, I>>(base?: I): RuleWithOperations { + return RuleWithOperations.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RuleWithOperations { + const message = createBaseRuleWithOperations(); + message.operations = object.operations?.map((e) => e) || []; + message.rule = + object.rule !== undefined && object.rule !== null ? Rule.fromPartial(object.rule) : undefined; + return message; + }, +}; + +function createBaseServiceReference(): ServiceReference { + return { namespace: '', name: '', path: '', port: 0 }; +} + +export const ServiceReference: MessageFns = { + encode(message: ServiceReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(10).string(message.namespace); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(18).string(message.name); + } + if (message.path !== undefined && message.path !== '') { + writer.uint32(26).string(message.path); + } + if (message.port !== undefined && message.port !== 0) { + writer.uint32(32).int32(message.port); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.namespace = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.path = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.port = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceReference { + return { + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + path: isSet(object.path) ? globalThis.String(object.path) : '', + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + }; + }, + + toJSON(message: ServiceReference): unknown { + const obj: any = {}; + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.port !== undefined && message.port !== 0) { + obj.port = Math.round(message.port); + } + return obj; + }, + + create, I>>(base?: I): ServiceReference { + return ServiceReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceReference { + const message = createBaseServiceReference(); + message.namespace = object.namespace ?? ''; + message.name = object.name ?? ''; + message.path = object.path ?? ''; + message.port = object.port ?? 0; + return message; + }, +}; + +function createBaseTypeChecking(): TypeChecking { + return { expressionWarnings: [] }; +} + +export const TypeChecking: MessageFns = { + encode(message: TypeChecking, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.expressionWarnings) { + ExpressionWarning.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TypeChecking { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTypeChecking(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.expressionWarnings.push(ExpressionWarning.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TypeChecking { + return { + expressionWarnings: globalThis.Array.isArray(object?.expressionWarnings) + ? object.expressionWarnings.map((e: any) => ExpressionWarning.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TypeChecking): unknown { + const obj: any = {}; + if (message.expressionWarnings?.length) { + obj.expressionWarnings = message.expressionWarnings.map((e) => ExpressionWarning.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TypeChecking { + return TypeChecking.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TypeChecking { + const message = createBaseTypeChecking(); + message.expressionWarnings = + object.expressionWarnings?.map((e) => ExpressionWarning.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatingAdmissionPolicy(): ValidatingAdmissionPolicy { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const ValidatingAdmissionPolicy: MessageFns = { + encode(message: ValidatingAdmissionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + ValidatingAdmissionPolicySpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + ValidatingAdmissionPolicyStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatingAdmissionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatingAdmissionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = ValidatingAdmissionPolicySpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = ValidatingAdmissionPolicyStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ValidatingAdmissionPolicy { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? ValidatingAdmissionPolicySpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) + ? ValidatingAdmissionPolicyStatus.fromJSON(object.status) + : undefined, + }; + }, + + toJSON(message: ValidatingAdmissionPolicy): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = ValidatingAdmissionPolicySpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = ValidatingAdmissionPolicyStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ValidatingAdmissionPolicy { + return ValidatingAdmissionPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatingAdmissionPolicy { + const message = createBaseValidatingAdmissionPolicy(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? ValidatingAdmissionPolicySpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? ValidatingAdmissionPolicyStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseValidatingAdmissionPolicyBinding(): ValidatingAdmissionPolicyBinding { + return { metadata: undefined, spec: undefined }; +} + +export const ValidatingAdmissionPolicyBinding: MessageFns = { + encode( + message: ValidatingAdmissionPolicyBinding, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + ValidatingAdmissionPolicyBindingSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatingAdmissionPolicyBinding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatingAdmissionPolicyBinding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = ValidatingAdmissionPolicyBindingSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ValidatingAdmissionPolicyBinding { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? ValidatingAdmissionPolicyBindingSpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: ValidatingAdmissionPolicyBinding): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = ValidatingAdmissionPolicyBindingSpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatingAdmissionPolicyBinding { + return ValidatingAdmissionPolicyBinding.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatingAdmissionPolicyBinding { + const message = createBaseValidatingAdmissionPolicyBinding(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? ValidatingAdmissionPolicyBindingSpec.fromPartial(object.spec) + : undefined; + return message; + }, +}; + +function createBaseValidatingAdmissionPolicyBindingList(): ValidatingAdmissionPolicyBindingList { + return { metadata: undefined, items: [] }; +} + +export const ValidatingAdmissionPolicyBindingList: MessageFns = { + encode( + message: ValidatingAdmissionPolicyBindingList, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ValidatingAdmissionPolicyBinding.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatingAdmissionPolicyBindingList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatingAdmissionPolicyBindingList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ValidatingAdmissionPolicyBinding.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ValidatingAdmissionPolicyBindingList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ValidatingAdmissionPolicyBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatingAdmissionPolicyBindingList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ValidatingAdmissionPolicyBinding.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatingAdmissionPolicyBindingList { + return ValidatingAdmissionPolicyBindingList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatingAdmissionPolicyBindingList { + const message = createBaseValidatingAdmissionPolicyBindingList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ValidatingAdmissionPolicyBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatingAdmissionPolicyBindingSpec(): ValidatingAdmissionPolicyBindingSpec { + return { policyName: '', paramRef: undefined, matchResources: undefined, validationActions: [] }; +} + +export const ValidatingAdmissionPolicyBindingSpec: MessageFns = { + encode( + message: ValidatingAdmissionPolicyBindingSpec, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.policyName !== undefined && message.policyName !== '') { + writer.uint32(10).string(message.policyName); + } + if (message.paramRef !== undefined) { + ParamRef.encode(message.paramRef, writer.uint32(18).fork()).join(); + } + if (message.matchResources !== undefined) { + MatchResources.encode(message.matchResources, writer.uint32(26).fork()).join(); + } + for (const v of message.validationActions) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatingAdmissionPolicyBindingSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatingAdmissionPolicyBindingSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.policyName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.paramRef = ParamRef.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.matchResources = MatchResources.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.validationActions.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ValidatingAdmissionPolicyBindingSpec { + return { + policyName: isSet(object.policyName) ? globalThis.String(object.policyName) : '', + paramRef: isSet(object.paramRef) ? ParamRef.fromJSON(object.paramRef) : undefined, + matchResources: isSet(object.matchResources) + ? MatchResources.fromJSON(object.matchResources) + : undefined, + validationActions: globalThis.Array.isArray(object?.validationActions) + ? object.validationActions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ValidatingAdmissionPolicyBindingSpec): unknown { + const obj: any = {}; + if (message.policyName !== undefined && message.policyName !== '') { + obj.policyName = message.policyName; + } + if (message.paramRef !== undefined) { + obj.paramRef = ParamRef.toJSON(message.paramRef); + } + if (message.matchResources !== undefined) { + obj.matchResources = MatchResources.toJSON(message.matchResources); + } + if (message.validationActions?.length) { + obj.validationActions = message.validationActions; + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatingAdmissionPolicyBindingSpec { + return ValidatingAdmissionPolicyBindingSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatingAdmissionPolicyBindingSpec { + const message = createBaseValidatingAdmissionPolicyBindingSpec(); + message.policyName = object.policyName ?? ''; + message.paramRef = + object.paramRef !== undefined && object.paramRef !== null + ? ParamRef.fromPartial(object.paramRef) + : undefined; + message.matchResources = + object.matchResources !== undefined && object.matchResources !== null + ? MatchResources.fromPartial(object.matchResources) + : undefined; + message.validationActions = object.validationActions?.map((e) => e) || []; + return message; + }, +}; + +function createBaseValidatingAdmissionPolicyList(): ValidatingAdmissionPolicyList { + return { metadata: undefined, items: [] }; +} + +export const ValidatingAdmissionPolicyList: MessageFns = { + encode(message: ValidatingAdmissionPolicyList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ValidatingAdmissionPolicy.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatingAdmissionPolicyList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatingAdmissionPolicyList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ValidatingAdmissionPolicy.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ValidatingAdmissionPolicyList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ValidatingAdmissionPolicy.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatingAdmissionPolicyList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ValidatingAdmissionPolicy.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatingAdmissionPolicyList { + return ValidatingAdmissionPolicyList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatingAdmissionPolicyList { + const message = createBaseValidatingAdmissionPolicyList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ValidatingAdmissionPolicy.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatingAdmissionPolicySpec(): ValidatingAdmissionPolicySpec { + return { + paramKind: undefined, + matchConstraints: undefined, + validations: [], + failurePolicy: '', + auditAnnotations: [], + matchConditions: [], + variables: [], + }; +} + +export const ValidatingAdmissionPolicySpec: MessageFns = { + encode(message: ValidatingAdmissionPolicySpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.paramKind !== undefined) { + ParamKind.encode(message.paramKind, writer.uint32(10).fork()).join(); + } + if (message.matchConstraints !== undefined) { + MatchResources.encode(message.matchConstraints, writer.uint32(18).fork()).join(); + } + for (const v of message.validations) { + Validation.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.failurePolicy !== undefined && message.failurePolicy !== '') { + writer.uint32(34).string(message.failurePolicy); + } + for (const v of message.auditAnnotations) { + AuditAnnotation.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.matchConditions) { + MatchCondition.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.variables) { + Variable.encode(v!, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatingAdmissionPolicySpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatingAdmissionPolicySpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.paramKind = ParamKind.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.matchConstraints = MatchResources.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.validations.push(Validation.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.failurePolicy = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.auditAnnotations.push(AuditAnnotation.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.matchConditions.push(MatchCondition.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.variables.push(Variable.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ValidatingAdmissionPolicySpec { + return { + paramKind: isSet(object.paramKind) ? ParamKind.fromJSON(object.paramKind) : undefined, + matchConstraints: isSet(object.matchConstraints) + ? MatchResources.fromJSON(object.matchConstraints) + : undefined, + validations: globalThis.Array.isArray(object?.validations) + ? object.validations.map((e: any) => Validation.fromJSON(e)) + : [], + failurePolicy: isSet(object.failurePolicy) ? globalThis.String(object.failurePolicy) : '', + auditAnnotations: globalThis.Array.isArray(object?.auditAnnotations) + ? object.auditAnnotations.map((e: any) => AuditAnnotation.fromJSON(e)) + : [], + matchConditions: globalThis.Array.isArray(object?.matchConditions) + ? object.matchConditions.map((e: any) => MatchCondition.fromJSON(e)) + : [], + variables: globalThis.Array.isArray(object?.variables) + ? object.variables.map((e: any) => Variable.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatingAdmissionPolicySpec): unknown { + const obj: any = {}; + if (message.paramKind !== undefined) { + obj.paramKind = ParamKind.toJSON(message.paramKind); + } + if (message.matchConstraints !== undefined) { + obj.matchConstraints = MatchResources.toJSON(message.matchConstraints); + } + if (message.validations?.length) { + obj.validations = message.validations.map((e) => Validation.toJSON(e)); + } + if (message.failurePolicy !== undefined && message.failurePolicy !== '') { + obj.failurePolicy = message.failurePolicy; + } + if (message.auditAnnotations?.length) { + obj.auditAnnotations = message.auditAnnotations.map((e) => AuditAnnotation.toJSON(e)); + } + if (message.matchConditions?.length) { + obj.matchConditions = message.matchConditions.map((e) => MatchCondition.toJSON(e)); + } + if (message.variables?.length) { + obj.variables = message.variables.map((e) => Variable.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatingAdmissionPolicySpec { + return ValidatingAdmissionPolicySpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatingAdmissionPolicySpec { + const message = createBaseValidatingAdmissionPolicySpec(); + message.paramKind = + object.paramKind !== undefined && object.paramKind !== null + ? ParamKind.fromPartial(object.paramKind) + : undefined; + message.matchConstraints = + object.matchConstraints !== undefined && object.matchConstraints !== null + ? MatchResources.fromPartial(object.matchConstraints) + : undefined; + message.validations = object.validations?.map((e) => Validation.fromPartial(e)) || []; + message.failurePolicy = object.failurePolicy ?? ''; + message.auditAnnotations = object.auditAnnotations?.map((e) => AuditAnnotation.fromPartial(e)) || []; + message.matchConditions = object.matchConditions?.map((e) => MatchCondition.fromPartial(e)) || []; + message.variables = object.variables?.map((e) => Variable.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatingAdmissionPolicyStatus(): ValidatingAdmissionPolicyStatus { + return { observedGeneration: 0, typeChecking: undefined, conditions: [] }; +} + +export const ValidatingAdmissionPolicyStatus: MessageFns = { + encode( + message: ValidatingAdmissionPolicyStatus, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(8).int64(message.observedGeneration); + } + if (message.typeChecking !== undefined) { + TypeChecking.encode(message.typeChecking, writer.uint32(18).fork()).join(); + } + for (const v of message.conditions) { + Condition.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatingAdmissionPolicyStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatingAdmissionPolicyStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.typeChecking = TypeChecking.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.conditions.push(Condition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ValidatingAdmissionPolicyStatus { + return { + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + typeChecking: isSet(object.typeChecking) ? TypeChecking.fromJSON(object.typeChecking) : undefined, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => Condition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatingAdmissionPolicyStatus): unknown { + const obj: any = {}; + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.typeChecking !== undefined) { + obj.typeChecking = TypeChecking.toJSON(message.typeChecking); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => Condition.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatingAdmissionPolicyStatus { + return ValidatingAdmissionPolicyStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatingAdmissionPolicyStatus { + const message = createBaseValidatingAdmissionPolicyStatus(); + message.observedGeneration = object.observedGeneration ?? 0; + message.typeChecking = + object.typeChecking !== undefined && object.typeChecking !== null + ? TypeChecking.fromPartial(object.typeChecking) + : undefined; + message.conditions = object.conditions?.map((e) => Condition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatingWebhook(): ValidatingWebhook { + return { + name: '', + clientConfig: undefined, + rules: [], + failurePolicy: '', + matchPolicy: '', + namespaceSelector: undefined, + objectSelector: undefined, + sideEffects: '', + timeoutSeconds: 0, + admissionReviewVersions: [], + matchConditions: [], + }; +} + +export const ValidatingWebhook: MessageFns = { + encode(message: ValidatingWebhook, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.clientConfig !== undefined) { + WebhookClientConfig.encode(message.clientConfig, writer.uint32(18).fork()).join(); + } + for (const v of message.rules) { + RuleWithOperations.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.failurePolicy !== undefined && message.failurePolicy !== '') { + writer.uint32(34).string(message.failurePolicy); + } + if (message.matchPolicy !== undefined && message.matchPolicy !== '') { + writer.uint32(74).string(message.matchPolicy); + } + if (message.namespaceSelector !== undefined) { + LabelSelector.encode(message.namespaceSelector, writer.uint32(42).fork()).join(); + } + if (message.objectSelector !== undefined) { + LabelSelector.encode(message.objectSelector, writer.uint32(82).fork()).join(); + } + if (message.sideEffects !== undefined && message.sideEffects !== '') { + writer.uint32(50).string(message.sideEffects); + } + if (message.timeoutSeconds !== undefined && message.timeoutSeconds !== 0) { + writer.uint32(56).int32(message.timeoutSeconds); + } + for (const v of message.admissionReviewVersions) { + writer.uint32(66).string(v!); + } + for (const v of message.matchConditions) { + MatchCondition.encode(v!, writer.uint32(90).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatingWebhook { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatingWebhook(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.clientConfig = WebhookClientConfig.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.rules.push(RuleWithOperations.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.failurePolicy = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.matchPolicy = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.namespaceSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.objectSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.sideEffects = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.timeoutSeconds = reader.int32(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.admissionReviewVersions.push(reader.string()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.matchConditions.push(MatchCondition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ValidatingWebhook { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + clientConfig: isSet(object.clientConfig) + ? WebhookClientConfig.fromJSON(object.clientConfig) + : undefined, + rules: globalThis.Array.isArray(object?.rules) + ? object.rules.map((e: any) => RuleWithOperations.fromJSON(e)) + : [], + failurePolicy: isSet(object.failurePolicy) ? globalThis.String(object.failurePolicy) : '', + matchPolicy: isSet(object.matchPolicy) ? globalThis.String(object.matchPolicy) : '', + namespaceSelector: isSet(object.namespaceSelector) + ? LabelSelector.fromJSON(object.namespaceSelector) + : undefined, + objectSelector: isSet(object.objectSelector) + ? LabelSelector.fromJSON(object.objectSelector) + : undefined, + sideEffects: isSet(object.sideEffects) ? globalThis.String(object.sideEffects) : '', + timeoutSeconds: isSet(object.timeoutSeconds) ? globalThis.Number(object.timeoutSeconds) : 0, + admissionReviewVersions: globalThis.Array.isArray(object?.admissionReviewVersions) + ? object.admissionReviewVersions.map((e: any) => globalThis.String(e)) + : [], + matchConditions: globalThis.Array.isArray(object?.matchConditions) + ? object.matchConditions.map((e: any) => MatchCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatingWebhook): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.clientConfig !== undefined) { + obj.clientConfig = WebhookClientConfig.toJSON(message.clientConfig); + } + if (message.rules?.length) { + obj.rules = message.rules.map((e) => RuleWithOperations.toJSON(e)); + } + if (message.failurePolicy !== undefined && message.failurePolicy !== '') { + obj.failurePolicy = message.failurePolicy; + } + if (message.matchPolicy !== undefined && message.matchPolicy !== '') { + obj.matchPolicy = message.matchPolicy; + } + if (message.namespaceSelector !== undefined) { + obj.namespaceSelector = LabelSelector.toJSON(message.namespaceSelector); + } + if (message.objectSelector !== undefined) { + obj.objectSelector = LabelSelector.toJSON(message.objectSelector); + } + if (message.sideEffects !== undefined && message.sideEffects !== '') { + obj.sideEffects = message.sideEffects; + } + if (message.timeoutSeconds !== undefined && message.timeoutSeconds !== 0) { + obj.timeoutSeconds = Math.round(message.timeoutSeconds); + } + if (message.admissionReviewVersions?.length) { + obj.admissionReviewVersions = message.admissionReviewVersions; + } + if (message.matchConditions?.length) { + obj.matchConditions = message.matchConditions.map((e) => MatchCondition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatingWebhook { + return ValidatingWebhook.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatingWebhook { + const message = createBaseValidatingWebhook(); + message.name = object.name ?? ''; + message.clientConfig = + object.clientConfig !== undefined && object.clientConfig !== null + ? WebhookClientConfig.fromPartial(object.clientConfig) + : undefined; + message.rules = object.rules?.map((e) => RuleWithOperations.fromPartial(e)) || []; + message.failurePolicy = object.failurePolicy ?? ''; + message.matchPolicy = object.matchPolicy ?? ''; + message.namespaceSelector = + object.namespaceSelector !== undefined && object.namespaceSelector !== null + ? LabelSelector.fromPartial(object.namespaceSelector) + : undefined; + message.objectSelector = + object.objectSelector !== undefined && object.objectSelector !== null + ? LabelSelector.fromPartial(object.objectSelector) + : undefined; + message.sideEffects = object.sideEffects ?? ''; + message.timeoutSeconds = object.timeoutSeconds ?? 0; + message.admissionReviewVersions = object.admissionReviewVersions?.map((e) => e) || []; + message.matchConditions = object.matchConditions?.map((e) => MatchCondition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatingWebhookConfiguration(): ValidatingWebhookConfiguration { + return { metadata: undefined, Webhooks: [] }; +} + +export const ValidatingWebhookConfiguration: MessageFns = { + encode(message: ValidatingWebhookConfiguration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.Webhooks) { + ValidatingWebhook.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatingWebhookConfiguration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatingWebhookConfiguration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.Webhooks.push(ValidatingWebhook.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ValidatingWebhookConfiguration { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + Webhooks: globalThis.Array.isArray(object?.Webhooks) + ? object.Webhooks.map((e: any) => ValidatingWebhook.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatingWebhookConfiguration): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.Webhooks?.length) { + obj.Webhooks = message.Webhooks.map((e) => ValidatingWebhook.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatingWebhookConfiguration { + return ValidatingWebhookConfiguration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatingWebhookConfiguration { + const message = createBaseValidatingWebhookConfiguration(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.Webhooks = object.Webhooks?.map((e) => ValidatingWebhook.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidatingWebhookConfigurationList(): ValidatingWebhookConfigurationList { + return { metadata: undefined, items: [] }; +} + +export const ValidatingWebhookConfigurationList: MessageFns = { + encode( + message: ValidatingWebhookConfigurationList, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ValidatingWebhookConfiguration.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatingWebhookConfigurationList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatingWebhookConfigurationList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ValidatingWebhookConfiguration.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ValidatingWebhookConfigurationList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ValidatingWebhookConfiguration.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatingWebhookConfigurationList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ValidatingWebhookConfiguration.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ValidatingWebhookConfigurationList { + return ValidatingWebhookConfigurationList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ValidatingWebhookConfigurationList { + const message = createBaseValidatingWebhookConfigurationList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ValidatingWebhookConfiguration.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseValidation(): Validation { + return { Expression: '', message: '', reason: '', messageExpression: '' }; +} + +export const Validation: MessageFns = { + encode(message: Validation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.Expression !== undefined && message.Expression !== '') { + writer.uint32(10).string(message.Expression); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(18).string(message.message); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(26).string(message.reason); + } + if (message.messageExpression !== undefined && message.messageExpression !== '') { + writer.uint32(34).string(message.messageExpression); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.Expression = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.reason = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.messageExpression = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Validation { + return { + Expression: isSet(object.Expression) ? globalThis.String(object.Expression) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + messageExpression: isSet(object.messageExpression) + ? globalThis.String(object.messageExpression) + : '', + }; + }, + + toJSON(message: Validation): unknown { + const obj: any = {}; + if (message.Expression !== undefined && message.Expression !== '') { + obj.Expression = message.Expression; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.messageExpression !== undefined && message.messageExpression !== '') { + obj.messageExpression = message.messageExpression; + } + return obj; + }, + + create, I>>(base?: I): Validation { + return Validation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validation { + const message = createBaseValidation(); + message.Expression = object.Expression ?? ''; + message.message = object.message ?? ''; + message.reason = object.reason ?? ''; + message.messageExpression = object.messageExpression ?? ''; + return message; + }, +}; + +function createBaseVariable(): Variable { + return { Name: '', Expression: '' }; +} + +export const Variable: MessageFns = { + encode(message: Variable, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.Name !== undefined && message.Name !== '') { + writer.uint32(10).string(message.Name); + } + if (message.Expression !== undefined && message.Expression !== '') { + writer.uint32(18).string(message.Expression); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Variable { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVariable(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.Name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.Expression = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Variable { + return { + Name: isSet(object.Name) ? globalThis.String(object.Name) : '', + Expression: isSet(object.Expression) ? globalThis.String(object.Expression) : '', + }; + }, + + toJSON(message: Variable): unknown { + const obj: any = {}; + if (message.Name !== undefined && message.Name !== '') { + obj.Name = message.Name; + } + if (message.Expression !== undefined && message.Expression !== '') { + obj.Expression = message.Expression; + } + return obj; + }, + + create, I>>(base?: I): Variable { + return Variable.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Variable { + const message = createBaseVariable(); + message.Name = object.Name ?? ''; + message.Expression = object.Expression ?? ''; + return message; + }, +}; + +function createBaseWebhookClientConfig(): WebhookClientConfig { + return { url: '', service: undefined, caBundle: new Uint8Array(0) }; +} + +export const WebhookClientConfig: MessageFns = { + encode(message: WebhookClientConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.url !== undefined && message.url !== '') { + writer.uint32(26).string(message.url); + } + if (message.service !== undefined) { + ServiceReference.encode(message.service, writer.uint32(10).fork()).join(); + } + if (message.caBundle !== undefined && message.caBundle.length !== 0) { + writer.uint32(18).bytes(message.caBundle); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WebhookClientConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWebhookClientConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 26) { + break; + } + + message.url = reader.string(); + continue; + } + case 1: { + if (tag !== 10) { + break; + } + + message.service = ServiceReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.caBundle = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): WebhookClientConfig { + return { + url: isSet(object.url) ? globalThis.String(object.url) : '', + service: isSet(object.service) ? ServiceReference.fromJSON(object.service) : undefined, + caBundle: isSet(object.caBundle) ? bytesFromBase64(object.caBundle) : new Uint8Array(0), + }; + }, + + toJSON(message: WebhookClientConfig): unknown { + const obj: any = {}; + if (message.url !== undefined && message.url !== '') { + obj.url = message.url; + } + if (message.service !== undefined) { + obj.service = ServiceReference.toJSON(message.service); + } + if (message.caBundle !== undefined && message.caBundle.length !== 0) { + obj.caBundle = base64FromBytes(message.caBundle); + } + return obj; + }, + + create, I>>(base?: I): WebhookClientConfig { + return WebhookClientConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): WebhookClientConfig { + const message = createBaseWebhookClientConfig(); + message.url = object.url ?? ''; + message.service = + object.service !== undefined && object.service !== null + ? ServiceReference.fromPartial(object.service) + : undefined; + message.caBundle = object.caBundle ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from((globalThis as any).Buffer.from(b64, 'base64')); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return (globalThis as any).Buffer.from(arr).toString('base64'); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join('')); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error('Value is smaller than Number.MIN_SAFE_INTEGER'); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/apidiscovery/v2/generated.ts b/src/proto/generated/k8s.io/api/apidiscovery/v2/generated.ts new file mode 100644 index 00000000000..64b84f03486 --- /dev/null +++ b/src/proto/generated/k8s.io/api/apidiscovery/v2/generated.ts @@ -0,0 +1,827 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/apidiscovery/v2/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { GroupVersionKind, ListMeta, ObjectMeta } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** + * APIGroupDiscovery holds information about which resources are being served for all version of the API Group. + * It contains a list of APIVersionDiscovery that holds a list of APIResourceDiscovery types served for a version. + * Versions are in descending order of preference, with the first version being the preferred entry. + */ +export interface APIGroupDiscovery { + /** + * metadata is standard object's metadata. + * The only field completed will be name. For instance, resourceVersion will be empty. + * name is the name of the API group whose discovery information is presented here. + * name is allowed to be "" to represent the legacy, ungroupified resources. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * versions are the versions supported in this group. They are sorted in descending order of preference, + * with the preferred version being the first entry. + * +listType=map + * +listMapKey=version + * +optional + */ + versions: APIVersionDiscovery[]; +} + +/** + * APIGroupDiscoveryList is a resource containing a list of APIGroupDiscovery. + * This is one of the types able to be returned from the /api and /apis endpoint and contains an aggregated + * list of API resources (built-ins, Custom Resource Definitions, resources from aggregated servers) + * that a cluster supports. + */ +export interface APIGroupDiscoveryList { + /** + * ResourceVersion will not be set, because this does not have a replayable ordering among multiple apiservers. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** + * items is the list of groups for discovery. The groups are listed in priority order. + * +optional + */ + items: APIGroupDiscovery[]; +} + +/** APIResourceDiscovery provides information about an API resource for discovery. */ +export interface APIResourceDiscovery { + /** + * resource is the plural name of the resource. This is used in the URL path and is the unique identifier + * for this resource across all versions in the API group. + * Resources with non-empty groups are located at /apis/// + * Resources with empty groups are located at /api/v1/ + * +optional + */ + resource?: string | undefined; + /** + * responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns. + * APIs may return other objects types at their discretion, such as error conditions, requests for alternate representations, or other operation specific behavior. + * This value will be null or empty if an APIService reports subresources but supports no operations on the parent resource + * +optional + */ + responseKind?: GroupVersionKind | undefined; + /** + * scope indicates the scope of a resource, either Cluster or Namespaced + * +optional + */ + scope?: string | undefined; + /** + * singularResource is the singular name of the resource. This allows clients to handle plural and singular opaquely. + * For many clients the singular form of the resource will be more understandable to users reading messages and should be used when integrating the name of the resource into a sentence. + * The command line tool kubectl, for example, allows use of the singular resource name in place of plurals. + * The singular form of a resource should always be an optional element - when in doubt use the canonical resource name. + * +optional + */ + singularResource?: string | undefined; + /** + * verbs is a list of supported API operation types (this includes + * but is not limited to get, list, watch, create, update, patch, + * delete, deletecollection, and proxy). + * +listType=set + * +optional + */ + verbs: string[]; + /** + * shortNames is a list of suggested short names of the resource. + * +listType=set + * +optional + */ + shortNames: string[]; + /** + * categories is a list of the grouped resources this resource belongs to (e.g. 'all'). + * Clients may use this to simplify acting on multiple resource types at once. + * +listType=set + * +optional + */ + categories: string[]; + /** + * subresources is a list of subresources provided by this resource. Subresources are located at /apis////name-of-instance/ + * +listType=map + * +listMapKey=subresource + * +optional + */ + subresources: APISubresourceDiscovery[]; +} + +/** APISubresourceDiscovery provides information about an API subresource for discovery. */ +export interface APISubresourceDiscovery { + /** + * subresource is the name of the subresource. This is used in the URL path and is the unique identifier + * for this resource across all versions. + * +optional + */ + subresource?: string | undefined; + /** + * responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns. + * Some subresources do not return normal resources, these will have null or empty return types. + * +optional + */ + responseKind?: GroupVersionKind | undefined; + /** + * acceptedTypes describes the kinds that this endpoint accepts. + * Subresources may accept the standard content types or define + * custom negotiation schemes. The list may not be exhaustive for + * all operations. + * +listType=map + * +listMapKey=group + * +listMapKey=version + * +listMapKey=kind + * +optional + */ + acceptedTypes: GroupVersionKind[]; + /** + * verbs is a list of supported API operation types (this includes + * but is not limited to get, list, watch, create, update, patch, + * delete, deletecollection, and proxy). Subresources may define + * custom verbs outside the standard Kubernetes verb set. Clients + * should expect the behavior of standard verbs to align with + * Kubernetes interaction conventions. + * +listType=set + * +optional + */ + verbs: string[]; +} + +/** APIVersionDiscovery holds a list of APIResourceDiscovery types that are served for a particular version within an API Group. */ +export interface APIVersionDiscovery { + /** + * version is the name of the version within a group version. + * +optional + */ + version?: string | undefined; + /** + * resources is a list of APIResourceDiscovery objects for the corresponding group version. + * +listType=map + * +listMapKey=resource + * +optional + */ + resources: APIResourceDiscovery[]; + /** + * freshness marks whether a group version's discovery document is up to date. + * "Current" indicates the discovery document was recently + * refreshed. "Stale" indicates the discovery document could not + * be retrieved and the returned discovery document may be + * significantly out of date. Clients that require the latest + * version of the discovery information be retrieved before + * performing an operation should not use the aggregated document + * +optional + */ + freshness?: string | undefined; +} + +function createBaseAPIGroupDiscovery(): APIGroupDiscovery { + return { metadata: undefined, versions: [] }; +} + +export const APIGroupDiscovery: MessageFns = { + encode(message: APIGroupDiscovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.versions) { + APIVersionDiscovery.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIGroupDiscovery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIGroupDiscovery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.versions.push(APIVersionDiscovery.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIGroupDiscovery { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + versions: globalThis.Array.isArray(object?.versions) + ? object.versions.map((e: any) => APIVersionDiscovery.fromJSON(e)) + : [], + }; + }, + + toJSON(message: APIGroupDiscovery): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.versions?.length) { + obj.versions = message.versions.map((e) => APIVersionDiscovery.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): APIGroupDiscovery { + return APIGroupDiscovery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIGroupDiscovery { + const message = createBaseAPIGroupDiscovery(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.versions = object.versions?.map((e) => APIVersionDiscovery.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAPIGroupDiscoveryList(): APIGroupDiscoveryList { + return { metadata: undefined, items: [] }; +} + +export const APIGroupDiscoveryList: MessageFns = { + encode(message: APIGroupDiscoveryList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + APIGroupDiscovery.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIGroupDiscoveryList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIGroupDiscoveryList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(APIGroupDiscovery.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIGroupDiscoveryList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => APIGroupDiscovery.fromJSON(e)) + : [], + }; + }, + + toJSON(message: APIGroupDiscoveryList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => APIGroupDiscovery.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): APIGroupDiscoveryList { + return APIGroupDiscoveryList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIGroupDiscoveryList { + const message = createBaseAPIGroupDiscoveryList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => APIGroupDiscovery.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAPIResourceDiscovery(): APIResourceDiscovery { + return { + resource: '', + responseKind: undefined, + scope: '', + singularResource: '', + verbs: [], + shortNames: [], + categories: [], + subresources: [], + }; +} + +export const APIResourceDiscovery: MessageFns = { + encode(message: APIResourceDiscovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.resource !== undefined && message.resource !== '') { + writer.uint32(10).string(message.resource); + } + if (message.responseKind !== undefined) { + GroupVersionKind.encode(message.responseKind, writer.uint32(18).fork()).join(); + } + if (message.scope !== undefined && message.scope !== '') { + writer.uint32(26).string(message.scope); + } + if (message.singularResource !== undefined && message.singularResource !== '') { + writer.uint32(34).string(message.singularResource); + } + for (const v of message.verbs) { + writer.uint32(42).string(v!); + } + for (const v of message.shortNames) { + writer.uint32(50).string(v!); + } + for (const v of message.categories) { + writer.uint32(58).string(v!); + } + for (const v of message.subresources) { + APISubresourceDiscovery.encode(v!, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIResourceDiscovery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIResourceDiscovery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resource = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.responseKind = GroupVersionKind.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.scope = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.singularResource = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.verbs.push(reader.string()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.shortNames.push(reader.string()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.categories.push(reader.string()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.subresources.push(APISubresourceDiscovery.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIResourceDiscovery { + return { + resource: isSet(object.resource) ? globalThis.String(object.resource) : '', + responseKind: isSet(object.responseKind) + ? GroupVersionKind.fromJSON(object.responseKind) + : undefined, + scope: isSet(object.scope) ? globalThis.String(object.scope) : '', + singularResource: isSet(object.singularResource) + ? globalThis.String(object.singularResource) + : '', + verbs: globalThis.Array.isArray(object?.verbs) + ? object.verbs.map((e: any) => globalThis.String(e)) + : [], + shortNames: globalThis.Array.isArray(object?.shortNames) + ? object.shortNames.map((e: any) => globalThis.String(e)) + : [], + categories: globalThis.Array.isArray(object?.categories) + ? object.categories.map((e: any) => globalThis.String(e)) + : [], + subresources: globalThis.Array.isArray(object?.subresources) + ? object.subresources.map((e: any) => APISubresourceDiscovery.fromJSON(e)) + : [], + }; + }, + + toJSON(message: APIResourceDiscovery): unknown { + const obj: any = {}; + if (message.resource !== undefined && message.resource !== '') { + obj.resource = message.resource; + } + if (message.responseKind !== undefined) { + obj.responseKind = GroupVersionKind.toJSON(message.responseKind); + } + if (message.scope !== undefined && message.scope !== '') { + obj.scope = message.scope; + } + if (message.singularResource !== undefined && message.singularResource !== '') { + obj.singularResource = message.singularResource; + } + if (message.verbs?.length) { + obj.verbs = message.verbs; + } + if (message.shortNames?.length) { + obj.shortNames = message.shortNames; + } + if (message.categories?.length) { + obj.categories = message.categories; + } + if (message.subresources?.length) { + obj.subresources = message.subresources.map((e) => APISubresourceDiscovery.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): APIResourceDiscovery { + return APIResourceDiscovery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIResourceDiscovery { + const message = createBaseAPIResourceDiscovery(); + message.resource = object.resource ?? ''; + message.responseKind = + object.responseKind !== undefined && object.responseKind !== null + ? GroupVersionKind.fromPartial(object.responseKind) + : undefined; + message.scope = object.scope ?? ''; + message.singularResource = object.singularResource ?? ''; + message.verbs = object.verbs?.map((e) => e) || []; + message.shortNames = object.shortNames?.map((e) => e) || []; + message.categories = object.categories?.map((e) => e) || []; + message.subresources = object.subresources?.map((e) => APISubresourceDiscovery.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAPISubresourceDiscovery(): APISubresourceDiscovery { + return { subresource: '', responseKind: undefined, acceptedTypes: [], verbs: [] }; +} + +export const APISubresourceDiscovery: MessageFns = { + encode(message: APISubresourceDiscovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subresource !== undefined && message.subresource !== '') { + writer.uint32(10).string(message.subresource); + } + if (message.responseKind !== undefined) { + GroupVersionKind.encode(message.responseKind, writer.uint32(18).fork()).join(); + } + for (const v of message.acceptedTypes) { + GroupVersionKind.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.verbs) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APISubresourceDiscovery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPISubresourceDiscovery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.subresource = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.responseKind = GroupVersionKind.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.acceptedTypes.push(GroupVersionKind.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.verbs.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APISubresourceDiscovery { + return { + subresource: isSet(object.subresource) ? globalThis.String(object.subresource) : '', + responseKind: isSet(object.responseKind) + ? GroupVersionKind.fromJSON(object.responseKind) + : undefined, + acceptedTypes: globalThis.Array.isArray(object?.acceptedTypes) + ? object.acceptedTypes.map((e: any) => GroupVersionKind.fromJSON(e)) + : [], + verbs: globalThis.Array.isArray(object?.verbs) + ? object.verbs.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: APISubresourceDiscovery): unknown { + const obj: any = {}; + if (message.subresource !== undefined && message.subresource !== '') { + obj.subresource = message.subresource; + } + if (message.responseKind !== undefined) { + obj.responseKind = GroupVersionKind.toJSON(message.responseKind); + } + if (message.acceptedTypes?.length) { + obj.acceptedTypes = message.acceptedTypes.map((e) => GroupVersionKind.toJSON(e)); + } + if (message.verbs?.length) { + obj.verbs = message.verbs; + } + return obj; + }, + + create, I>>(base?: I): APISubresourceDiscovery { + return APISubresourceDiscovery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): APISubresourceDiscovery { + const message = createBaseAPISubresourceDiscovery(); + message.subresource = object.subresource ?? ''; + message.responseKind = + object.responseKind !== undefined && object.responseKind !== null + ? GroupVersionKind.fromPartial(object.responseKind) + : undefined; + message.acceptedTypes = object.acceptedTypes?.map((e) => GroupVersionKind.fromPartial(e)) || []; + message.verbs = object.verbs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseAPIVersionDiscovery(): APIVersionDiscovery { + return { version: '', resources: [], freshness: '' }; +} + +export const APIVersionDiscovery: MessageFns = { + encode(message: APIVersionDiscovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined && message.version !== '') { + writer.uint32(10).string(message.version); + } + for (const v of message.resources) { + APIResourceDiscovery.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.freshness !== undefined && message.freshness !== '') { + writer.uint32(26).string(message.freshness); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIVersionDiscovery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIVersionDiscovery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.version = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resources.push(APIResourceDiscovery.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.freshness = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIVersionDiscovery { + return { + version: isSet(object.version) ? globalThis.String(object.version) : '', + resources: globalThis.Array.isArray(object?.resources) + ? object.resources.map((e: any) => APIResourceDiscovery.fromJSON(e)) + : [], + freshness: isSet(object.freshness) ? globalThis.String(object.freshness) : '', + }; + }, + + toJSON(message: APIVersionDiscovery): unknown { + const obj: any = {}; + if (message.version !== undefined && message.version !== '') { + obj.version = message.version; + } + if (message.resources?.length) { + obj.resources = message.resources.map((e) => APIResourceDiscovery.toJSON(e)); + } + if (message.freshness !== undefined && message.freshness !== '') { + obj.freshness = message.freshness; + } + return obj; + }, + + create, I>>(base?: I): APIVersionDiscovery { + return APIVersionDiscovery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIVersionDiscovery { + const message = createBaseAPIVersionDiscovery(); + message.version = object.version ?? ''; + message.resources = object.resources?.map((e) => APIResourceDiscovery.fromPartial(e)) || []; + message.freshness = object.freshness ?? ''; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/apidiscovery/v2beta1/generated.ts b/src/proto/generated/k8s.io/api/apidiscovery/v2beta1/generated.ts new file mode 100644 index 00000000000..8bd7d4216d0 --- /dev/null +++ b/src/proto/generated/k8s.io/api/apidiscovery/v2beta1/generated.ts @@ -0,0 +1,827 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/apidiscovery/v2beta1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { GroupVersionKind, ListMeta, ObjectMeta } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** + * APIGroupDiscovery holds information about which resources are being served for all version of the API Group. + * It contains a list of APIVersionDiscovery that holds a list of APIResourceDiscovery types served for a version. + * Versions are in descending order of preference, with the first version being the preferred entry. + */ +export interface APIGroupDiscovery { + /** + * metadata is standard object's metadata. + * The only field completed will be name. For instance, resourceVersion will be empty. + * name is the name of the API group whose discovery information is presented here. + * name is allowed to be "" to represent the legacy, ungroupified resources. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * versions are the versions supported in this group. They are sorted in descending order of preference, + * with the preferred version being the first entry. + * +listType=map + * +listMapKey=version + * +optional + */ + versions: APIVersionDiscovery[]; +} + +/** + * APIGroupDiscoveryList is a resource containing a list of APIGroupDiscovery. + * This is one of the types able to be returned from the /api and /apis endpoint and contains an aggregated + * list of API resources (built-ins, Custom Resource Definitions, resources from aggregated servers) + * that a cluster supports. + */ +export interface APIGroupDiscoveryList { + /** + * ResourceVersion will not be set, because this does not have a replayable ordering among multiple apiservers. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** + * items is the list of groups for discovery. The groups are listed in priority order. + * +optional + */ + items: APIGroupDiscovery[]; +} + +/** APIResourceDiscovery provides information about an API resource for discovery. */ +export interface APIResourceDiscovery { + /** + * resource is the plural name of the resource. This is used in the URL path and is the unique identifier + * for this resource across all versions in the API group. + * Resources with non-empty groups are located at /apis/// + * Resources with empty groups are located at /api/v1/ + * +optional + */ + resource?: string | undefined; + /** + * responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns. + * APIs may return other objects types at their discretion, such as error conditions, requests for alternate representations, or other operation specific behavior. + * This value will be null or empty if an APIService reports subresources but supports no operations on the parent resource + * +optional + */ + responseKind?: GroupVersionKind | undefined; + /** + * scope indicates the scope of a resource, either Cluster or Namespaced + * +optional + */ + scope?: string | undefined; + /** + * singularResource is the singular name of the resource. This allows clients to handle plural and singular opaquely. + * For many clients the singular form of the resource will be more understandable to users reading messages and should be used when integrating the name of the resource into a sentence. + * The command line tool kubectl, for example, allows use of the singular resource name in place of plurals. + * The singular form of a resource should always be an optional element - when in doubt use the canonical resource name. + * +optional + */ + singularResource?: string | undefined; + /** + * verbs is a list of supported API operation types (this includes + * but is not limited to get, list, watch, create, update, patch, + * delete, deletecollection, and proxy). + * +listType=set + * +optional + */ + verbs: string[]; + /** + * shortNames is a list of suggested short names of the resource. + * +listType=set + * +optional + */ + shortNames: string[]; + /** + * categories is a list of the grouped resources this resource belongs to (e.g. 'all'). + * Clients may use this to simplify acting on multiple resource types at once. + * +listType=set + * +optional + */ + categories: string[]; + /** + * subresources is a list of subresources provided by this resource. Subresources are located at /apis////name-of-instance/ + * +listType=map + * +listMapKey=subresource + * +optional + */ + subresources: APISubresourceDiscovery[]; +} + +/** APISubresourceDiscovery provides information about an API subresource for discovery. */ +export interface APISubresourceDiscovery { + /** + * subresource is the name of the subresource. This is used in the URL path and is the unique identifier + * for this resource across all versions. + * +optional + */ + subresource?: string | undefined; + /** + * responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns. + * Some subresources do not return normal resources, these will have null or empty return types. + * +optional + */ + responseKind?: GroupVersionKind | undefined; + /** + * acceptedTypes describes the kinds that this endpoint accepts. + * Subresources may accept the standard content types or define + * custom negotiation schemes. The list may not be exhaustive for + * all operations. + * +listType=map + * +listMapKey=group + * +listMapKey=version + * +listMapKey=kind + * +optional + */ + acceptedTypes: GroupVersionKind[]; + /** + * verbs is a list of supported API operation types (this includes + * but is not limited to get, list, watch, create, update, patch, + * delete, deletecollection, and proxy). Subresources may define + * custom verbs outside the standard Kubernetes verb set. Clients + * should expect the behavior of standard verbs to align with + * Kubernetes interaction conventions. + * +listType=set + * +optional + */ + verbs: string[]; +} + +/** APIVersionDiscovery holds a list of APIResourceDiscovery types that are served for a particular version within an API Group. */ +export interface APIVersionDiscovery { + /** + * version is the name of the version within a group version. + * +optional + */ + version?: string | undefined; + /** + * resources is a list of APIResourceDiscovery objects for the corresponding group version. + * +listType=map + * +listMapKey=resource + * +optional + */ + resources: APIResourceDiscovery[]; + /** + * freshness marks whether a group version's discovery document is up to date. + * "Current" indicates the discovery document was recently + * refreshed. "Stale" indicates the discovery document could not + * be retrieved and the returned discovery document may be + * significantly out of date. Clients that require the latest + * version of the discovery information be retrieved before + * performing an operation should not use the aggregated document + * +optional + */ + freshness?: string | undefined; +} + +function createBaseAPIGroupDiscovery(): APIGroupDiscovery { + return { metadata: undefined, versions: [] }; +} + +export const APIGroupDiscovery: MessageFns = { + encode(message: APIGroupDiscovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.versions) { + APIVersionDiscovery.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIGroupDiscovery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIGroupDiscovery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.versions.push(APIVersionDiscovery.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIGroupDiscovery { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + versions: globalThis.Array.isArray(object?.versions) + ? object.versions.map((e: any) => APIVersionDiscovery.fromJSON(e)) + : [], + }; + }, + + toJSON(message: APIGroupDiscovery): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.versions?.length) { + obj.versions = message.versions.map((e) => APIVersionDiscovery.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): APIGroupDiscovery { + return APIGroupDiscovery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIGroupDiscovery { + const message = createBaseAPIGroupDiscovery(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.versions = object.versions?.map((e) => APIVersionDiscovery.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAPIGroupDiscoveryList(): APIGroupDiscoveryList { + return { metadata: undefined, items: [] }; +} + +export const APIGroupDiscoveryList: MessageFns = { + encode(message: APIGroupDiscoveryList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + APIGroupDiscovery.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIGroupDiscoveryList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIGroupDiscoveryList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(APIGroupDiscovery.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIGroupDiscoveryList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => APIGroupDiscovery.fromJSON(e)) + : [], + }; + }, + + toJSON(message: APIGroupDiscoveryList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => APIGroupDiscovery.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): APIGroupDiscoveryList { + return APIGroupDiscoveryList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIGroupDiscoveryList { + const message = createBaseAPIGroupDiscoveryList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => APIGroupDiscovery.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAPIResourceDiscovery(): APIResourceDiscovery { + return { + resource: '', + responseKind: undefined, + scope: '', + singularResource: '', + verbs: [], + shortNames: [], + categories: [], + subresources: [], + }; +} + +export const APIResourceDiscovery: MessageFns = { + encode(message: APIResourceDiscovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.resource !== undefined && message.resource !== '') { + writer.uint32(10).string(message.resource); + } + if (message.responseKind !== undefined) { + GroupVersionKind.encode(message.responseKind, writer.uint32(18).fork()).join(); + } + if (message.scope !== undefined && message.scope !== '') { + writer.uint32(26).string(message.scope); + } + if (message.singularResource !== undefined && message.singularResource !== '') { + writer.uint32(34).string(message.singularResource); + } + for (const v of message.verbs) { + writer.uint32(42).string(v!); + } + for (const v of message.shortNames) { + writer.uint32(50).string(v!); + } + for (const v of message.categories) { + writer.uint32(58).string(v!); + } + for (const v of message.subresources) { + APISubresourceDiscovery.encode(v!, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIResourceDiscovery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIResourceDiscovery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resource = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.responseKind = GroupVersionKind.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.scope = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.singularResource = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.verbs.push(reader.string()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.shortNames.push(reader.string()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.categories.push(reader.string()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.subresources.push(APISubresourceDiscovery.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIResourceDiscovery { + return { + resource: isSet(object.resource) ? globalThis.String(object.resource) : '', + responseKind: isSet(object.responseKind) + ? GroupVersionKind.fromJSON(object.responseKind) + : undefined, + scope: isSet(object.scope) ? globalThis.String(object.scope) : '', + singularResource: isSet(object.singularResource) + ? globalThis.String(object.singularResource) + : '', + verbs: globalThis.Array.isArray(object?.verbs) + ? object.verbs.map((e: any) => globalThis.String(e)) + : [], + shortNames: globalThis.Array.isArray(object?.shortNames) + ? object.shortNames.map((e: any) => globalThis.String(e)) + : [], + categories: globalThis.Array.isArray(object?.categories) + ? object.categories.map((e: any) => globalThis.String(e)) + : [], + subresources: globalThis.Array.isArray(object?.subresources) + ? object.subresources.map((e: any) => APISubresourceDiscovery.fromJSON(e)) + : [], + }; + }, + + toJSON(message: APIResourceDiscovery): unknown { + const obj: any = {}; + if (message.resource !== undefined && message.resource !== '') { + obj.resource = message.resource; + } + if (message.responseKind !== undefined) { + obj.responseKind = GroupVersionKind.toJSON(message.responseKind); + } + if (message.scope !== undefined && message.scope !== '') { + obj.scope = message.scope; + } + if (message.singularResource !== undefined && message.singularResource !== '') { + obj.singularResource = message.singularResource; + } + if (message.verbs?.length) { + obj.verbs = message.verbs; + } + if (message.shortNames?.length) { + obj.shortNames = message.shortNames; + } + if (message.categories?.length) { + obj.categories = message.categories; + } + if (message.subresources?.length) { + obj.subresources = message.subresources.map((e) => APISubresourceDiscovery.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): APIResourceDiscovery { + return APIResourceDiscovery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIResourceDiscovery { + const message = createBaseAPIResourceDiscovery(); + message.resource = object.resource ?? ''; + message.responseKind = + object.responseKind !== undefined && object.responseKind !== null + ? GroupVersionKind.fromPartial(object.responseKind) + : undefined; + message.scope = object.scope ?? ''; + message.singularResource = object.singularResource ?? ''; + message.verbs = object.verbs?.map((e) => e) || []; + message.shortNames = object.shortNames?.map((e) => e) || []; + message.categories = object.categories?.map((e) => e) || []; + message.subresources = object.subresources?.map((e) => APISubresourceDiscovery.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAPISubresourceDiscovery(): APISubresourceDiscovery { + return { subresource: '', responseKind: undefined, acceptedTypes: [], verbs: [] }; +} + +export const APISubresourceDiscovery: MessageFns = { + encode(message: APISubresourceDiscovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subresource !== undefined && message.subresource !== '') { + writer.uint32(10).string(message.subresource); + } + if (message.responseKind !== undefined) { + GroupVersionKind.encode(message.responseKind, writer.uint32(18).fork()).join(); + } + for (const v of message.acceptedTypes) { + GroupVersionKind.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.verbs) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APISubresourceDiscovery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPISubresourceDiscovery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.subresource = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.responseKind = GroupVersionKind.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.acceptedTypes.push(GroupVersionKind.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.verbs.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APISubresourceDiscovery { + return { + subresource: isSet(object.subresource) ? globalThis.String(object.subresource) : '', + responseKind: isSet(object.responseKind) + ? GroupVersionKind.fromJSON(object.responseKind) + : undefined, + acceptedTypes: globalThis.Array.isArray(object?.acceptedTypes) + ? object.acceptedTypes.map((e: any) => GroupVersionKind.fromJSON(e)) + : [], + verbs: globalThis.Array.isArray(object?.verbs) + ? object.verbs.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: APISubresourceDiscovery): unknown { + const obj: any = {}; + if (message.subresource !== undefined && message.subresource !== '') { + obj.subresource = message.subresource; + } + if (message.responseKind !== undefined) { + obj.responseKind = GroupVersionKind.toJSON(message.responseKind); + } + if (message.acceptedTypes?.length) { + obj.acceptedTypes = message.acceptedTypes.map((e) => GroupVersionKind.toJSON(e)); + } + if (message.verbs?.length) { + obj.verbs = message.verbs; + } + return obj; + }, + + create, I>>(base?: I): APISubresourceDiscovery { + return APISubresourceDiscovery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): APISubresourceDiscovery { + const message = createBaseAPISubresourceDiscovery(); + message.subresource = object.subresource ?? ''; + message.responseKind = + object.responseKind !== undefined && object.responseKind !== null + ? GroupVersionKind.fromPartial(object.responseKind) + : undefined; + message.acceptedTypes = object.acceptedTypes?.map((e) => GroupVersionKind.fromPartial(e)) || []; + message.verbs = object.verbs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseAPIVersionDiscovery(): APIVersionDiscovery { + return { version: '', resources: [], freshness: '' }; +} + +export const APIVersionDiscovery: MessageFns = { + encode(message: APIVersionDiscovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined && message.version !== '') { + writer.uint32(10).string(message.version); + } + for (const v of message.resources) { + APIResourceDiscovery.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.freshness !== undefined && message.freshness !== '') { + writer.uint32(26).string(message.freshness); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIVersionDiscovery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIVersionDiscovery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.version = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resources.push(APIResourceDiscovery.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.freshness = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIVersionDiscovery { + return { + version: isSet(object.version) ? globalThis.String(object.version) : '', + resources: globalThis.Array.isArray(object?.resources) + ? object.resources.map((e: any) => APIResourceDiscovery.fromJSON(e)) + : [], + freshness: isSet(object.freshness) ? globalThis.String(object.freshness) : '', + }; + }, + + toJSON(message: APIVersionDiscovery): unknown { + const obj: any = {}; + if (message.version !== undefined && message.version !== '') { + obj.version = message.version; + } + if (message.resources?.length) { + obj.resources = message.resources.map((e) => APIResourceDiscovery.toJSON(e)); + } + if (message.freshness !== undefined && message.freshness !== '') { + obj.freshness = message.freshness; + } + return obj; + }, + + create, I>>(base?: I): APIVersionDiscovery { + return APIVersionDiscovery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIVersionDiscovery { + const message = createBaseAPIVersionDiscovery(); + message.version = object.version ?? ''; + message.resources = object.resources?.map((e) => APIResourceDiscovery.fromPartial(e)) || []; + message.freshness = object.freshness ?? ''; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/apiserverinternal/v1alpha1/generated.ts b/src/proto/generated/k8s.io/api/apiserverinternal/v1alpha1/generated.ts new file mode 100644 index 00000000000..7294a53e336 --- /dev/null +++ b/src/proto/generated/k8s.io/api/apiserverinternal/v1alpha1/generated.ts @@ -0,0 +1,832 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/apiserverinternal/v1alpha1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { ListMeta, ObjectMeta, Time } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** + * An API server instance reports the version it can decode and the version it + * encodes objects to when persisting objects in the backend. + */ +export interface ServerStorageVersion { + /** + * apiServerID is the ID of the reporting API server. + * +required + */ + apiServerID?: string | undefined; + /** + * encodingVersion the API server encodes the object to when persisting it in + * the backend (e.g., etcd). + * +required + */ + encodingVersion?: string | undefined; + /** + * decodableVersions are the encoding versions the API server can handle to decode. + * The API server can decode objects encoded in these versions. + * The encodingVersion must be included in the decodableVersions. + * +listType=set + * +required + */ + decodableVersions: string[]; + /** + * servedVersions lists all versions the API server can serve. + * DecodableVersions must include all ServedVersions. + * +listType=set + * +optional + */ + servedVersions: string[]; +} + +/** + * Storage version of a specific resource. + * +k8s:supportsSubresource="/status" + */ +export interface StorageVersion { + /** + * metadata is the standard object metadata. + * The name is .. + * +required + */ + metadata?: ObjectMeta | undefined; + /** + * spec is an empty spec. It is here to comply with Kubernetes API style. + * +optional + */ + spec?: StorageVersionSpec | undefined; + /** + * status on the version the API server instance can decode from and + * encode objects to when persisting objects in the backend. + * +optional + */ + status?: StorageVersionStatus | undefined; +} + +/** Describes the state of the storageVersion at a certain point. */ +export interface StorageVersionCondition { + /** + * type of the condition. + * +required + */ + type?: string | undefined; + /** + * status of the condition, one of True, False, Unknown. + * +required + */ + status?: string | undefined; + /** + * observedGeneration represents the .metadata.generation that the condition was set based upon, if field is set. + * +optional + */ + observedGeneration?: number | undefined; + /** + * lastTransitionTime is the last time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * reason for the condition's last transition. + * +required + */ + reason?: string | undefined; + /** + * message is a human readable string indicating details about the transition. + * +required + */ + message?: string | undefined; +} + +/** A list of StorageVersions. */ +export interface StorageVersionList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** Items holds a list of StorageVersion */ + items: StorageVersion[]; +} + +/** StorageVersionSpec is an empty spec. */ +export interface StorageVersionSpec {} + +/** + * API server instances report the versions they can decode and the version they + * encode objects to when persisting objects in the backend. + */ +export interface StorageVersionStatus { + /** + * storageVersions lists the reported versions per API server instance. + * +optional + * +listType=map + * +listMapKey=apiServerID + */ + storageVersions: ServerStorageVersion[]; + /** + * commonEncodingVersion is set to an encoding storage version if all API server + * instances share that same version. If they don't share one storage version, this + * field is left empty. + * API servers should finish updating its storageVersionStatus entry before + * serving write operations, so that this field will be in sync with the reality. + * +optional + */ + commonEncodingVersion?: string | undefined; + /** + * conditions lists the latest available observations of the storageVersion's state. + * +optional + * +listType=map + * +listMapKey=type + */ + conditions: StorageVersionCondition[]; +} + +function createBaseServerStorageVersion(): ServerStorageVersion { + return { apiServerID: '', encodingVersion: '', decodableVersions: [], servedVersions: [] }; +} + +export const ServerStorageVersion: MessageFns = { + encode(message: ServerStorageVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.apiServerID !== undefined && message.apiServerID !== '') { + writer.uint32(10).string(message.apiServerID); + } + if (message.encodingVersion !== undefined && message.encodingVersion !== '') { + writer.uint32(18).string(message.encodingVersion); + } + for (const v of message.decodableVersions) { + writer.uint32(26).string(v!); + } + for (const v of message.servedVersions) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServerStorageVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServerStorageVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.apiServerID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.encodingVersion = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.decodableVersions.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.servedVersions.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServerStorageVersion { + return { + apiServerID: isSet(object.apiServerID) ? globalThis.String(object.apiServerID) : '', + encodingVersion: isSet(object.encodingVersion) ? globalThis.String(object.encodingVersion) : '', + decodableVersions: globalThis.Array.isArray(object?.decodableVersions) + ? object.decodableVersions.map((e: any) => globalThis.String(e)) + : [], + servedVersions: globalThis.Array.isArray(object?.servedVersions) + ? object.servedVersions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ServerStorageVersion): unknown { + const obj: any = {}; + if (message.apiServerID !== undefined && message.apiServerID !== '') { + obj.apiServerID = message.apiServerID; + } + if (message.encodingVersion !== undefined && message.encodingVersion !== '') { + obj.encodingVersion = message.encodingVersion; + } + if (message.decodableVersions?.length) { + obj.decodableVersions = message.decodableVersions; + } + if (message.servedVersions?.length) { + obj.servedVersions = message.servedVersions; + } + return obj; + }, + + create, I>>(base?: I): ServerStorageVersion { + return ServerStorageVersion.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServerStorageVersion { + const message = createBaseServerStorageVersion(); + message.apiServerID = object.apiServerID ?? ''; + message.encodingVersion = object.encodingVersion ?? ''; + message.decodableVersions = object.decodableVersions?.map((e) => e) || []; + message.servedVersions = object.servedVersions?.map((e) => e) || []; + return message; + }, +}; + +function createBaseStorageVersion(): StorageVersion { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const StorageVersion: MessageFns = { + encode(message: StorageVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + StorageVersionSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + StorageVersionStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StorageVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStorageVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = StorageVersionSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = StorageVersionStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StorageVersion { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? StorageVersionSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? StorageVersionStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: StorageVersion): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = StorageVersionSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = StorageVersionStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): StorageVersion { + return StorageVersion.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StorageVersion { + const message = createBaseStorageVersion(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? StorageVersionSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? StorageVersionStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseStorageVersionCondition(): StorageVersionCondition { + return { + type: '', + status: '', + observedGeneration: 0, + lastTransitionTime: undefined, + reason: '', + message: '', + }; +} + +export const StorageVersionCondition: MessageFns = { + encode(message: StorageVersionCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(24).int64(message.observedGeneration); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(34).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(42).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(50).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StorageVersionCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStorageVersionCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.reason = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StorageVersionCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: StorageVersionCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): StorageVersionCondition { + return StorageVersionCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): StorageVersionCondition { + const message = createBaseStorageVersionCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.observedGeneration = object.observedGeneration ?? 0; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseStorageVersionList(): StorageVersionList { + return { metadata: undefined, items: [] }; +} + +export const StorageVersionList: MessageFns = { + encode(message: StorageVersionList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + StorageVersion.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StorageVersionList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStorageVersionList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(StorageVersion.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StorageVersionList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => StorageVersion.fromJSON(e)) + : [], + }; + }, + + toJSON(message: StorageVersionList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => StorageVersion.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): StorageVersionList { + return StorageVersionList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StorageVersionList { + const message = createBaseStorageVersionList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => StorageVersion.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseStorageVersionSpec(): StorageVersionSpec { + return {}; +} + +export const StorageVersionSpec: MessageFns = { + encode(_: StorageVersionSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StorageVersionSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStorageVersionSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(_: any): StorageVersionSpec { + return {}; + }, + + toJSON(_: StorageVersionSpec): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): StorageVersionSpec { + return StorageVersionSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): StorageVersionSpec { + const message = createBaseStorageVersionSpec(); + return message; + }, +}; + +function createBaseStorageVersionStatus(): StorageVersionStatus { + return { storageVersions: [], commonEncodingVersion: '', conditions: [] }; +} + +export const StorageVersionStatus: MessageFns = { + encode(message: StorageVersionStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.storageVersions) { + ServerStorageVersion.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.commonEncodingVersion !== undefined && message.commonEncodingVersion !== '') { + writer.uint32(18).string(message.commonEncodingVersion); + } + for (const v of message.conditions) { + StorageVersionCondition.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StorageVersionStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStorageVersionStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.storageVersions.push(ServerStorageVersion.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.commonEncodingVersion = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.conditions.push(StorageVersionCondition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StorageVersionStatus { + return { + storageVersions: globalThis.Array.isArray(object?.storageVersions) + ? object.storageVersions.map((e: any) => ServerStorageVersion.fromJSON(e)) + : [], + commonEncodingVersion: isSet(object.commonEncodingVersion) + ? globalThis.String(object.commonEncodingVersion) + : '', + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => StorageVersionCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: StorageVersionStatus): unknown { + const obj: any = {}; + if (message.storageVersions?.length) { + obj.storageVersions = message.storageVersions.map((e) => ServerStorageVersion.toJSON(e)); + } + if (message.commonEncodingVersion !== undefined && message.commonEncodingVersion !== '') { + obj.commonEncodingVersion = message.commonEncodingVersion; + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => StorageVersionCondition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): StorageVersionStatus { + return StorageVersionStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StorageVersionStatus { + const message = createBaseStorageVersionStatus(); + message.storageVersions = + object.storageVersions?.map((e) => ServerStorageVersion.fromPartial(e)) || []; + message.commonEncodingVersion = object.commonEncodingVersion ?? ''; + message.conditions = object.conditions?.map((e) => StorageVersionCondition.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error('Value is smaller than Number.MIN_SAFE_INTEGER'); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/apps/v1/generated.ts b/src/proto/generated/k8s.io/api/apps/v1/generated.ts new file mode 100644 index 00000000000..1850eefc65b --- /dev/null +++ b/src/proto/generated/k8s.io/api/apps/v1/generated.ts @@ -0,0 +1,4984 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/apps/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { + LabelSelector, + ListMeta, + ObjectMeta, + Time, +} from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; +import { RawExtension } from '../../../apimachinery/pkg/runtime/generated.js'; +import { IntOrString } from '../../../apimachinery/pkg/util/intstr/generated.js'; +import { PersistentVolumeClaim, PodTemplateSpec } from '../../core/v1/generated.js'; + +/** + * ControllerRevision implements an immutable snapshot of state data. Clients + * are responsible for serializing and deserializing the objects that contain + * their internal state. + * Once a ControllerRevision has been successfully created, it can not be updated. + * The API Server will fail validation of all requests that attempt to mutate + * the Data field. ControllerRevisions may, however, be deleted. Note that, due to its use by both + * the DaemonSet and StatefulSet controllers for update and rollback, this object is beta. However, + * it may be subject to name and representation changes in future releases, and clients should not + * depend on its stability. It is primarily for internal use by controllers. + */ +export interface ControllerRevision { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Data is the serialized representation of the state. + * +required + */ + data?: RawExtension | undefined; + /** + * Revision indicates the revision of the state represented by Data. + * +optional + */ + revision?: number | undefined; +} + +/** ControllerRevisionList is a resource containing a list of ControllerRevision objects. */ +export interface ControllerRevisionList { + /** + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is the list of ControllerRevisions */ + items: ControllerRevision[]; +} + +/** + * DaemonSet represents the configuration of a daemon set. + * +k8s:supportsSubresource="/status" + */ +export interface DaemonSet { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * The desired behavior of this daemon set. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +required + */ + spec?: DaemonSetSpec | undefined; + /** + * The current status of this daemon set. This data may be + * out of date by some window of time. + * Populated by the system. + * Read-only. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: DaemonSetStatus | undefined; +} + +/** DaemonSetCondition describes the state of a DaemonSet at a certain point. */ +export interface DaemonSetCondition { + /** + * Type of DaemonSet condition. + * +optional + */ + type?: string | undefined; + /** + * Status of the condition, one of True, False, Unknown. + * +optional + */ + status?: string | undefined; + /** + * Last time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * The reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * A human readable message indicating details about the transition. + * +optional + */ + message?: string | undefined; +} + +/** DaemonSetList is a collection of daemon sets. */ +export interface DaemonSetList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** A list of daemon sets. */ + items: DaemonSet[]; +} + +/** DaemonSetSpec is the specification of a daemon set. */ +export interface DaemonSetSpec { + /** + * A label query over pods that are managed by the daemon set. + * Must match in order to be controlled. + * It must match the pod template's labels. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + * +required + */ + selector?: LabelSelector | undefined; + /** + * An object that describes the pod that will be created. + * The DaemonSet will create exactly one copy of this pod on every node + * that matches the template's node selector (or on every node if no node + * selector is specified). + * The only allowed template.spec.restartPolicy value is "Always". + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + * +required + */ + template?: PodTemplateSpec | undefined; + /** + * An update strategy to replace existing DaemonSet pods with new pods. + * +optional + */ + updateStrategy?: DaemonSetUpdateStrategy | undefined; + /** + * The minimum number of seconds for which a newly created DaemonSet pod should + * be ready without any of its container crashing, for it to be considered + * available. Defaults to 0 (pod will be considered available as soon as it + * is ready). + * +optional + */ + minReadySeconds?: number | undefined; + /** + * The number of old history to retain to allow rollback. + * This is a pointer to distinguish between explicit zero and not specified. + * Defaults to 10. + * +optional + */ + revisionHistoryLimit?: number | undefined; +} + +/** DaemonSetStatus represents the current status of a daemon set. */ +export interface DaemonSetStatus { + /** + * The number of nodes that are running at least 1 + * daemon pod and are supposed to run the daemon pod. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ + */ + currentNumberScheduled?: number | undefined; + /** + * The number of nodes that are running the daemon pod, but are + * not supposed to run the daemon pod. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ + */ + numberMisscheduled?: number | undefined; + /** + * The total number of nodes that should be running the daemon + * pod (including nodes correctly running the daemon pod). + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ + */ + desiredNumberScheduled?: number | undefined; + /** + * numberReady is the number of nodes that should be running the daemon pod and have one + * or more of the daemon pod running with a Ready Condition. + */ + numberReady?: number | undefined; + /** + * The most recent generation observed by the daemon set controller. + * +optional + */ + observedGeneration?: number | undefined; + /** + * The total number of nodes that are running updated daemon pod + * +optional + */ + updatedNumberScheduled?: number | undefined; + /** + * The number of nodes that should be running the + * daemon pod and have one or more of the daemon pod running and + * available (ready for at least spec.minReadySeconds) + * +optional + */ + numberAvailable?: number | undefined; + /** + * The number of nodes that should be running the + * daemon pod and have none of the daemon pod running and available + * (ready for at least spec.minReadySeconds) + * +optional + */ + numberUnavailable?: number | undefined; + /** + * Count of hash collisions for the DaemonSet. The DaemonSet controller + * uses this field as a collision avoidance mechanism when it needs to + * create the name for the newest ControllerRevision. + * +optional + */ + collisionCount?: number | undefined; + /** + * Represents the latest available observations of a DaemonSet's current state. + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: DaemonSetCondition[]; +} + +/** DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet. */ +export interface DaemonSetUpdateStrategy { + /** + * Type of daemon set update. Can be "RollingUpdate" or "OnDelete". Default is RollingUpdate. + * +optional + */ + type?: string | undefined; + /** + * Rolling update config params. Present only if type = "RollingUpdate". + * --- + * TODO: Update this to follow our convention for oneOf, whatever we decide it + * to be. Same as Deployment `strategy.rollingUpdate`. + * See https://github.com/kubernetes/kubernetes/issues/35345 + * +optional + */ + rollingUpdate?: RollingUpdateDaemonSet | undefined; +} + +/** + * Deployment enables declarative updates for Pods and ReplicaSets. + * +k8s:supportsSubresource="/scale" + * +k8s:supportsSubresource="/status" + */ +export interface Deployment { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Specification of the desired behavior of the Deployment. + * +required + */ + spec?: DeploymentSpec | undefined; + /** + * Most recently observed status of the Deployment. + * +optional + */ + status?: DeploymentStatus | undefined; +} + +/** DeploymentCondition describes the state of a deployment at a certain point. */ +export interface DeploymentCondition { + /** + * Type of deployment condition. + * +optional + */ + type?: string | undefined; + /** + * Status of the condition, one of True, False, Unknown. + * +optional + */ + status?: string | undefined; + /** + * The last time this condition was updated. + * +optional + */ + lastUpdateTime?: Time | undefined; + /** + * Last time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * The reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * A human readable message indicating details about the transition. + * +optional + */ + message?: string | undefined; +} + +/** DeploymentList is a list of Deployments. */ +export interface DeploymentList { + /** + * Standard list metadata. + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is the list of Deployments. */ + items: Deployment[]; +} + +/** DeploymentSpec is the specification of the desired behavior of the Deployment. */ +export interface DeploymentSpec { + /** + * Number of desired pods. This is a pointer to distinguish between explicit + * zero and not specified. Defaults to 1. + * +optional + */ + replicas?: number | undefined; + /** + * Label selector for pods. Existing ReplicaSets whose pods are + * selected by this will be the ones affected by this deployment. + * It must match the pod template's labels. + * +required + */ + selector?: LabelSelector | undefined; + /** + * Template describes the pods that will be created. + * The only allowed template.spec.restartPolicy value is "Always". + * +required + */ + template?: PodTemplateSpec | undefined; + /** + * The deployment strategy to use to replace existing pods with new ones. + * +optional + * +patchStrategy=retainKeys + */ + strategy?: DeploymentStrategy | undefined; + /** + * Minimum number of seconds for which a newly created pod should be ready + * without any of its container crashing, for it to be considered available. + * Defaults to 0 (pod will be considered available as soon as it is ready) + * +optional + */ + minReadySeconds?: number | undefined; + /** + * The number of old ReplicaSets to retain to allow rollback. + * This is a pointer to distinguish between explicit zero and not specified. + * Defaults to 10. + * +optional + */ + revisionHistoryLimit?: number | undefined; + /** + * Indicates that the deployment is paused. + * +optional + */ + paused?: boolean | undefined; + /** + * The maximum time in seconds for a deployment to make progress before it + * is considered to be failed. The deployment controller will continue to + * process failed deployments and a condition with a ProgressDeadlineExceeded + * reason will be surfaced in the deployment status. Note that progress will + * not be estimated during the time a deployment is paused. Defaults to 600s. + * +optional + */ + progressDeadlineSeconds?: number | undefined; +} + +/** DeploymentStatus is the most recently observed status of the Deployment. */ +export interface DeploymentStatus { + /** + * The generation observed by the deployment controller. + * +optional + */ + observedGeneration?: number | undefined; + /** + * Total number of non-terminating pods targeted by this deployment (their labels match the selector). + * +optional + */ + replicas?: number | undefined; + /** + * Total number of non-terminating pods targeted by this deployment that have the desired template spec. + * +optional + */ + updatedReplicas?: number | undefined; + /** + * Total number of non-terminating pods targeted by this Deployment with a Ready Condition. + * +optional + */ + readyReplicas?: number | undefined; + /** + * Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment. + * +optional + */ + availableReplicas?: number | undefined; + /** + * Total number of unavailable pods targeted by this deployment. This is the total number of + * pods that are still required for the deployment to have 100% available capacity. They may + * either be pods that are running but not yet available or pods that still have not been created. + * +optional + */ + unavailableReplicas?: number | undefined; + /** + * Total number of terminating pods targeted by this deployment. Terminating pods have a non-null + * .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase. + * + * This is a beta field and requires enabling DeploymentReplicaSetTerminatingReplicas feature (enabled by default). + * +optional + */ + terminatingReplicas?: number | undefined; + /** + * Represents the latest available observations of a deployment's current state. + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: DeploymentCondition[]; + /** + * Count of hash collisions for the Deployment. The Deployment controller uses this + * field as a collision avoidance mechanism when it needs to create the name for the + * newest ReplicaSet. + * +optional + */ + collisionCount?: number | undefined; +} + +/** DeploymentStrategy describes how to replace existing pods with new ones. */ +export interface DeploymentStrategy { + /** + * Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate. + * +optional + */ + type?: string | undefined; + /** + * Rolling update config params. Present only if DeploymentStrategyType = + * RollingUpdate. + * --- + * TODO: Update this to follow our convention for oneOf, whatever we decide it + * to be. + * +optional + */ + rollingUpdate?: RollingUpdateDeployment | undefined; +} + +/** + * ReplicaSet ensures that a specified number of pod replicas are running at any given time. + * +k8s:supportsSubresource="/scale" + * +k8s:supportsSubresource="/status" + */ +export interface ReplicaSet { + /** + * If the Labels of a ReplicaSet are empty, they are defaulted to + * be the same as the Pod(s) that the ReplicaSet manages. + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Spec defines the specification of the desired behavior of the ReplicaSet. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +required + */ + spec?: ReplicaSetSpec | undefined; + /** + * Status is the most recently observed status of the ReplicaSet. + * This data may be out of date by some window of time. + * Populated by the system. + * Read-only. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: ReplicaSetStatus | undefined; +} + +/** ReplicaSetCondition describes the state of a replica set at a certain point. */ +export interface ReplicaSetCondition { + /** + * Type of replica set condition. + * +optional + */ + type?: string | undefined; + /** + * Status of the condition, one of True, False, Unknown. + * +optional + */ + status?: string | undefined; + /** + * The last time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * The reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * A human readable message indicating details about the transition. + * +optional + */ + message?: string | undefined; +} + +/** ReplicaSetList is a collection of ReplicaSets. */ +export interface ReplicaSetList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** + * List of ReplicaSets. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset + */ + items: ReplicaSet[]; +} + +/** ReplicaSetSpec is the specification of a ReplicaSet. */ +export interface ReplicaSetSpec { + /** + * Replicas is the number of desired pods. + * This is a pointer to distinguish between explicit zero and unspecified. + * Defaults to 1. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset + * +optional + */ + replicas?: number | undefined; + /** + * Minimum number of seconds for which a newly created pod should be ready + * without any of its container crashing, for it to be considered available. + * Defaults to 0 (pod will be considered available as soon as it is ready) + * +optional + */ + minReadySeconds?: number | undefined; + /** + * Selector is a label query over pods that should match the replica count. + * Label keys and values that must match in order to be controlled by this replica set. + * It must match the pod template's labels. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + * +required + */ + selector?: LabelSelector | undefined; + /** + * Template is the object that describes the pod that will be created if + * insufficient replicas are detected. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/#pod-template + * +optional + */ + template?: PodTemplateSpec | undefined; +} + +/** ReplicaSetStatus represents the current status of a ReplicaSet. */ +export interface ReplicaSetStatus { + /** + * Replicas is the most recently observed number of non-terminating pods. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset + */ + replicas?: number | undefined; + /** + * The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset. + * +optional + */ + fullyLabeledReplicas?: number | undefined; + /** + * The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition. + * +optional + */ + readyReplicas?: number | undefined; + /** + * The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set. + * +optional + */ + availableReplicas?: number | undefined; + /** + * The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp + * and have not yet reached the Failed or Succeeded .status.phase. + * + * This is a beta field and requires enabling DeploymentReplicaSetTerminatingReplicas feature (enabled by default). + * +optional + */ + terminatingReplicas?: number | undefined; + /** + * ObservedGeneration reflects the generation of the most recently observed ReplicaSet. + * +optional + */ + observedGeneration?: number | undefined; + /** + * Represents the latest available observations of a replica set's current state. + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: ReplicaSetCondition[]; +} + +/** Spec to control the desired behavior of daemon set rolling update. */ +export interface RollingUpdateDaemonSet { + /** + * The maximum number of DaemonSet pods that can be unavailable during the + * update. Value can be an absolute number (ex: 5) or a percentage of total + * number of DaemonSet pods at the start of the update (ex: 10%). Absolute + * number is calculated from percentage by rounding up. + * This cannot be 0 if MaxSurge is 0 + * Default value is 1. + * Example: when this is set to 30%, at most 30% of the total number of nodes + * that should be running the daemon pod (i.e. status.desiredNumberScheduled) + * can have their pods stopped for an update at any given time. The update + * starts by stopping at most 30% of those DaemonSet pods and then brings + * up new DaemonSet pods in their place. Once the new pods are available, + * it then proceeds onto other DaemonSet pods, thus ensuring that at least + * 70% of original number of DaemonSet pods are available at all times during + * the update. + * +optional + */ + maxUnavailable?: IntOrString | undefined; + /** + * The maximum number of nodes with an existing available DaemonSet pod that + * can have an updated DaemonSet pod during during an update. + * Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). + * This can not be 0 if MaxUnavailable is 0. + * Absolute number is calculated from percentage by rounding up to a minimum of 1. + * Default value is 0. + * Example: when this is set to 30%, at most 30% of the total number of nodes + * that should be running the daemon pod (i.e. status.desiredNumberScheduled) + * can have their a new pod created before the old pod is marked as deleted. + * The update starts by launching new pods on 30% of nodes. Once an updated + * pod is available (Ready for at least minReadySeconds) the old DaemonSet pod + * on that node is marked deleted. If the old pod becomes unavailable for any + * reason (Ready transitions to false, is evicted, or is drained) an updated + * pod is immediately created on that node without considering surge limits. + * Allowing surge implies the possibility that the resources consumed by the + * daemonset on any given node can double if the readiness check fails, and + * so resource intensive daemonsets should take into account that they may + * cause evictions during disruption. + * +optional + */ + maxSurge?: IntOrString | undefined; +} + +/** Spec to control the desired behavior of rolling update. */ +export interface RollingUpdateDeployment { + /** + * The maximum number of pods that can be unavailable during the update. + * Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). + * Absolute number is calculated from percentage by rounding down. + * This can not be 0 if MaxSurge is 0. + * Defaults to 25%. + * Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods + * immediately when the rolling update starts. Once new pods are ready, old ReplicaSet + * can be scaled down further, followed by scaling up the new ReplicaSet, ensuring + * that the total number of pods available at all times during the update is at + * least 70% of desired pods. + * +optional + */ + maxUnavailable?: IntOrString | undefined; + /** + * The maximum number of pods that can be scheduled above the desired number of + * pods. + * Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). + * This can not be 0 if MaxUnavailable is 0. + * Absolute number is calculated from percentage by rounding up. + * Defaults to 25%. + * Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when + * the rolling update starts, such that the total number of old and new pods do not exceed + * 130% of desired pods. Once old pods have been killed, + * new ReplicaSet can be scaled up further, ensuring that total number of pods running + * at any time during the update is at most 130% of desired pods. + * +optional + */ + maxSurge?: IntOrString | undefined; +} + +/** RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType. */ +export interface RollingUpdateStatefulSetStrategy { + /** + * Partition indicates the ordinal at which the StatefulSet should be partitioned + * for updates. During a rolling update, all pods from ordinal Replicas-1 to + * Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched. + * This is helpful in being able to do a canary based deployment. The default value is 0. + * +optional + */ + partition?: number | undefined; + /** + * The maximum number of pods that can be unavailable during the update. + * Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). + * Absolute number is calculated from percentage by rounding up. This can not be 0. + * Defaults to 1. This field is beta-level and is enabled by default. The field applies to all pods in the range 0 to + * Replicas-1. That means if there is any unavailable pod in the range 0 to Replicas-1, it + * will be counted towards MaxUnavailable. + * This setting might not be effective for the OrderedReady podManagementPolicy. That policy ensures pods are created and become ready one at a time. + * + * +featureGate=MaxUnavailableStatefulSet + * +optional + */ + maxUnavailable?: IntOrString | undefined; +} + +/** + * StatefulSet represents a set of pods with consistent identities. + * Identities are defined as: + * - Network: A single stable DNS and hostname. + * - Storage: As many VolumeClaims as requested. + * + * The StatefulSet guarantees that a given network identity will always + * map to the same storage identity. + * +k8s:supportsSubresource="/scale" + * +k8s:supportsSubresource="/status" + */ +export interface StatefulSet { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Spec defines the desired identities of pods in this set. + * +required + */ + spec?: StatefulSetSpec | undefined; + /** + * Status is the current status of Pods in this StatefulSet. This data + * may be out of date by some window of time. + * +optional + */ + status?: StatefulSetStatus | undefined; +} + +/** StatefulSetCondition describes the state of a statefulset at a certain point. */ +export interface StatefulSetCondition { + /** + * Type of statefulset condition. + * +optional + */ + type?: string | undefined; + /** + * Status of the condition, one of True, False, Unknown. + * +optional + */ + status?: string | undefined; + /** + * Last time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * The reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * A human readable message indicating details about the transition. + * +optional + */ + message?: string | undefined; +} + +/** StatefulSetList is a collection of StatefulSets. */ +export interface StatefulSetList { + /** + * Standard list's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is the list of stateful sets. */ + items: StatefulSet[]; +} + +/** + * StatefulSetOrdinals describes the policy used for replica ordinal assignment + * in this StatefulSet. + */ +export interface StatefulSetOrdinals { + /** + * start is the number representing the first replica's index. It may be used + * to number replicas from an alternate index (eg: 1-indexed) over the default + * 0-indexed names, or to orchestrate progressive movement of replicas from + * one StatefulSet to another. + * If set, replica indices will be in the range: + * [.spec.ordinals.start, .spec.ordinals.start + .spec.replicas). + * If unset, defaults to 0. Replica indices will be in the range: + * [0, .spec.replicas). + * +optional + */ + start?: number | undefined; +} + +/** + * StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs + * created from the StatefulSet VolumeClaimTemplates. + */ +export interface StatefulSetPersistentVolumeClaimRetentionPolicy { + /** + * WhenDeleted specifies what happens to PVCs created from StatefulSet + * VolumeClaimTemplates when the StatefulSet is deleted. The default policy + * of `Retain` causes PVCs to not be affected by StatefulSet deletion. The + * `Delete` policy causes those PVCs to be deleted. + * +optional + */ + whenDeleted?: string | undefined; + /** + * WhenScaled specifies what happens to PVCs created from StatefulSet + * VolumeClaimTemplates when the StatefulSet is scaled down. The default + * policy of `Retain` causes PVCs to not be affected by a scaledown. The + * `Delete` policy causes the associated PVCs for any excess pods above + * the replica count to be deleted. + * +optional + */ + whenScaled?: string | undefined; +} + +/** A StatefulSetSpec is the specification of a StatefulSet. */ +export interface StatefulSetSpec { + /** + * replicas is the desired number of replicas of the given Template. + * These are replicas in the sense that they are instantiations of the + * same Template, but individual replicas also have a consistent identity. + * If unspecified, defaults to 1. + * TODO: Consider a rename of this field. + * +optional + */ + replicas?: number | undefined; + /** + * selector is a label query over pods that should match the replica count. + * It must match the pod template's labels. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + * +required + * +k8s:alpha(since: "1.37")=+k8s:required + * +k8s:alpha(since: "1.37")=+k8s:immutable + */ + selector?: LabelSelector | undefined; + /** + * template is the object that describes the pod that will be created if + * insufficient replicas are detected. Each pod stamped out by the StatefulSet + * will fulfill this Template, but have a unique identity from the rest + * of the StatefulSet. Each pod will be named with the format + * -. For example, a pod in a StatefulSet named + * "web" with index number "3" would be named "web-3". + * The only allowed template.spec.restartPolicy value is "Always". + * +required + */ + template?: PodTemplateSpec | undefined; + /** + * volumeClaimTemplates is a list of claims that pods are allowed to reference. + * The StatefulSet controller is responsible for mapping network identities to + * claims in a way that maintains the identity of a pod. Every claim in + * this list must have at least one matching (by name) volumeMount in one + * container in the template. A claim in this list takes precedence over + * any volumes in the template, with the same name. + * TODO: Define the behavior if a claim already exists with the same name. + * +optional + * +k8s:alpha(since: "1.37")=+k8s:immutable + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType + * +listType=atomic + */ + volumeClaimTemplates: PersistentVolumeClaim[]; + /** + * serviceName is the name of the service that governs this StatefulSet. + * This service must exist before the StatefulSet, and is responsible for + * the network identity of the set. Pods get DNS/hostnames that follow the + * pattern: pod-specific-string.serviceName.default.svc.cluster.local + * where "pod-specific-string" is managed by the StatefulSet controller. + * +optional + * +k8s:alpha(since: "1.37")=+k8s:immutable + * +k8s:alpha(since: "1.37")=+k8s:optional + */ + serviceName?: string | undefined; + /** + * podManagementPolicy controls how pods are created during initial scale up, + * when replacing pods on nodes, or when scaling down. The default policy is + * `OrderedReady`, where pods are created in increasing order (pod-0, then + * pod-1, etc) and the controller will wait until each pod is ready before + * continuing. When scaling down, the pods are removed in the opposite order. + * The alternative policy is `Parallel` which will create pods in parallel + * to match the desired scale without waiting, and on scale down will delete + * all pods at once. + * +optional + * +k8s:alpha(since: "1.37")=+k8s:immutable + * +k8s:alpha(since: "1.37")=+k8s:optional + */ + podManagementPolicy?: string | undefined; + /** + * updateStrategy indicates the StatefulSetUpdateStrategy that will be + * employed to update Pods in the StatefulSet when a revision is made to + * Template. + * +optional + */ + updateStrategy?: StatefulSetUpdateStrategy | undefined; + /** + * revisionHistoryLimit is the maximum number of revisions that will + * be maintained in the StatefulSet's revision history. The revision history + * consists of all revisions not represented by a currently applied + * StatefulSetSpec version. The default value is 10. + * +optional + */ + revisionHistoryLimit?: number | undefined; + /** + * Minimum number of seconds for which a newly created pod should be ready + * without any of its container crashing for it to be considered available. + * Defaults to 0 (pod will be considered available as soon as it is ready) + * +optional + */ + minReadySeconds?: number | undefined; + /** + * persistentVolumeClaimRetentionPolicy describes the lifecycle of persistent + * volume claims created from volumeClaimTemplates. By default, all persistent + * volume claims are created as needed and retained until manually deleted. This + * policy allows the lifecycle to be altered, for example by deleting persistent + * volume claims when their stateful set is deleted, or when their pod is scaled + * down. + * +optional + */ + persistentVolumeClaimRetentionPolicy?: StatefulSetPersistentVolumeClaimRetentionPolicy | undefined; + /** + * ordinals controls the numbering of replica indices in a StatefulSet. The + * default ordinals behavior assigns a "0" index to the first replica and + * increments the index by one for each additional replica requested. + * +optional + */ + ordinals?: StatefulSetOrdinals | undefined; +} + +/** StatefulSetStatus represents the current state of a StatefulSet. */ +export interface StatefulSetStatus { + /** + * observedGeneration is the most recent generation observed for this StatefulSet. It corresponds to the + * StatefulSet's generation, which is updated on mutation by the API Server. + * +optional + */ + observedGeneration?: number | undefined; + /** replicas is the number of Pods created by the StatefulSet controller. */ + replicas?: number | undefined; + /** readyReplicas is the number of pods created for this StatefulSet with a Ready Condition. */ + readyReplicas?: number | undefined; + /** + * currentReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version + * indicated by currentRevision. + */ + currentReplicas?: number | undefined; + /** + * updatedReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version + * indicated by updateRevision. + */ + updatedReplicas?: number | undefined; + /** + * currentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the + * sequence [0,currentReplicas). + */ + currentRevision?: string | undefined; + /** + * updateRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence + * [replicas-updatedReplicas,replicas) + */ + updateRevision?: string | undefined; + /** + * collisionCount is the count of hash collisions for the StatefulSet. The StatefulSet controller + * uses this field as a collision avoidance mechanism when it needs to create the name for the + * newest ControllerRevision. + * +optional + */ + collisionCount?: number | undefined; + /** + * Represents the latest available observations of a statefulset's current state. + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: StatefulSetCondition[]; + /** + * Total number of available pods (ready for at least minReadySeconds) targeted by this statefulset. + * +optional + */ + availableReplicas?: number | undefined; +} + +/** + * StatefulSetUpdateStrategy indicates the strategy that the StatefulSet + * controller will use to perform updates. It includes any additional parameters + * necessary to perform the update for the indicated strategy. + */ +export interface StatefulSetUpdateStrategy { + /** + * Type indicates the type of the StatefulSetUpdateStrategy. + * Default is RollingUpdate. + * +optional + */ + type?: string | undefined; + /** + * RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType. + * +optional + */ + rollingUpdate?: RollingUpdateStatefulSetStrategy | undefined; +} + +function createBaseControllerRevision(): ControllerRevision { + return { metadata: undefined, data: undefined, revision: 0 }; +} + +export const ControllerRevision: MessageFns = { + encode(message: ControllerRevision, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + RawExtension.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.revision !== undefined && message.revision !== 0) { + writer.uint32(24).int64(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ControllerRevision { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseControllerRevision(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.data = RawExtension.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.revision = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ControllerRevision { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + data: isSet(object.data) ? RawExtension.fromJSON(object.data) : undefined, + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: ControllerRevision): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.data !== undefined) { + obj.data = RawExtension.toJSON(message.data); + } + if (message.revision !== undefined && message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): ControllerRevision { + return ControllerRevision.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ControllerRevision { + const message = createBaseControllerRevision(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.data = + object.data !== undefined && object.data !== null + ? RawExtension.fromPartial(object.data) + : undefined; + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseControllerRevisionList(): ControllerRevisionList { + return { metadata: undefined, items: [] }; +} + +export const ControllerRevisionList: MessageFns = { + encode(message: ControllerRevisionList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ControllerRevision.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ControllerRevisionList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseControllerRevisionList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ControllerRevision.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ControllerRevisionList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ControllerRevision.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ControllerRevisionList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ControllerRevision.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ControllerRevisionList { + return ControllerRevisionList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ControllerRevisionList { + const message = createBaseControllerRevisionList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ControllerRevision.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDaemonSet(): DaemonSet { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const DaemonSet: MessageFns = { + encode(message: DaemonSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + DaemonSetSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + DaemonSetStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = DaemonSetSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = DaemonSetStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonSet { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? DaemonSetSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? DaemonSetStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: DaemonSet): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = DaemonSetSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = DaemonSetStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): DaemonSet { + return DaemonSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DaemonSet { + const message = createBaseDaemonSet(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? DaemonSetSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? DaemonSetStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseDaemonSetCondition(): DaemonSetCondition { + return { type: '', status: '', lastTransitionTime: undefined, reason: '', message: '' }; +} + +export const DaemonSetCondition: MessageFns = { + encode(message: DaemonSetCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(26).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(42).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonSetCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonSetCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonSetCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: DaemonSetCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): DaemonSetCondition { + return DaemonSetCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DaemonSetCondition { + const message = createBaseDaemonSetCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseDaemonSetList(): DaemonSetList { + return { metadata: undefined, items: [] }; +} + +export const DaemonSetList: MessageFns = { + encode(message: DaemonSetList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + DaemonSet.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonSetList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonSetList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(DaemonSet.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonSetList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => DaemonSet.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DaemonSetList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => DaemonSet.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DaemonSetList { + return DaemonSetList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DaemonSetList { + const message = createBaseDaemonSetList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => DaemonSet.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDaemonSetSpec(): DaemonSetSpec { + return { + selector: undefined, + template: undefined, + updateStrategy: undefined, + minReadySeconds: 0, + revisionHistoryLimit: 0, + }; +} + +export const DaemonSetSpec: MessageFns = { + encode(message: DaemonSetSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(10).fork()).join(); + } + if (message.template !== undefined) { + PodTemplateSpec.encode(message.template, writer.uint32(18).fork()).join(); + } + if (message.updateStrategy !== undefined) { + DaemonSetUpdateStrategy.encode(message.updateStrategy, writer.uint32(26).fork()).join(); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + writer.uint32(32).int32(message.minReadySeconds); + } + if (message.revisionHistoryLimit !== undefined && message.revisionHistoryLimit !== 0) { + writer.uint32(48).int32(message.revisionHistoryLimit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonSetSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonSetSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.template = PodTemplateSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.updateStrategy = DaemonSetUpdateStrategy.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.minReadySeconds = reader.int32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.revisionHistoryLimit = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonSetSpec { + return { + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + template: isSet(object.template) ? PodTemplateSpec.fromJSON(object.template) : undefined, + updateStrategy: isSet(object.updateStrategy) + ? DaemonSetUpdateStrategy.fromJSON(object.updateStrategy) + : undefined, + minReadySeconds: isSet(object.minReadySeconds) ? globalThis.Number(object.minReadySeconds) : 0, + revisionHistoryLimit: isSet(object.revisionHistoryLimit) + ? globalThis.Number(object.revisionHistoryLimit) + : 0, + }; + }, + + toJSON(message: DaemonSetSpec): unknown { + const obj: any = {}; + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.template !== undefined) { + obj.template = PodTemplateSpec.toJSON(message.template); + } + if (message.updateStrategy !== undefined) { + obj.updateStrategy = DaemonSetUpdateStrategy.toJSON(message.updateStrategy); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + obj.minReadySeconds = Math.round(message.minReadySeconds); + } + if (message.revisionHistoryLimit !== undefined && message.revisionHistoryLimit !== 0) { + obj.revisionHistoryLimit = Math.round(message.revisionHistoryLimit); + } + return obj; + }, + + create, I>>(base?: I): DaemonSetSpec { + return DaemonSetSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DaemonSetSpec { + const message = createBaseDaemonSetSpec(); + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.template = + object.template !== undefined && object.template !== null + ? PodTemplateSpec.fromPartial(object.template) + : undefined; + message.updateStrategy = + object.updateStrategy !== undefined && object.updateStrategy !== null + ? DaemonSetUpdateStrategy.fromPartial(object.updateStrategy) + : undefined; + message.minReadySeconds = object.minReadySeconds ?? 0; + message.revisionHistoryLimit = object.revisionHistoryLimit ?? 0; + return message; + }, +}; + +function createBaseDaemonSetStatus(): DaemonSetStatus { + return { + currentNumberScheduled: 0, + numberMisscheduled: 0, + desiredNumberScheduled: 0, + numberReady: 0, + observedGeneration: 0, + updatedNumberScheduled: 0, + numberAvailable: 0, + numberUnavailable: 0, + collisionCount: 0, + conditions: [], + }; +} + +export const DaemonSetStatus: MessageFns = { + encode(message: DaemonSetStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.currentNumberScheduled !== undefined && message.currentNumberScheduled !== 0) { + writer.uint32(8).int32(message.currentNumberScheduled); + } + if (message.numberMisscheduled !== undefined && message.numberMisscheduled !== 0) { + writer.uint32(16).int32(message.numberMisscheduled); + } + if (message.desiredNumberScheduled !== undefined && message.desiredNumberScheduled !== 0) { + writer.uint32(24).int32(message.desiredNumberScheduled); + } + if (message.numberReady !== undefined && message.numberReady !== 0) { + writer.uint32(32).int32(message.numberReady); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(40).int64(message.observedGeneration); + } + if (message.updatedNumberScheduled !== undefined && message.updatedNumberScheduled !== 0) { + writer.uint32(48).int32(message.updatedNumberScheduled); + } + if (message.numberAvailable !== undefined && message.numberAvailable !== 0) { + writer.uint32(56).int32(message.numberAvailable); + } + if (message.numberUnavailable !== undefined && message.numberUnavailable !== 0) { + writer.uint32(64).int32(message.numberUnavailable); + } + if (message.collisionCount !== undefined && message.collisionCount !== 0) { + writer.uint32(72).int32(message.collisionCount); + } + for (const v of message.conditions) { + DaemonSetCondition.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonSetStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonSetStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.currentNumberScheduled = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.numberMisscheduled = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.desiredNumberScheduled = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.numberReady = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.updatedNumberScheduled = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.numberAvailable = reader.int32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.numberUnavailable = reader.int32(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.collisionCount = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.conditions.push(DaemonSetCondition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonSetStatus { + return { + currentNumberScheduled: isSet(object.currentNumberScheduled) + ? globalThis.Number(object.currentNumberScheduled) + : 0, + numberMisscheduled: isSet(object.numberMisscheduled) + ? globalThis.Number(object.numberMisscheduled) + : 0, + desiredNumberScheduled: isSet(object.desiredNumberScheduled) + ? globalThis.Number(object.desiredNumberScheduled) + : 0, + numberReady: isSet(object.numberReady) ? globalThis.Number(object.numberReady) : 0, + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + updatedNumberScheduled: isSet(object.updatedNumberScheduled) + ? globalThis.Number(object.updatedNumberScheduled) + : 0, + numberAvailable: isSet(object.numberAvailable) ? globalThis.Number(object.numberAvailable) : 0, + numberUnavailable: isSet(object.numberUnavailable) + ? globalThis.Number(object.numberUnavailable) + : 0, + collisionCount: isSet(object.collisionCount) ? globalThis.Number(object.collisionCount) : 0, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => DaemonSetCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DaemonSetStatus): unknown { + const obj: any = {}; + if (message.currentNumberScheduled !== undefined && message.currentNumberScheduled !== 0) { + obj.currentNumberScheduled = Math.round(message.currentNumberScheduled); + } + if (message.numberMisscheduled !== undefined && message.numberMisscheduled !== 0) { + obj.numberMisscheduled = Math.round(message.numberMisscheduled); + } + if (message.desiredNumberScheduled !== undefined && message.desiredNumberScheduled !== 0) { + obj.desiredNumberScheduled = Math.round(message.desiredNumberScheduled); + } + if (message.numberReady !== undefined && message.numberReady !== 0) { + obj.numberReady = Math.round(message.numberReady); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.updatedNumberScheduled !== undefined && message.updatedNumberScheduled !== 0) { + obj.updatedNumberScheduled = Math.round(message.updatedNumberScheduled); + } + if (message.numberAvailable !== undefined && message.numberAvailable !== 0) { + obj.numberAvailable = Math.round(message.numberAvailable); + } + if (message.numberUnavailable !== undefined && message.numberUnavailable !== 0) { + obj.numberUnavailable = Math.round(message.numberUnavailable); + } + if (message.collisionCount !== undefined && message.collisionCount !== 0) { + obj.collisionCount = Math.round(message.collisionCount); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => DaemonSetCondition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DaemonSetStatus { + return DaemonSetStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DaemonSetStatus { + const message = createBaseDaemonSetStatus(); + message.currentNumberScheduled = object.currentNumberScheduled ?? 0; + message.numberMisscheduled = object.numberMisscheduled ?? 0; + message.desiredNumberScheduled = object.desiredNumberScheduled ?? 0; + message.numberReady = object.numberReady ?? 0; + message.observedGeneration = object.observedGeneration ?? 0; + message.updatedNumberScheduled = object.updatedNumberScheduled ?? 0; + message.numberAvailable = object.numberAvailable ?? 0; + message.numberUnavailable = object.numberUnavailable ?? 0; + message.collisionCount = object.collisionCount ?? 0; + message.conditions = object.conditions?.map((e) => DaemonSetCondition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDaemonSetUpdateStrategy(): DaemonSetUpdateStrategy { + return { type: '', rollingUpdate: undefined }; +} + +export const DaemonSetUpdateStrategy: MessageFns = { + encode(message: DaemonSetUpdateStrategy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.rollingUpdate !== undefined) { + RollingUpdateDaemonSet.encode(message.rollingUpdate, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonSetUpdateStrategy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonSetUpdateStrategy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.rollingUpdate = RollingUpdateDaemonSet.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonSetUpdateStrategy { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + rollingUpdate: isSet(object.rollingUpdate) + ? RollingUpdateDaemonSet.fromJSON(object.rollingUpdate) + : undefined, + }; + }, + + toJSON(message: DaemonSetUpdateStrategy): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.rollingUpdate !== undefined) { + obj.rollingUpdate = RollingUpdateDaemonSet.toJSON(message.rollingUpdate); + } + return obj; + }, + + create, I>>(base?: I): DaemonSetUpdateStrategy { + return DaemonSetUpdateStrategy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): DaemonSetUpdateStrategy { + const message = createBaseDaemonSetUpdateStrategy(); + message.type = object.type ?? ''; + message.rollingUpdate = + object.rollingUpdate !== undefined && object.rollingUpdate !== null + ? RollingUpdateDaemonSet.fromPartial(object.rollingUpdate) + : undefined; + return message; + }, +}; + +function createBaseDeployment(): Deployment { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const Deployment: MessageFns = { + encode(message: Deployment, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + DeploymentSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + DeploymentStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deployment { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeployment(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = DeploymentSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = DeploymentStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Deployment { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? DeploymentSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? DeploymentStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: Deployment): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = DeploymentSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = DeploymentStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): Deployment { + return Deployment.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Deployment { + const message = createBaseDeployment(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? DeploymentSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? DeploymentStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseDeploymentCondition(): DeploymentCondition { + return { + type: '', + status: '', + lastUpdateTime: undefined, + lastTransitionTime: undefined, + reason: '', + message: '', + }; +} + +export const DeploymentCondition: MessageFns = { + encode(message: DeploymentCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastUpdateTime !== undefined) { + Time.encode(message.lastUpdateTime, writer.uint32(50).fork()).join(); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(58).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(42).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeploymentCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeploymentCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.lastUpdateTime = Time.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeploymentCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastUpdateTime: isSet(object.lastUpdateTime) ? Time.fromJSON(object.lastUpdateTime) : undefined, + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: DeploymentCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastUpdateTime !== undefined) { + obj.lastUpdateTime = Time.toJSON(message.lastUpdateTime); + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): DeploymentCondition { + return DeploymentCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeploymentCondition { + const message = createBaseDeploymentCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastUpdateTime = + object.lastUpdateTime !== undefined && object.lastUpdateTime !== null + ? Time.fromPartial(object.lastUpdateTime) + : undefined; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseDeploymentList(): DeploymentList { + return { metadata: undefined, items: [] }; +} + +export const DeploymentList: MessageFns = { + encode(message: DeploymentList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Deployment.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeploymentList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeploymentList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Deployment.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeploymentList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Deployment.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DeploymentList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Deployment.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DeploymentList { + return DeploymentList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeploymentList { + const message = createBaseDeploymentList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Deployment.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDeploymentSpec(): DeploymentSpec { + return { + replicas: 0, + selector: undefined, + template: undefined, + strategy: undefined, + minReadySeconds: 0, + revisionHistoryLimit: 0, + paused: false, + progressDeadlineSeconds: 0, + }; +} + +export const DeploymentSpec: MessageFns = { + encode(message: DeploymentSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(18).fork()).join(); + } + if (message.template !== undefined) { + PodTemplateSpec.encode(message.template, writer.uint32(26).fork()).join(); + } + if (message.strategy !== undefined) { + DeploymentStrategy.encode(message.strategy, writer.uint32(34).fork()).join(); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + writer.uint32(40).int32(message.minReadySeconds); + } + if (message.revisionHistoryLimit !== undefined && message.revisionHistoryLimit !== 0) { + writer.uint32(48).int32(message.revisionHistoryLimit); + } + if (message.paused !== undefined && message.paused !== false) { + writer.uint32(56).bool(message.paused); + } + if (message.progressDeadlineSeconds !== undefined && message.progressDeadlineSeconds !== 0) { + writer.uint32(72).int32(message.progressDeadlineSeconds); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeploymentSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeploymentSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.template = PodTemplateSpec.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.strategy = DeploymentStrategy.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.minReadySeconds = reader.int32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.revisionHistoryLimit = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.paused = reader.bool(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.progressDeadlineSeconds = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeploymentSpec { + return { + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + template: isSet(object.template) ? PodTemplateSpec.fromJSON(object.template) : undefined, + strategy: isSet(object.strategy) ? DeploymentStrategy.fromJSON(object.strategy) : undefined, + minReadySeconds: isSet(object.minReadySeconds) ? globalThis.Number(object.minReadySeconds) : 0, + revisionHistoryLimit: isSet(object.revisionHistoryLimit) + ? globalThis.Number(object.revisionHistoryLimit) + : 0, + paused: isSet(object.paused) ? globalThis.Boolean(object.paused) : false, + progressDeadlineSeconds: isSet(object.progressDeadlineSeconds) + ? globalThis.Number(object.progressDeadlineSeconds) + : 0, + }; + }, + + toJSON(message: DeploymentSpec): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.template !== undefined) { + obj.template = PodTemplateSpec.toJSON(message.template); + } + if (message.strategy !== undefined) { + obj.strategy = DeploymentStrategy.toJSON(message.strategy); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + obj.minReadySeconds = Math.round(message.minReadySeconds); + } + if (message.revisionHistoryLimit !== undefined && message.revisionHistoryLimit !== 0) { + obj.revisionHistoryLimit = Math.round(message.revisionHistoryLimit); + } + if (message.paused !== undefined && message.paused !== false) { + obj.paused = message.paused; + } + if (message.progressDeadlineSeconds !== undefined && message.progressDeadlineSeconds !== 0) { + obj.progressDeadlineSeconds = Math.round(message.progressDeadlineSeconds); + } + return obj; + }, + + create, I>>(base?: I): DeploymentSpec { + return DeploymentSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeploymentSpec { + const message = createBaseDeploymentSpec(); + message.replicas = object.replicas ?? 0; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.template = + object.template !== undefined && object.template !== null + ? PodTemplateSpec.fromPartial(object.template) + : undefined; + message.strategy = + object.strategy !== undefined && object.strategy !== null + ? DeploymentStrategy.fromPartial(object.strategy) + : undefined; + message.minReadySeconds = object.minReadySeconds ?? 0; + message.revisionHistoryLimit = object.revisionHistoryLimit ?? 0; + message.paused = object.paused ?? false; + message.progressDeadlineSeconds = object.progressDeadlineSeconds ?? 0; + return message; + }, +}; + +function createBaseDeploymentStatus(): DeploymentStatus { + return { + observedGeneration: 0, + replicas: 0, + updatedReplicas: 0, + readyReplicas: 0, + availableReplicas: 0, + unavailableReplicas: 0, + terminatingReplicas: 0, + conditions: [], + collisionCount: 0, + }; +} + +export const DeploymentStatus: MessageFns = { + encode(message: DeploymentStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(8).int64(message.observedGeneration); + } + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(16).int32(message.replicas); + } + if (message.updatedReplicas !== undefined && message.updatedReplicas !== 0) { + writer.uint32(24).int32(message.updatedReplicas); + } + if (message.readyReplicas !== undefined && message.readyReplicas !== 0) { + writer.uint32(56).int32(message.readyReplicas); + } + if (message.availableReplicas !== undefined && message.availableReplicas !== 0) { + writer.uint32(32).int32(message.availableReplicas); + } + if (message.unavailableReplicas !== undefined && message.unavailableReplicas !== 0) { + writer.uint32(40).int32(message.unavailableReplicas); + } + if (message.terminatingReplicas !== undefined && message.terminatingReplicas !== 0) { + writer.uint32(72).int32(message.terminatingReplicas); + } + for (const v of message.conditions) { + DeploymentCondition.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.collisionCount !== undefined && message.collisionCount !== 0) { + writer.uint32(64).int32(message.collisionCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeploymentStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeploymentStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.updatedReplicas = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.readyReplicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.availableReplicas = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.unavailableReplicas = reader.int32(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.terminatingReplicas = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.conditions.push(DeploymentCondition.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.collisionCount = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeploymentStatus { + return { + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + updatedReplicas: isSet(object.updatedReplicas) ? globalThis.Number(object.updatedReplicas) : 0, + readyReplicas: isSet(object.readyReplicas) ? globalThis.Number(object.readyReplicas) : 0, + availableReplicas: isSet(object.availableReplicas) + ? globalThis.Number(object.availableReplicas) + : 0, + unavailableReplicas: isSet(object.unavailableReplicas) + ? globalThis.Number(object.unavailableReplicas) + : 0, + terminatingReplicas: isSet(object.terminatingReplicas) + ? globalThis.Number(object.terminatingReplicas) + : 0, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => DeploymentCondition.fromJSON(e)) + : [], + collisionCount: isSet(object.collisionCount) ? globalThis.Number(object.collisionCount) : 0, + }; + }, + + toJSON(message: DeploymentStatus): unknown { + const obj: any = {}; + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.updatedReplicas !== undefined && message.updatedReplicas !== 0) { + obj.updatedReplicas = Math.round(message.updatedReplicas); + } + if (message.readyReplicas !== undefined && message.readyReplicas !== 0) { + obj.readyReplicas = Math.round(message.readyReplicas); + } + if (message.availableReplicas !== undefined && message.availableReplicas !== 0) { + obj.availableReplicas = Math.round(message.availableReplicas); + } + if (message.unavailableReplicas !== undefined && message.unavailableReplicas !== 0) { + obj.unavailableReplicas = Math.round(message.unavailableReplicas); + } + if (message.terminatingReplicas !== undefined && message.terminatingReplicas !== 0) { + obj.terminatingReplicas = Math.round(message.terminatingReplicas); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => DeploymentCondition.toJSON(e)); + } + if (message.collisionCount !== undefined && message.collisionCount !== 0) { + obj.collisionCount = Math.round(message.collisionCount); + } + return obj; + }, + + create, I>>(base?: I): DeploymentStatus { + return DeploymentStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeploymentStatus { + const message = createBaseDeploymentStatus(); + message.observedGeneration = object.observedGeneration ?? 0; + message.replicas = object.replicas ?? 0; + message.updatedReplicas = object.updatedReplicas ?? 0; + message.readyReplicas = object.readyReplicas ?? 0; + message.availableReplicas = object.availableReplicas ?? 0; + message.unavailableReplicas = object.unavailableReplicas ?? 0; + message.terminatingReplicas = object.terminatingReplicas ?? 0; + message.conditions = object.conditions?.map((e) => DeploymentCondition.fromPartial(e)) || []; + message.collisionCount = object.collisionCount ?? 0; + return message; + }, +}; + +function createBaseDeploymentStrategy(): DeploymentStrategy { + return { type: '', rollingUpdate: undefined }; +} + +export const DeploymentStrategy: MessageFns = { + encode(message: DeploymentStrategy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.rollingUpdate !== undefined) { + RollingUpdateDeployment.encode(message.rollingUpdate, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeploymentStrategy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeploymentStrategy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.rollingUpdate = RollingUpdateDeployment.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeploymentStrategy { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + rollingUpdate: isSet(object.rollingUpdate) + ? RollingUpdateDeployment.fromJSON(object.rollingUpdate) + : undefined, + }; + }, + + toJSON(message: DeploymentStrategy): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.rollingUpdate !== undefined) { + obj.rollingUpdate = RollingUpdateDeployment.toJSON(message.rollingUpdate); + } + return obj; + }, + + create, I>>(base?: I): DeploymentStrategy { + return DeploymentStrategy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeploymentStrategy { + const message = createBaseDeploymentStrategy(); + message.type = object.type ?? ''; + message.rollingUpdate = + object.rollingUpdate !== undefined && object.rollingUpdate !== null + ? RollingUpdateDeployment.fromPartial(object.rollingUpdate) + : undefined; + return message; + }, +}; + +function createBaseReplicaSet(): ReplicaSet { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const ReplicaSet: MessageFns = { + encode(message: ReplicaSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + ReplicaSetSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + ReplicaSetStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicaSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicaSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = ReplicaSetSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = ReplicaSetStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicaSet { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? ReplicaSetSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? ReplicaSetStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: ReplicaSet): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = ReplicaSetSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = ReplicaSetStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ReplicaSet { + return ReplicaSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReplicaSet { + const message = createBaseReplicaSet(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? ReplicaSetSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? ReplicaSetStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseReplicaSetCondition(): ReplicaSetCondition { + return { type: '', status: '', lastTransitionTime: undefined, reason: '', message: '' }; +} + +export const ReplicaSetCondition: MessageFns = { + encode(message: ReplicaSetCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(26).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(42).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicaSetCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicaSetCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicaSetCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: ReplicaSetCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): ReplicaSetCondition { + return ReplicaSetCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReplicaSetCondition { + const message = createBaseReplicaSetCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseReplicaSetList(): ReplicaSetList { + return { metadata: undefined, items: [] }; +} + +export const ReplicaSetList: MessageFns = { + encode(message: ReplicaSetList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ReplicaSet.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicaSetList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicaSetList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ReplicaSet.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicaSetList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ReplicaSet.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ReplicaSetList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ReplicaSet.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ReplicaSetList { + return ReplicaSetList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReplicaSetList { + const message = createBaseReplicaSetList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ReplicaSet.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseReplicaSetSpec(): ReplicaSetSpec { + return { replicas: 0, minReadySeconds: 0, selector: undefined, template: undefined }; +} + +export const ReplicaSetSpec: MessageFns = { + encode(message: ReplicaSetSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + writer.uint32(32).int32(message.minReadySeconds); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(18).fork()).join(); + } + if (message.template !== undefined) { + PodTemplateSpec.encode(message.template, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicaSetSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicaSetSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.minReadySeconds = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.template = PodTemplateSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicaSetSpec { + return { + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + minReadySeconds: isSet(object.minReadySeconds) ? globalThis.Number(object.minReadySeconds) : 0, + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + template: isSet(object.template) ? PodTemplateSpec.fromJSON(object.template) : undefined, + }; + }, + + toJSON(message: ReplicaSetSpec): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + obj.minReadySeconds = Math.round(message.minReadySeconds); + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.template !== undefined) { + obj.template = PodTemplateSpec.toJSON(message.template); + } + return obj; + }, + + create, I>>(base?: I): ReplicaSetSpec { + return ReplicaSetSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReplicaSetSpec { + const message = createBaseReplicaSetSpec(); + message.replicas = object.replicas ?? 0; + message.minReadySeconds = object.minReadySeconds ?? 0; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.template = + object.template !== undefined && object.template !== null + ? PodTemplateSpec.fromPartial(object.template) + : undefined; + return message; + }, +}; + +function createBaseReplicaSetStatus(): ReplicaSetStatus { + return { + replicas: 0, + fullyLabeledReplicas: 0, + readyReplicas: 0, + availableReplicas: 0, + terminatingReplicas: 0, + observedGeneration: 0, + conditions: [], + }; +} + +export const ReplicaSetStatus: MessageFns = { + encode(message: ReplicaSetStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + if (message.fullyLabeledReplicas !== undefined && message.fullyLabeledReplicas !== 0) { + writer.uint32(16).int32(message.fullyLabeledReplicas); + } + if (message.readyReplicas !== undefined && message.readyReplicas !== 0) { + writer.uint32(32).int32(message.readyReplicas); + } + if (message.availableReplicas !== undefined && message.availableReplicas !== 0) { + writer.uint32(40).int32(message.availableReplicas); + } + if (message.terminatingReplicas !== undefined && message.terminatingReplicas !== 0) { + writer.uint32(56).int32(message.terminatingReplicas); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(24).int64(message.observedGeneration); + } + for (const v of message.conditions) { + ReplicaSetCondition.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicaSetStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicaSetStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.fullyLabeledReplicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.readyReplicas = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.availableReplicas = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.terminatingReplicas = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.conditions.push(ReplicaSetCondition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicaSetStatus { + return { + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + fullyLabeledReplicas: isSet(object.fullyLabeledReplicas) + ? globalThis.Number(object.fullyLabeledReplicas) + : 0, + readyReplicas: isSet(object.readyReplicas) ? globalThis.Number(object.readyReplicas) : 0, + availableReplicas: isSet(object.availableReplicas) + ? globalThis.Number(object.availableReplicas) + : 0, + terminatingReplicas: isSet(object.terminatingReplicas) + ? globalThis.Number(object.terminatingReplicas) + : 0, + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => ReplicaSetCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ReplicaSetStatus): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.fullyLabeledReplicas !== undefined && message.fullyLabeledReplicas !== 0) { + obj.fullyLabeledReplicas = Math.round(message.fullyLabeledReplicas); + } + if (message.readyReplicas !== undefined && message.readyReplicas !== 0) { + obj.readyReplicas = Math.round(message.readyReplicas); + } + if (message.availableReplicas !== undefined && message.availableReplicas !== 0) { + obj.availableReplicas = Math.round(message.availableReplicas); + } + if (message.terminatingReplicas !== undefined && message.terminatingReplicas !== 0) { + obj.terminatingReplicas = Math.round(message.terminatingReplicas); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => ReplicaSetCondition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ReplicaSetStatus { + return ReplicaSetStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReplicaSetStatus { + const message = createBaseReplicaSetStatus(); + message.replicas = object.replicas ?? 0; + message.fullyLabeledReplicas = object.fullyLabeledReplicas ?? 0; + message.readyReplicas = object.readyReplicas ?? 0; + message.availableReplicas = object.availableReplicas ?? 0; + message.terminatingReplicas = object.terminatingReplicas ?? 0; + message.observedGeneration = object.observedGeneration ?? 0; + message.conditions = object.conditions?.map((e) => ReplicaSetCondition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRollingUpdateDaemonSet(): RollingUpdateDaemonSet { + return { maxUnavailable: undefined, maxSurge: undefined }; +} + +export const RollingUpdateDaemonSet: MessageFns = { + encode(message: RollingUpdateDaemonSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxUnavailable !== undefined) { + IntOrString.encode(message.maxUnavailable, writer.uint32(10).fork()).join(); + } + if (message.maxSurge !== undefined) { + IntOrString.encode(message.maxSurge, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RollingUpdateDaemonSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRollingUpdateDaemonSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.maxUnavailable = IntOrString.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.maxSurge = IntOrString.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RollingUpdateDaemonSet { + return { + maxUnavailable: isSet(object.maxUnavailable) + ? IntOrString.fromJSON(object.maxUnavailable) + : undefined, + maxSurge: isSet(object.maxSurge) ? IntOrString.fromJSON(object.maxSurge) : undefined, + }; + }, + + toJSON(message: RollingUpdateDaemonSet): unknown { + const obj: any = {}; + if (message.maxUnavailable !== undefined) { + obj.maxUnavailable = IntOrString.toJSON(message.maxUnavailable); + } + if (message.maxSurge !== undefined) { + obj.maxSurge = IntOrString.toJSON(message.maxSurge); + } + return obj; + }, + + create, I>>(base?: I): RollingUpdateDaemonSet { + return RollingUpdateDaemonSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RollingUpdateDaemonSet { + const message = createBaseRollingUpdateDaemonSet(); + message.maxUnavailable = + object.maxUnavailable !== undefined && object.maxUnavailable !== null + ? IntOrString.fromPartial(object.maxUnavailable) + : undefined; + message.maxSurge = + object.maxSurge !== undefined && object.maxSurge !== null + ? IntOrString.fromPartial(object.maxSurge) + : undefined; + return message; + }, +}; + +function createBaseRollingUpdateDeployment(): RollingUpdateDeployment { + return { maxUnavailable: undefined, maxSurge: undefined }; +} + +export const RollingUpdateDeployment: MessageFns = { + encode(message: RollingUpdateDeployment, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxUnavailable !== undefined) { + IntOrString.encode(message.maxUnavailable, writer.uint32(10).fork()).join(); + } + if (message.maxSurge !== undefined) { + IntOrString.encode(message.maxSurge, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RollingUpdateDeployment { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRollingUpdateDeployment(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.maxUnavailable = IntOrString.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.maxSurge = IntOrString.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RollingUpdateDeployment { + return { + maxUnavailable: isSet(object.maxUnavailable) + ? IntOrString.fromJSON(object.maxUnavailable) + : undefined, + maxSurge: isSet(object.maxSurge) ? IntOrString.fromJSON(object.maxSurge) : undefined, + }; + }, + + toJSON(message: RollingUpdateDeployment): unknown { + const obj: any = {}; + if (message.maxUnavailable !== undefined) { + obj.maxUnavailable = IntOrString.toJSON(message.maxUnavailable); + } + if (message.maxSurge !== undefined) { + obj.maxSurge = IntOrString.toJSON(message.maxSurge); + } + return obj; + }, + + create, I>>(base?: I): RollingUpdateDeployment { + return RollingUpdateDeployment.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RollingUpdateDeployment { + const message = createBaseRollingUpdateDeployment(); + message.maxUnavailable = + object.maxUnavailable !== undefined && object.maxUnavailable !== null + ? IntOrString.fromPartial(object.maxUnavailable) + : undefined; + message.maxSurge = + object.maxSurge !== undefined && object.maxSurge !== null + ? IntOrString.fromPartial(object.maxSurge) + : undefined; + return message; + }, +}; + +function createBaseRollingUpdateStatefulSetStrategy(): RollingUpdateStatefulSetStrategy { + return { partition: 0, maxUnavailable: undefined }; +} + +export const RollingUpdateStatefulSetStrategy: MessageFns = { + encode( + message: RollingUpdateStatefulSetStrategy, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.partition !== undefined && message.partition !== 0) { + writer.uint32(8).int32(message.partition); + } + if (message.maxUnavailable !== undefined) { + IntOrString.encode(message.maxUnavailable, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RollingUpdateStatefulSetStrategy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRollingUpdateStatefulSetStrategy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.partition = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.maxUnavailable = IntOrString.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RollingUpdateStatefulSetStrategy { + return { + partition: isSet(object.partition) ? globalThis.Number(object.partition) : 0, + maxUnavailable: isSet(object.maxUnavailable) + ? IntOrString.fromJSON(object.maxUnavailable) + : undefined, + }; + }, + + toJSON(message: RollingUpdateStatefulSetStrategy): unknown { + const obj: any = {}; + if (message.partition !== undefined && message.partition !== 0) { + obj.partition = Math.round(message.partition); + } + if (message.maxUnavailable !== undefined) { + obj.maxUnavailable = IntOrString.toJSON(message.maxUnavailable); + } + return obj; + }, + + create, I>>( + base?: I, + ): RollingUpdateStatefulSetStrategy { + return RollingUpdateStatefulSetStrategy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RollingUpdateStatefulSetStrategy { + const message = createBaseRollingUpdateStatefulSetStrategy(); + message.partition = object.partition ?? 0; + message.maxUnavailable = + object.maxUnavailable !== undefined && object.maxUnavailable !== null + ? IntOrString.fromPartial(object.maxUnavailable) + : undefined; + return message; + }, +}; + +function createBaseStatefulSet(): StatefulSet { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const StatefulSet: MessageFns = { + encode(message: StatefulSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + StatefulSetSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + StatefulSetStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatefulSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatefulSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = StatefulSetSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = StatefulSetStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StatefulSet { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? StatefulSetSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? StatefulSetStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: StatefulSet): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = StatefulSetSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = StatefulSetStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): StatefulSet { + return StatefulSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatefulSet { + const message = createBaseStatefulSet(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? StatefulSetSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? StatefulSetStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseStatefulSetCondition(): StatefulSetCondition { + return { type: '', status: '', lastTransitionTime: undefined, reason: '', message: '' }; +} + +export const StatefulSetCondition: MessageFns = { + encode(message: StatefulSetCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(26).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(42).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatefulSetCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatefulSetCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StatefulSetCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: StatefulSetCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): StatefulSetCondition { + return StatefulSetCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatefulSetCondition { + const message = createBaseStatefulSetCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseStatefulSetList(): StatefulSetList { + return { metadata: undefined, items: [] }; +} + +export const StatefulSetList: MessageFns = { + encode(message: StatefulSetList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + StatefulSet.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatefulSetList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatefulSetList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(StatefulSet.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StatefulSetList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => StatefulSet.fromJSON(e)) + : [], + }; + }, + + toJSON(message: StatefulSetList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => StatefulSet.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): StatefulSetList { + return StatefulSetList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatefulSetList { + const message = createBaseStatefulSetList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => StatefulSet.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseStatefulSetOrdinals(): StatefulSetOrdinals { + return { start: 0 }; +} + +export const StatefulSetOrdinals: MessageFns = { + encode(message: StatefulSetOrdinals, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatefulSetOrdinals { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatefulSetOrdinals(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.start = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StatefulSetOrdinals { + return { start: isSet(object.start) ? globalThis.Number(object.start) : 0 }; + }, + + toJSON(message: StatefulSetOrdinals): unknown { + const obj: any = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + return obj; + }, + + create, I>>(base?: I): StatefulSetOrdinals { + return StatefulSetOrdinals.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatefulSetOrdinals { + const message = createBaseStatefulSetOrdinals(); + message.start = object.start ?? 0; + return message; + }, +}; + +function createBaseStatefulSetPersistentVolumeClaimRetentionPolicy(): StatefulSetPersistentVolumeClaimRetentionPolicy { + return { whenDeleted: '', whenScaled: '' }; +} + +export const StatefulSetPersistentVolumeClaimRetentionPolicy: MessageFns = + { + encode( + message: StatefulSetPersistentVolumeClaimRetentionPolicy, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.whenDeleted !== undefined && message.whenDeleted !== '') { + writer.uint32(10).string(message.whenDeleted); + } + if (message.whenScaled !== undefined && message.whenScaled !== '') { + writer.uint32(18).string(message.whenScaled); + } + return writer; + }, + + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): StatefulSetPersistentVolumeClaimRetentionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatefulSetPersistentVolumeClaimRetentionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.whenDeleted = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.whenScaled = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StatefulSetPersistentVolumeClaimRetentionPolicy { + return { + whenDeleted: isSet(object.whenDeleted) ? globalThis.String(object.whenDeleted) : '', + whenScaled: isSet(object.whenScaled) ? globalThis.String(object.whenScaled) : '', + }; + }, + + toJSON(message: StatefulSetPersistentVolumeClaimRetentionPolicy): unknown { + const obj: any = {}; + if (message.whenDeleted !== undefined && message.whenDeleted !== '') { + obj.whenDeleted = message.whenDeleted; + } + if (message.whenScaled !== undefined && message.whenScaled !== '') { + obj.whenScaled = message.whenScaled; + } + return obj; + }, + + create, I>>( + base?: I, + ): StatefulSetPersistentVolumeClaimRetentionPolicy { + return StatefulSetPersistentVolumeClaimRetentionPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): StatefulSetPersistentVolumeClaimRetentionPolicy { + const message = createBaseStatefulSetPersistentVolumeClaimRetentionPolicy(); + message.whenDeleted = object.whenDeleted ?? ''; + message.whenScaled = object.whenScaled ?? ''; + return message; + }, + }; + +function createBaseStatefulSetSpec(): StatefulSetSpec { + return { + replicas: 0, + selector: undefined, + template: undefined, + volumeClaimTemplates: [], + serviceName: '', + podManagementPolicy: '', + updateStrategy: undefined, + revisionHistoryLimit: 0, + minReadySeconds: 0, + persistentVolumeClaimRetentionPolicy: undefined, + ordinals: undefined, + }; +} + +export const StatefulSetSpec: MessageFns = { + encode(message: StatefulSetSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(18).fork()).join(); + } + if (message.template !== undefined) { + PodTemplateSpec.encode(message.template, writer.uint32(26).fork()).join(); + } + for (const v of message.volumeClaimTemplates) { + PersistentVolumeClaim.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.serviceName !== undefined && message.serviceName !== '') { + writer.uint32(42).string(message.serviceName); + } + if (message.podManagementPolicy !== undefined && message.podManagementPolicy !== '') { + writer.uint32(50).string(message.podManagementPolicy); + } + if (message.updateStrategy !== undefined) { + StatefulSetUpdateStrategy.encode(message.updateStrategy, writer.uint32(58).fork()).join(); + } + if (message.revisionHistoryLimit !== undefined && message.revisionHistoryLimit !== 0) { + writer.uint32(64).int32(message.revisionHistoryLimit); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + writer.uint32(72).int32(message.minReadySeconds); + } + if (message.persistentVolumeClaimRetentionPolicy !== undefined) { + StatefulSetPersistentVolumeClaimRetentionPolicy.encode( + message.persistentVolumeClaimRetentionPolicy, + writer.uint32(82).fork(), + ).join(); + } + if (message.ordinals !== undefined) { + StatefulSetOrdinals.encode(message.ordinals, writer.uint32(90).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatefulSetSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatefulSetSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.template = PodTemplateSpec.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.volumeClaimTemplates.push( + PersistentVolumeClaim.decode(reader, reader.uint32()), + ); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.serviceName = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.podManagementPolicy = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.updateStrategy = StatefulSetUpdateStrategy.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.revisionHistoryLimit = reader.int32(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.minReadySeconds = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.persistentVolumeClaimRetentionPolicy = + StatefulSetPersistentVolumeClaimRetentionPolicy.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.ordinals = StatefulSetOrdinals.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StatefulSetSpec { + return { + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + template: isSet(object.template) ? PodTemplateSpec.fromJSON(object.template) : undefined, + volumeClaimTemplates: globalThis.Array.isArray(object?.volumeClaimTemplates) + ? object.volumeClaimTemplates.map((e: any) => PersistentVolumeClaim.fromJSON(e)) + : [], + serviceName: isSet(object.serviceName) ? globalThis.String(object.serviceName) : '', + podManagementPolicy: isSet(object.podManagementPolicy) + ? globalThis.String(object.podManagementPolicy) + : '', + updateStrategy: isSet(object.updateStrategy) + ? StatefulSetUpdateStrategy.fromJSON(object.updateStrategy) + : undefined, + revisionHistoryLimit: isSet(object.revisionHistoryLimit) + ? globalThis.Number(object.revisionHistoryLimit) + : 0, + minReadySeconds: isSet(object.minReadySeconds) ? globalThis.Number(object.minReadySeconds) : 0, + persistentVolumeClaimRetentionPolicy: isSet(object.persistentVolumeClaimRetentionPolicy) + ? StatefulSetPersistentVolumeClaimRetentionPolicy.fromJSON( + object.persistentVolumeClaimRetentionPolicy, + ) + : undefined, + ordinals: isSet(object.ordinals) ? StatefulSetOrdinals.fromJSON(object.ordinals) : undefined, + }; + }, + + toJSON(message: StatefulSetSpec): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.template !== undefined) { + obj.template = PodTemplateSpec.toJSON(message.template); + } + if (message.volumeClaimTemplates?.length) { + obj.volumeClaimTemplates = message.volumeClaimTemplates.map((e) => + PersistentVolumeClaim.toJSON(e), + ); + } + if (message.serviceName !== undefined && message.serviceName !== '') { + obj.serviceName = message.serviceName; + } + if (message.podManagementPolicy !== undefined && message.podManagementPolicy !== '') { + obj.podManagementPolicy = message.podManagementPolicy; + } + if (message.updateStrategy !== undefined) { + obj.updateStrategy = StatefulSetUpdateStrategy.toJSON(message.updateStrategy); + } + if (message.revisionHistoryLimit !== undefined && message.revisionHistoryLimit !== 0) { + obj.revisionHistoryLimit = Math.round(message.revisionHistoryLimit); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + obj.minReadySeconds = Math.round(message.minReadySeconds); + } + if (message.persistentVolumeClaimRetentionPolicy !== undefined) { + obj.persistentVolumeClaimRetentionPolicy = StatefulSetPersistentVolumeClaimRetentionPolicy.toJSON( + message.persistentVolumeClaimRetentionPolicy, + ); + } + if (message.ordinals !== undefined) { + obj.ordinals = StatefulSetOrdinals.toJSON(message.ordinals); + } + return obj; + }, + + create, I>>(base?: I): StatefulSetSpec { + return StatefulSetSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatefulSetSpec { + const message = createBaseStatefulSetSpec(); + message.replicas = object.replicas ?? 0; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.template = + object.template !== undefined && object.template !== null + ? PodTemplateSpec.fromPartial(object.template) + : undefined; + message.volumeClaimTemplates = + object.volumeClaimTemplates?.map((e) => PersistentVolumeClaim.fromPartial(e)) || []; + message.serviceName = object.serviceName ?? ''; + message.podManagementPolicy = object.podManagementPolicy ?? ''; + message.updateStrategy = + object.updateStrategy !== undefined && object.updateStrategy !== null + ? StatefulSetUpdateStrategy.fromPartial(object.updateStrategy) + : undefined; + message.revisionHistoryLimit = object.revisionHistoryLimit ?? 0; + message.minReadySeconds = object.minReadySeconds ?? 0; + message.persistentVolumeClaimRetentionPolicy = + object.persistentVolumeClaimRetentionPolicy !== undefined && + object.persistentVolumeClaimRetentionPolicy !== null + ? StatefulSetPersistentVolumeClaimRetentionPolicy.fromPartial( + object.persistentVolumeClaimRetentionPolicy, + ) + : undefined; + message.ordinals = + object.ordinals !== undefined && object.ordinals !== null + ? StatefulSetOrdinals.fromPartial(object.ordinals) + : undefined; + return message; + }, +}; + +function createBaseStatefulSetStatus(): StatefulSetStatus { + return { + observedGeneration: 0, + replicas: 0, + readyReplicas: 0, + currentReplicas: 0, + updatedReplicas: 0, + currentRevision: '', + updateRevision: '', + collisionCount: 0, + conditions: [], + availableReplicas: 0, + }; +} + +export const StatefulSetStatus: MessageFns = { + encode(message: StatefulSetStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(8).int64(message.observedGeneration); + } + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(16).int32(message.replicas); + } + if (message.readyReplicas !== undefined && message.readyReplicas !== 0) { + writer.uint32(24).int32(message.readyReplicas); + } + if (message.currentReplicas !== undefined && message.currentReplicas !== 0) { + writer.uint32(32).int32(message.currentReplicas); + } + if (message.updatedReplicas !== undefined && message.updatedReplicas !== 0) { + writer.uint32(40).int32(message.updatedReplicas); + } + if (message.currentRevision !== undefined && message.currentRevision !== '') { + writer.uint32(50).string(message.currentRevision); + } + if (message.updateRevision !== undefined && message.updateRevision !== '') { + writer.uint32(58).string(message.updateRevision); + } + if (message.collisionCount !== undefined && message.collisionCount !== 0) { + writer.uint32(72).int32(message.collisionCount); + } + for (const v of message.conditions) { + StatefulSetCondition.encode(v!, writer.uint32(82).fork()).join(); + } + if (message.availableReplicas !== undefined && message.availableReplicas !== 0) { + writer.uint32(88).int32(message.availableReplicas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatefulSetStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatefulSetStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.readyReplicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.currentReplicas = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.updatedReplicas = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.currentRevision = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.updateRevision = reader.string(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.collisionCount = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.conditions.push(StatefulSetCondition.decode(reader, reader.uint32())); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + + message.availableReplicas = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StatefulSetStatus { + return { + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + readyReplicas: isSet(object.readyReplicas) ? globalThis.Number(object.readyReplicas) : 0, + currentReplicas: isSet(object.currentReplicas) ? globalThis.Number(object.currentReplicas) : 0, + updatedReplicas: isSet(object.updatedReplicas) ? globalThis.Number(object.updatedReplicas) : 0, + currentRevision: isSet(object.currentRevision) ? globalThis.String(object.currentRevision) : '', + updateRevision: isSet(object.updateRevision) ? globalThis.String(object.updateRevision) : '', + collisionCount: isSet(object.collisionCount) ? globalThis.Number(object.collisionCount) : 0, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => StatefulSetCondition.fromJSON(e)) + : [], + availableReplicas: isSet(object.availableReplicas) + ? globalThis.Number(object.availableReplicas) + : 0, + }; + }, + + toJSON(message: StatefulSetStatus): unknown { + const obj: any = {}; + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.readyReplicas !== undefined && message.readyReplicas !== 0) { + obj.readyReplicas = Math.round(message.readyReplicas); + } + if (message.currentReplicas !== undefined && message.currentReplicas !== 0) { + obj.currentReplicas = Math.round(message.currentReplicas); + } + if (message.updatedReplicas !== undefined && message.updatedReplicas !== 0) { + obj.updatedReplicas = Math.round(message.updatedReplicas); + } + if (message.currentRevision !== undefined && message.currentRevision !== '') { + obj.currentRevision = message.currentRevision; + } + if (message.updateRevision !== undefined && message.updateRevision !== '') { + obj.updateRevision = message.updateRevision; + } + if (message.collisionCount !== undefined && message.collisionCount !== 0) { + obj.collisionCount = Math.round(message.collisionCount); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => StatefulSetCondition.toJSON(e)); + } + if (message.availableReplicas !== undefined && message.availableReplicas !== 0) { + obj.availableReplicas = Math.round(message.availableReplicas); + } + return obj; + }, + + create, I>>(base?: I): StatefulSetStatus { + return StatefulSetStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatefulSetStatus { + const message = createBaseStatefulSetStatus(); + message.observedGeneration = object.observedGeneration ?? 0; + message.replicas = object.replicas ?? 0; + message.readyReplicas = object.readyReplicas ?? 0; + message.currentReplicas = object.currentReplicas ?? 0; + message.updatedReplicas = object.updatedReplicas ?? 0; + message.currentRevision = object.currentRevision ?? ''; + message.updateRevision = object.updateRevision ?? ''; + message.collisionCount = object.collisionCount ?? 0; + message.conditions = object.conditions?.map((e) => StatefulSetCondition.fromPartial(e)) || []; + message.availableReplicas = object.availableReplicas ?? 0; + return message; + }, +}; + +function createBaseStatefulSetUpdateStrategy(): StatefulSetUpdateStrategy { + return { type: '', rollingUpdate: undefined }; +} + +export const StatefulSetUpdateStrategy: MessageFns = { + encode(message: StatefulSetUpdateStrategy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.rollingUpdate !== undefined) { + RollingUpdateStatefulSetStrategy.encode(message.rollingUpdate, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatefulSetUpdateStrategy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatefulSetUpdateStrategy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.rollingUpdate = RollingUpdateStatefulSetStrategy.decode( + reader, + reader.uint32(), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StatefulSetUpdateStrategy { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + rollingUpdate: isSet(object.rollingUpdate) + ? RollingUpdateStatefulSetStrategy.fromJSON(object.rollingUpdate) + : undefined, + }; + }, + + toJSON(message: StatefulSetUpdateStrategy): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.rollingUpdate !== undefined) { + obj.rollingUpdate = RollingUpdateStatefulSetStrategy.toJSON(message.rollingUpdate); + } + return obj; + }, + + create, I>>(base?: I): StatefulSetUpdateStrategy { + return StatefulSetUpdateStrategy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): StatefulSetUpdateStrategy { + const message = createBaseStatefulSetUpdateStrategy(); + message.type = object.type ?? ''; + message.rollingUpdate = + object.rollingUpdate !== undefined && object.rollingUpdate !== null + ? RollingUpdateStatefulSetStrategy.fromPartial(object.rollingUpdate) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error('Value is smaller than Number.MIN_SAFE_INTEGER'); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/authentication/v1/generated.ts b/src/proto/generated/k8s.io/api/authentication/v1/generated.ts new file mode 100644 index 00000000000..4a2f7175a20 --- /dev/null +++ b/src/proto/generated/k8s.io/api/authentication/v1/generated.ts @@ -0,0 +1,1751 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/authentication/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { ObjectMeta, Time } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** + * AttestationValue masks the value so protobuf can generate + * +protobuf.nullable=true + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface AttestationValue { + items: string[]; +} + +/** BoundObjectReference is a reference to an object that a token is bound to. */ +export interface BoundObjectReference { + /** + * kind of the referent. Valid kinds are 'Pod', 'Secret', 'Node', + * 'ValidatingWebhookConfiguration', and 'MutatingWebhookConfiguration'. + * +optional + */ + kind?: string | undefined; + /** + * apiVersion is API version of the referent. + * +optional + */ + apiVersion?: string | undefined; + /** + * name of the referent. + * +optional + */ + name?: string | undefined; + /** + * uid of the referent. + * +optional + */ + uID?: string | undefined; +} + +/** + * ExtraValue masks the value so protobuf can generate + * +protobuf.nullable=true + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface ExtraValue { + items: string[]; +} + +/** + * SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. + * When using impersonation, users will receive the user info of the user being impersonated. If impersonation or + * request header authentication is used, any extra keys will have their case ignored and returned as lowercase. + * +k8s:supportsSubresource="/status" + */ +export interface SelfSubjectReview { + /** + * metadata is standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * status is filled in by the server with the user attributes. + * +optional + */ + status?: SelfSubjectReviewStatus | undefined; +} + +/** SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user. */ +export interface SelfSubjectReviewStatus { + /** + * userInfo is a set of attributes belonging to the user making this request. + * +optional + */ + userInfo?: UserInfo | undefined; +} + +/** TokenRequest requests a token for a given service account. */ +export interface TokenRequest { + /** + * metadata is the standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * spec holds information about the request being evaluated + * +optional + */ + spec?: TokenRequestSpec | undefined; + /** + * status is filled in by the server and indicates whether the token can be authenticated. + * +optional + */ + status?: TokenRequestStatus | undefined; +} + +/** TokenRequestSpec contains client provided parameters of a token request. */ +export interface TokenRequestSpec { + /** + * audiences are the intendend audiences of the token. A recipient of a + * token must identify themself with an identifier in the list of + * audiences of the token, and otherwise should reject the token. A + * token issued for multiple audiences may be used to authenticate + * against any of the audiences listed but implies a high degree of + * trust between the target audiences. + * +optional + * +listType=atomic + */ + audiences: string[]; + /** + * expirationSeconds is the requested duration of validity of the request. The + * token issuer may return a token with a different validity duration so a + * client needs to check the 'expiration' field in a response. + * +optional + */ + expirationSeconds?: number | undefined; + /** + * boundObjectRef is a reference to an object that the token will be bound to. + * The token will only be valid for as long as the bound object exists. + * NOTE: The API server's TokenReview endpoint will validate the + * BoundObjectRef, but other audiences may not. Keep ExpirationSeconds + * small if you want prompt revocation. + * +optional + */ + boundObjectRef?: BoundObjectReference | undefined; + /** + * attestations is a map of well-known keys to string-slice values. + * The values for each key have a specific semantic meaning, which is + * documented on the key definition. Requesters of tokens may ask + * the Kubernetes API Server to attest to certain claims. The API Server + * may perform authorization checks depending on the key of this map. + * +optional + */ + attestations: { [key: string]: AttestationValue }; +} + +export interface TokenRequestSpec_AttestationsEntry { + key: string; + value: AttestationValue | undefined; +} + +/** TokenRequestStatus is the result of a token request. */ +export interface TokenRequestStatus { + /** + * token is the opaque bearer token. + * +optional + */ + token?: string | undefined; + /** + * expirationTimestamp is the time of expiration of the returned token. + * +optional + */ + expirationTimestamp?: Time | undefined; +} + +/** + * TokenReview attempts to authenticate a token to a known user. + * Note: TokenReview requests may be cached by the webhook token authenticator + * plugin in the kube-apiserver. + * +k8s:supportsSubresource="/status" + */ +export interface TokenReview { + /** + * metadata is the standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * spec holds information about the request being evaluated + * +required + */ + spec?: TokenReviewSpec | undefined; + /** + * status is filled in by the server and indicates whether the request can be authenticated. + * +optional + */ + status?: TokenReviewStatus | undefined; +} + +/** TokenReviewSpec is a description of the token authentication request. */ +export interface TokenReviewSpec { + /** + * token is the opaque bearer token. + * +required + */ + token?: string | undefined; + /** + * audiences is a list of the identifiers that the resource server presented + * with the token identifies as. Audience-aware token authenticators will + * verify that the token was intended for at least one of the audiences in + * this list. If no audiences are provided, the audience will default to the + * audience of the Kubernetes apiserver. + * +optional + * +listType=atomic + */ + audiences: string[]; +} + +/** TokenReviewStatus is the result of the token authentication request. */ +export interface TokenReviewStatus { + /** + * authenticated indicates that the token was associated with a known user. + * +optional + */ + authenticated?: boolean | undefined; + /** + * user is the UserInfo associated with the provided token. + * +optional + */ + user?: UserInfo | undefined; + /** + * audiences are audience identifiers chosen by the authenticator that are + * compatible with both the TokenReview and token. An identifier is any + * identifier in the intersection of the TokenReviewSpec audiences and the + * token's audiences. A client of the TokenReview API that sets the + * spec.audiences field should validate that a compatible audience identifier + * is returned in the status.audiences field to ensure that the TokenReview + * server is audience aware. If a TokenReview returns an empty + * status.audience field where status.authenticated is "true", the token is + * valid against the audience of the Kubernetes API server. + * +optional + * +listType=atomic + */ + audiences: string[]; + /** + * error indicates that the token couldn't be checked + * +optional + */ + error?: string | undefined; +} + +/** + * UserInfo holds the information about the user needed to implement the + * user.Info interface. + */ +export interface UserInfo { + /** + * username is the name that uniquely identifies this user among all active users. + * +optional + */ + username?: string | undefined; + /** + * uid is a unique value that identifies this user across time. If this user is + * deleted and another user by the same name is added, they will have + * different UIDs. + * +optional + */ + uid?: string | undefined; + /** + * groups is the names of groups this user is a part of. + * +optional + * +listType=atomic + */ + groups: string[]; + /** + * extra is any additional information provided by the authenticator. + * +optional + */ + extra: { [key: string]: ExtraValue }; +} + +export interface UserInfo_ExtraEntry { + key: string; + value: ExtraValue | undefined; +} + +function createBaseAttestationValue(): AttestationValue { + return { items: [] }; +} + +export const AttestationValue: MessageFns = { + encode(message: AttestationValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.items) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AttestationValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttestationValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.items.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AttestationValue { + return { + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: AttestationValue): unknown { + const obj: any = {}; + if (message.items?.length) { + obj.items = message.items; + } + return obj; + }, + + create, I>>(base?: I): AttestationValue { + return AttestationValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AttestationValue { + const message = createBaseAttestationValue(); + message.items = object.items?.map((e) => e) || []; + return message; + }, +}; + +function createBaseBoundObjectReference(): BoundObjectReference { + return { kind: '', apiVersion: '', name: '', uID: '' }; +} + +export const BoundObjectReference: MessageFns = { + encode(message: BoundObjectReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kind !== undefined && message.kind !== '') { + writer.uint32(10).string(message.kind); + } + if (message.apiVersion !== undefined && message.apiVersion !== '') { + writer.uint32(18).string(message.apiVersion); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(26).string(message.name); + } + if (message.uID !== undefined && message.uID !== '') { + writer.uint32(34).string(message.uID); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BoundObjectReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBoundObjectReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.apiVersion = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.uID = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): BoundObjectReference { + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : '', + apiVersion: isSet(object.apiVersion) ? globalThis.String(object.apiVersion) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + uID: isSet(object.uID) ? globalThis.String(object.uID) : '', + }; + }, + + toJSON(message: BoundObjectReference): unknown { + const obj: any = {}; + if (message.kind !== undefined && message.kind !== '') { + obj.kind = message.kind; + } + if (message.apiVersion !== undefined && message.apiVersion !== '') { + obj.apiVersion = message.apiVersion; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.uID !== undefined && message.uID !== '') { + obj.uID = message.uID; + } + return obj; + }, + + create, I>>(base?: I): BoundObjectReference { + return BoundObjectReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BoundObjectReference { + const message = createBaseBoundObjectReference(); + message.kind = object.kind ?? ''; + message.apiVersion = object.apiVersion ?? ''; + message.name = object.name ?? ''; + message.uID = object.uID ?? ''; + return message; + }, +}; + +function createBaseExtraValue(): ExtraValue { + return { items: [] }; +} + +export const ExtraValue: MessageFns = { + encode(message: ExtraValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.items) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtraValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtraValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.items.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ExtraValue { + return { + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ExtraValue): unknown { + const obj: any = {}; + if (message.items?.length) { + obj.items = message.items; + } + return obj; + }, + + create, I>>(base?: I): ExtraValue { + return ExtraValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtraValue { + const message = createBaseExtraValue(); + message.items = object.items?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSelfSubjectReview(): SelfSubjectReview { + return { metadata: undefined, status: undefined }; +} + +export const SelfSubjectReview: MessageFns = { + encode(message: SelfSubjectReview, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.status !== undefined) { + SelfSubjectReviewStatus.encode(message.status, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SelfSubjectReview { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSelfSubjectReview(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = SelfSubjectReviewStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SelfSubjectReview { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + status: isSet(object.status) ? SelfSubjectReviewStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: SelfSubjectReview): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.status !== undefined) { + obj.status = SelfSubjectReviewStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): SelfSubjectReview { + return SelfSubjectReview.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SelfSubjectReview { + const message = createBaseSelfSubjectReview(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? SelfSubjectReviewStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseSelfSubjectReviewStatus(): SelfSubjectReviewStatus { + return { userInfo: undefined }; +} + +export const SelfSubjectReviewStatus: MessageFns = { + encode(message: SelfSubjectReviewStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userInfo !== undefined) { + UserInfo.encode(message.userInfo, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SelfSubjectReviewStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSelfSubjectReviewStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userInfo = UserInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SelfSubjectReviewStatus { + return { userInfo: isSet(object.userInfo) ? UserInfo.fromJSON(object.userInfo) : undefined }; + }, + + toJSON(message: SelfSubjectReviewStatus): unknown { + const obj: any = {}; + if (message.userInfo !== undefined) { + obj.userInfo = UserInfo.toJSON(message.userInfo); + } + return obj; + }, + + create, I>>(base?: I): SelfSubjectReviewStatus { + return SelfSubjectReviewStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SelfSubjectReviewStatus { + const message = createBaseSelfSubjectReviewStatus(); + message.userInfo = + object.userInfo !== undefined && object.userInfo !== null + ? UserInfo.fromPartial(object.userInfo) + : undefined; + return message; + }, +}; + +function createBaseTokenRequest(): TokenRequest { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const TokenRequest: MessageFns = { + encode(message: TokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + TokenRequestSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + TokenRequestStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TokenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTokenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = TokenRequestSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = TokenRequestStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TokenRequest { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? TokenRequestSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? TokenRequestStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: TokenRequest): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = TokenRequestSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = TokenRequestStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): TokenRequest { + return TokenRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TokenRequest { + const message = createBaseTokenRequest(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? TokenRequestSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? TokenRequestStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseTokenRequestSpec(): TokenRequestSpec { + return { audiences: [], expirationSeconds: 0, boundObjectRef: undefined, attestations: {} }; +} + +export const TokenRequestSpec: MessageFns = { + encode(message: TokenRequestSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.audiences) { + writer.uint32(10).string(v!); + } + if (message.expirationSeconds !== undefined && message.expirationSeconds !== 0) { + writer.uint32(32).int64(message.expirationSeconds); + } + if (message.boundObjectRef !== undefined) { + BoundObjectReference.encode(message.boundObjectRef, writer.uint32(26).fork()).join(); + } + globalThis.Object.entries(message.attestations).forEach( + ([key, value]: [string, AttestationValue]) => { + TokenRequestSpec_AttestationsEntry.encode( + { key: key as any, value }, + writer.uint32(42).fork(), + ).join(); + }, + ); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TokenRequestSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTokenRequestSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.audiences.push(reader.string()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.expirationSeconds = longToNumber(reader.int64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.boundObjectRef = BoundObjectReference.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + const entry5 = TokenRequestSpec_AttestationsEntry.decode(reader, reader.uint32()); + if (entry5.value !== undefined) { + message.attestations[entry5.key] = entry5.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TokenRequestSpec { + return { + audiences: globalThis.Array.isArray(object?.audiences) + ? object.audiences.map((e: any) => globalThis.String(e)) + : [], + expirationSeconds: isSet(object.expirationSeconds) + ? globalThis.Number(object.expirationSeconds) + : 0, + boundObjectRef: isSet(object.boundObjectRef) + ? BoundObjectReference.fromJSON(object.boundObjectRef) + : undefined, + attestations: isObject(object.attestations) + ? (globalThis.Object.entries(object.attestations) as [string, any][]).reduce( + (acc: { [key: string]: AttestationValue }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: AttestationValue.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: TokenRequestSpec): unknown { + const obj: any = {}; + if (message.audiences?.length) { + obj.audiences = message.audiences; + } + if (message.expirationSeconds !== undefined && message.expirationSeconds !== 0) { + obj.expirationSeconds = Math.round(message.expirationSeconds); + } + if (message.boundObjectRef !== undefined) { + obj.boundObjectRef = BoundObjectReference.toJSON(message.boundObjectRef); + } + if (message.attestations) { + const entries = globalThis.Object.entries(message.attestations) as [string, AttestationValue][]; + if (entries.length > 0) { + obj.attestations = {}; + entries.forEach(([k, v]) => { + obj.attestations[k] = AttestationValue.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): TokenRequestSpec { + return TokenRequestSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TokenRequestSpec { + const message = createBaseTokenRequestSpec(); + message.audiences = object.audiences?.map((e) => e) || []; + message.expirationSeconds = object.expirationSeconds ?? 0; + message.boundObjectRef = + object.boundObjectRef !== undefined && object.boundObjectRef !== null + ? BoundObjectReference.fromPartial(object.boundObjectRef) + : undefined; + message.attestations = ( + globalThis.Object.entries(object.attestations ?? {}) as [string, AttestationValue][] + ).reduce((acc: { [key: string]: AttestationValue }, [key, value]: [string, AttestationValue]) => { + if (value !== undefined) { + acc[key] = AttestationValue.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseTokenRequestSpec_AttestationsEntry(): TokenRequestSpec_AttestationsEntry { + return { key: '', value: undefined }; +} + +export const TokenRequestSpec_AttestationsEntry: MessageFns = { + encode( + message: TokenRequestSpec_AttestationsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + AttestationValue.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TokenRequestSpec_AttestationsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTokenRequestSpec_AttestationsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = AttestationValue.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TokenRequestSpec_AttestationsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? AttestationValue.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: TokenRequestSpec_AttestationsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = AttestationValue.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): TokenRequestSpec_AttestationsEntry { + return TokenRequestSpec_AttestationsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): TokenRequestSpec_AttestationsEntry { + const message = createBaseTokenRequestSpec_AttestationsEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? AttestationValue.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseTokenRequestStatus(): TokenRequestStatus { + return { token: '', expirationTimestamp: undefined }; +} + +export const TokenRequestStatus: MessageFns = { + encode(message: TokenRequestStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.token !== undefined && message.token !== '') { + writer.uint32(10).string(message.token); + } + if (message.expirationTimestamp !== undefined) { + Time.encode(message.expirationTimestamp, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TokenRequestStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTokenRequestStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.token = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.expirationTimestamp = Time.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TokenRequestStatus { + return { + token: isSet(object.token) ? globalThis.String(object.token) : '', + expirationTimestamp: isSet(object.expirationTimestamp) + ? Time.fromJSON(object.expirationTimestamp) + : undefined, + }; + }, + + toJSON(message: TokenRequestStatus): unknown { + const obj: any = {}; + if (message.token !== undefined && message.token !== '') { + obj.token = message.token; + } + if (message.expirationTimestamp !== undefined) { + obj.expirationTimestamp = Time.toJSON(message.expirationTimestamp); + } + return obj; + }, + + create, I>>(base?: I): TokenRequestStatus { + return TokenRequestStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TokenRequestStatus { + const message = createBaseTokenRequestStatus(); + message.token = object.token ?? ''; + message.expirationTimestamp = + object.expirationTimestamp !== undefined && object.expirationTimestamp !== null + ? Time.fromPartial(object.expirationTimestamp) + : undefined; + return message; + }, +}; + +function createBaseTokenReview(): TokenReview { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const TokenReview: MessageFns = { + encode(message: TokenReview, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + TokenReviewSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + TokenReviewStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TokenReview { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTokenReview(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = TokenReviewSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = TokenReviewStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TokenReview { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? TokenReviewSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? TokenReviewStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: TokenReview): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = TokenReviewSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = TokenReviewStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): TokenReview { + return TokenReview.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TokenReview { + const message = createBaseTokenReview(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? TokenReviewSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? TokenReviewStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseTokenReviewSpec(): TokenReviewSpec { + return { token: '', audiences: [] }; +} + +export const TokenReviewSpec: MessageFns = { + encode(message: TokenReviewSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.token !== undefined && message.token !== '') { + writer.uint32(10).string(message.token); + } + for (const v of message.audiences) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TokenReviewSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTokenReviewSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.token = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.audiences.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TokenReviewSpec { + return { + token: isSet(object.token) ? globalThis.String(object.token) : '', + audiences: globalThis.Array.isArray(object?.audiences) + ? object.audiences.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: TokenReviewSpec): unknown { + const obj: any = {}; + if (message.token !== undefined && message.token !== '') { + obj.token = message.token; + } + if (message.audiences?.length) { + obj.audiences = message.audiences; + } + return obj; + }, + + create, I>>(base?: I): TokenReviewSpec { + return TokenReviewSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TokenReviewSpec { + const message = createBaseTokenReviewSpec(); + message.token = object.token ?? ''; + message.audiences = object.audiences?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTokenReviewStatus(): TokenReviewStatus { + return { authenticated: false, user: undefined, audiences: [], error: '' }; +} + +export const TokenReviewStatus: MessageFns = { + encode(message: TokenReviewStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authenticated !== undefined && message.authenticated !== false) { + writer.uint32(8).bool(message.authenticated); + } + if (message.user !== undefined) { + UserInfo.encode(message.user, writer.uint32(18).fork()).join(); + } + for (const v of message.audiences) { + writer.uint32(34).string(v!); + } + if (message.error !== undefined && message.error !== '') { + writer.uint32(26).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TokenReviewStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTokenReviewStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.authenticated = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.user = UserInfo.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.audiences.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.error = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TokenReviewStatus { + return { + authenticated: isSet(object.authenticated) ? globalThis.Boolean(object.authenticated) : false, + user: isSet(object.user) ? UserInfo.fromJSON(object.user) : undefined, + audiences: globalThis.Array.isArray(object?.audiences) + ? object.audiences.map((e: any) => globalThis.String(e)) + : [], + error: isSet(object.error) ? globalThis.String(object.error) : '', + }; + }, + + toJSON(message: TokenReviewStatus): unknown { + const obj: any = {}; + if (message.authenticated !== undefined && message.authenticated !== false) { + obj.authenticated = message.authenticated; + } + if (message.user !== undefined) { + obj.user = UserInfo.toJSON(message.user); + } + if (message.audiences?.length) { + obj.audiences = message.audiences; + } + if (message.error !== undefined && message.error !== '') { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): TokenReviewStatus { + return TokenReviewStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TokenReviewStatus { + const message = createBaseTokenReviewStatus(); + message.authenticated = object.authenticated ?? false; + message.user = + object.user !== undefined && object.user !== null ? UserInfo.fromPartial(object.user) : undefined; + message.audiences = object.audiences?.map((e) => e) || []; + message.error = object.error ?? ''; + return message; + }, +}; + +function createBaseUserInfo(): UserInfo { + return { username: '', uid: '', groups: [], extra: {} }; +} + +export const UserInfo: MessageFns = { + encode(message: UserInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.username !== undefined && message.username !== '') { + writer.uint32(10).string(message.username); + } + if (message.uid !== undefined && message.uid !== '') { + writer.uint32(18).string(message.uid); + } + for (const v of message.groups) { + writer.uint32(26).string(v!); + } + globalThis.Object.entries(message.extra).forEach(([key, value]: [string, ExtraValue]) => { + UserInfo_ExtraEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.username = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.uid = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.groups.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + const entry4 = UserInfo_ExtraEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.extra[entry4.key] = entry4.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): UserInfo { + return { + username: isSet(object.username) ? globalThis.String(object.username) : '', + uid: isSet(object.uid) ? globalThis.String(object.uid) : '', + groups: globalThis.Array.isArray(object?.groups) + ? object.groups.map((e: any) => globalThis.String(e)) + : [], + extra: isObject(object.extra) + ? (globalThis.Object.entries(object.extra) as [string, any][]).reduce( + (acc: { [key: string]: ExtraValue }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: ExtraValue.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: UserInfo): unknown { + const obj: any = {}; + if (message.username !== undefined && message.username !== '') { + obj.username = message.username; + } + if (message.uid !== undefined && message.uid !== '') { + obj.uid = message.uid; + } + if (message.groups?.length) { + obj.groups = message.groups; + } + if (message.extra) { + const entries = globalThis.Object.entries(message.extra) as [string, ExtraValue][]; + if (entries.length > 0) { + obj.extra = {}; + entries.forEach(([k, v]) => { + obj.extra[k] = ExtraValue.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): UserInfo { + return UserInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UserInfo { + const message = createBaseUserInfo(); + message.username = object.username ?? ''; + message.uid = object.uid ?? ''; + message.groups = object.groups?.map((e) => e) || []; + message.extra = (globalThis.Object.entries(object.extra ?? {}) as [string, ExtraValue][]).reduce( + (acc: { [key: string]: ExtraValue }, [key, value]: [string, ExtraValue]) => { + if (value !== undefined) { + acc[key] = ExtraValue.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseUserInfo_ExtraEntry(): UserInfo_ExtraEntry { + return { key: '', value: undefined }; +} + +export const UserInfo_ExtraEntry: MessageFns = { + encode(message: UserInfo_ExtraEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ExtraValue.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserInfo_ExtraEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserInfo_ExtraEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = ExtraValue.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): UserInfo_ExtraEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? ExtraValue.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: UserInfo_ExtraEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ExtraValue.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): UserInfo_ExtraEntry { + return UserInfo_ExtraEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UserInfo_ExtraEntry { + const message = createBaseUserInfo_ExtraEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? ExtraValue.fromPartial(object.value) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error('Value is smaller than Number.MIN_SAFE_INTEGER'); + } + return num; +} + +function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/authorization/v1/generated.ts b/src/proto/generated/k8s.io/api/authorization/v1/generated.ts new file mode 100644 index 00000000000..1658974a9d5 --- /dev/null +++ b/src/proto/generated/k8s.io/api/authorization/v1/generated.ts @@ -0,0 +1,2405 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/authorization/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { + FieldSelectorRequirement, + LabelSelectorRequirement, + ObjectMeta, +} from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** + * ExtraValue masks the value so protobuf can generate + * +protobuf.nullable=true + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface ExtraValue { + items: string[]; +} + +/** + * FieldSelectorAttributes indicates a field limited access. + * Webhook authors are encouraged to + * * ensure rawSelector and requirements are not both set + * * consider the requirements field if set + * * not try to parse or consider the rawSelector field if set. This is to avoid another CVE-2022-2880 (i.e. getting different systems to agree on how exactly to parse a query is not something we want), see https://www.oxeye.io/resources/golang-parameter-smuggling-attack for more details. + * For the *SubjectAccessReview endpoints of the kube-apiserver: + * * If rawSelector is empty and requirements are empty, the request is not limited. + * * If rawSelector is present and requirements are empty, the rawSelector will be parsed and limited if the parsing succeeds. + * * If rawSelector is empty and requirements are present, the requirements should be honored + * * If rawSelector is present and requirements are present, the request is invalid. + */ +export interface FieldSelectorAttributes { + /** + * rawSelector is the serialization of a field selector that would be included in a query parameter. + * Webhook implementations are encouraged to ignore rawSelector. + * The kube-apiserver's *SubjectAccessReview will parse the rawSelector as long as the requirements are not present. + * +optional + */ + rawSelector?: string | undefined; + /** + * requirements is the parsed interpretation of a field selector. + * All requirements must be met for a resource instance to match the selector. + * Webhook implementations should handle requirements, but how to handle them is up to the webhook. + * Since requirements can only limit the request, it is safe to authorize as unlimited request if the requirements + * are not understood. + * +optional + * +listType=atomic + */ + requirements: FieldSelectorRequirement[]; +} + +/** + * LabelSelectorAttributes indicates a label limited access. + * Webhook authors are encouraged to + * * ensure rawSelector and requirements are not both set + * * consider the requirements field if set + * * not try to parse or consider the rawSelector field if set. This is to avoid another CVE-2022-2880 (i.e. getting different systems to agree on how exactly to parse a query is not something we want), see https://www.oxeye.io/resources/golang-parameter-smuggling-attack for more details. + * For the *SubjectAccessReview endpoints of the kube-apiserver: + * * If rawSelector is empty and requirements are empty, the request is not limited. + * * If rawSelector is present and requirements are empty, the rawSelector will be parsed and limited if the parsing succeeds. + * * If rawSelector is empty and requirements are present, the requirements should be honored + * * If rawSelector is present and requirements are present, the request is invalid. + */ +export interface LabelSelectorAttributes { + /** + * rawSelector is the serialization of a field selector that would be included in a query parameter. + * Webhook implementations are encouraged to ignore rawSelector. + * The kube-apiserver's *SubjectAccessReview will parse the rawSelector as long as the requirements are not present. + * +optional + */ + rawSelector?: string | undefined; + /** + * requirements is the parsed interpretation of a label selector. + * All requirements must be met for a resource instance to match the selector. + * Webhook implementations should handle requirements, but how to handle them is up to the webhook. + * Since requirements can only limit the request, it is safe to authorize as unlimited request if the requirements + * are not understood. + * +optional + * +listType=atomic + */ + requirements: LabelSelectorRequirement[]; +} + +/** + * LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. + * Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions + * checking. + * +k8s:supportsSubresource="/status" + */ +export interface LocalSubjectAccessReview { + /** + * metadata is the standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * spec holds information about the request being evaluated. spec.namespace must be equal to the namespace + * you made the request against. If empty, it is defaulted. + * +required + */ + spec?: SubjectAccessReviewSpec | undefined; + /** + * status is filled in by the server and indicates whether the request is allowed or not + * +optional + */ + status?: SubjectAccessReviewStatus | undefined; +} + +/** NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface */ +export interface NonResourceAttributes { + /** + * path is the URL path of the request + * +optional + */ + path?: string | undefined; + /** + * verb is the standard HTTP verb + * +optional + */ + verb?: string | undefined; +} + +/** NonResourceRule holds information that describes a rule for the non-resource */ +export interface NonResourceRule { + /** + * verbs is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all. + * +optional + * +listType=atomic + */ + verbs: string[]; + /** + * nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, + * final step in the path. "*" means all. + * +optional + * +listType=atomic + */ + nonResourceURLs: string[]; +} + +/** ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface */ +export interface ResourceAttributes { + /** + * namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces + * "" (empty) is defaulted for LocalSubjectAccessReviews + * "" (empty) is empty for cluster-scoped resources + * "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview + * +optional + */ + namespace?: string | undefined; + /** + * verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. + * +optional + */ + verb?: string | undefined; + /** + * group is the API Group of the Resource. "*" means all. + * +optional + */ + group?: string | undefined; + /** + * version is the API Version of the Resource. "*" means all. + * +optional + */ + version?: string | undefined; + /** + * resource is one of the existing resource types. "*" means all. + * +optional + */ + resource?: string | undefined; + /** + * subresource is one of the existing resource types. "" means none. + * +optional + */ + subresource?: string | undefined; + /** + * name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. + * +optional + */ + name?: string | undefined; + /** + * fieldSelector describes the limitation on access based on field. It can only limit access, not broaden it. + * +optional + */ + fieldSelector?: FieldSelectorAttributes | undefined; + /** + * labelSelector describes the limitation on access based on labels. It can only limit access, not broaden it. + * +optional + */ + labelSelector?: LabelSelectorAttributes | undefined; +} + +/** + * ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, + * may contain duplicates, and possibly be incomplete. + */ +export interface ResourceRule { + /** + * verbs is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all. + * +optional + * +listType=atomic + */ + verbs: string[]; + /** + * apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + * the enumerated resources in any API group will be allowed. "*" means all. + * +optional + * +listType=atomic + */ + apiGroups: string[]; + /** + * resources is a list of resources this rule applies to. "*" means all in the specified apiGroups. + * "* /foo" represents the subresource 'foo' for all resources in the specified apiGroups. + * +optional + * +listType=atomic + */ + resources: string[]; + /** + * resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all. + * +optional + * +listType=atomic + */ + resourceNames: string[]; +} + +/** + * SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a + * spec.namespace means "in all namespaces". Self is a special case, because users should always be able + * to check whether they can perform an action + * +k8s:supportsSubresource="/status" + */ +export interface SelfSubjectAccessReview { + /** + * metadata is the standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * spec holds information about the request being evaluated. user and groups must be empty + * +required + */ + spec?: SelfSubjectAccessReviewSpec | undefined; + /** + * status is filled in by the server and indicates whether the request is allowed or not + * +optional + */ + status?: SubjectAccessReviewStatus | undefined; +} + +/** + * SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes + * and nonResourceAttributes must be set + */ +export interface SelfSubjectAccessReviewSpec { + /** + * resourceAttributes describes information for a resource access request + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:unionMember + */ + resourceAttributes?: ResourceAttributes | undefined; + /** + * nonResourceAttributes describes information for a non-resource access request + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:unionMember + */ + nonResourceAttributes?: NonResourceAttributes | undefined; +} + +/** + * SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. + * The returned list of actions may be incomplete depending on the server's authorization mode, + * and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, + * or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to + * drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. + * SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. + * +k8s:supportsSubresource="/status" + */ +export interface SelfSubjectRulesReview { + /** + * metadata is the standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * spec holds information about the request being evaluated. + * +required + */ + spec?: SelfSubjectRulesReviewSpec | undefined; + /** + * status is filled in by the server and indicates the set of actions a user can perform. + * +optional + */ + status?: SubjectRulesReviewStatus | undefined; +} + +/** SelfSubjectRulesReviewSpec defines the specification for SelfSubjectRulesReview. */ +export interface SelfSubjectRulesReviewSpec { + /** + * namespace to evaluate rules for. Required. + * +required + */ + namespace?: string | undefined; +} + +/** + * SubjectAccessReview checks whether or not a user or group can perform an action. + * +k8s:supportsSubresource="/status" + */ +export interface SubjectAccessReview { + /** + * metadata is the standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * spec holds information about the request being evaluated + * +required + */ + spec?: SubjectAccessReviewSpec | undefined; + /** + * status is filled in by the server and indicates whether the request is allowed or not + * +optional + */ + status?: SubjectAccessReviewStatus | undefined; +} + +/** + * SubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes + * and nonResourceAttributes must be set + */ +export interface SubjectAccessReviewSpec { + /** + * resourceAttributes describes information for a resource access request + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:unionMember + */ + resourceAttributes?: ResourceAttributes | undefined; + /** + * nonResourceAttributes describes information for a non-resource access request + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:unionMember + */ + nonResourceAttributes?: NonResourceAttributes | undefined; + /** + * user is the user you're testing for. + * If you specify "User" but not "Groups", then is it interpreted as "What if User were not a member of any groups + * +optional + */ + user?: string | undefined; + /** + * groups is the groups you're testing for. + * +optional + * +listType=atomic + */ + groups: string[]; + /** + * extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer + * it needs a reflection here. + * +optional + */ + extra: { [key: string]: ExtraValue }; + /** + * uid information about the requesting user. + * +optional + */ + uid?: string | undefined; +} + +export interface SubjectAccessReviewSpec_ExtraEntry { + key: string; + value: ExtraValue | undefined; +} + +/** SubjectAccessReviewStatus */ +export interface SubjectAccessReviewStatus { + /** + * allowed is set to true if the action is allowed, and should be set to false otherwise. + * +optional + */ + allowed?: boolean | undefined; + /** + * denied is optional. True if the action would be denied, otherwise + * false. If both allowed is false and denied is false, then the + * authorizer has no opinion on whether to authorize the action. Denied + * may not be true if Allowed is true. + * +optional + */ + denied?: boolean | undefined; + /** + * reason is optional. It indicates why a request was allowed or denied. + * +optional + */ + reason?: string | undefined; + /** + * evaluationError is an indication that some error occurred during the authorization check. + * It is entirely possible to get an error and be able to continue determine authorization status in spite of it. + * For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request. + * +optional + */ + evaluationError?: string | undefined; +} + +/** + * SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on + * the set of authorizers the server is configured with and any errors experienced during evaluation. + * Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, + * even if that list is incomplete. + */ +export interface SubjectRulesReviewStatus { + /** + * resourceRules is the list of actions the subject is allowed to perform on resources. + * The list ordering isn't significant, may contain duplicates, and possibly be incomplete. + * +optional + * +listType=atomic + */ + resourceRules: ResourceRule[]; + /** + * nonResourceRules is the list of actions the subject is allowed to perform on non-resources. + * The list ordering isn't significant, may contain duplicates, and possibly be incomplete. + * +optional + * +listType=atomic + */ + nonResourceRules: NonResourceRule[]; + /** + * incomplete is true when the rules returned by this call are incomplete. This is most commonly + * encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation. + * +optional + */ + incomplete?: boolean | undefined; + /** + * evaluationError can appear in combination with Rules. It indicates an error occurred during + * rule evaluation, such as an authorizer that doesn't support rule evaluation, and that + * ResourceRules and/or NonResourceRules may be incomplete. + * +optional + */ + evaluationError?: string | undefined; +} + +function createBaseExtraValue(): ExtraValue { + return { items: [] }; +} + +export const ExtraValue: MessageFns = { + encode(message: ExtraValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.items) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtraValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtraValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.items.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ExtraValue { + return { + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ExtraValue): unknown { + const obj: any = {}; + if (message.items?.length) { + obj.items = message.items; + } + return obj; + }, + + create, I>>(base?: I): ExtraValue { + return ExtraValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtraValue { + const message = createBaseExtraValue(); + message.items = object.items?.map((e) => e) || []; + return message; + }, +}; + +function createBaseFieldSelectorAttributes(): FieldSelectorAttributes { + return { rawSelector: '', requirements: [] }; +} + +export const FieldSelectorAttributes: MessageFns = { + encode(message: FieldSelectorAttributes, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rawSelector !== undefined && message.rawSelector !== '') { + writer.uint32(10).string(message.rawSelector); + } + for (const v of message.requirements) { + FieldSelectorRequirement.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldSelectorAttributes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldSelectorAttributes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.rawSelector = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.requirements.push(FieldSelectorRequirement.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FieldSelectorAttributes { + return { + rawSelector: isSet(object.rawSelector) ? globalThis.String(object.rawSelector) : '', + requirements: globalThis.Array.isArray(object?.requirements) + ? object.requirements.map((e: any) => FieldSelectorRequirement.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FieldSelectorAttributes): unknown { + const obj: any = {}; + if (message.rawSelector !== undefined && message.rawSelector !== '') { + obj.rawSelector = message.rawSelector; + } + if (message.requirements?.length) { + obj.requirements = message.requirements.map((e) => FieldSelectorRequirement.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FieldSelectorAttributes { + return FieldSelectorAttributes.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FieldSelectorAttributes { + const message = createBaseFieldSelectorAttributes(); + message.rawSelector = object.rawSelector ?? ''; + message.requirements = object.requirements?.map((e) => FieldSelectorRequirement.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseLabelSelectorAttributes(): LabelSelectorAttributes { + return { rawSelector: '', requirements: [] }; +} + +export const LabelSelectorAttributes: MessageFns = { + encode(message: LabelSelectorAttributes, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rawSelector !== undefined && message.rawSelector !== '') { + writer.uint32(10).string(message.rawSelector); + } + for (const v of message.requirements) { + LabelSelectorRequirement.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LabelSelectorAttributes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLabelSelectorAttributes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.rawSelector = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.requirements.push(LabelSelectorRequirement.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LabelSelectorAttributes { + return { + rawSelector: isSet(object.rawSelector) ? globalThis.String(object.rawSelector) : '', + requirements: globalThis.Array.isArray(object?.requirements) + ? object.requirements.map((e: any) => LabelSelectorRequirement.fromJSON(e)) + : [], + }; + }, + + toJSON(message: LabelSelectorAttributes): unknown { + const obj: any = {}; + if (message.rawSelector !== undefined && message.rawSelector !== '') { + obj.rawSelector = message.rawSelector; + } + if (message.requirements?.length) { + obj.requirements = message.requirements.map((e) => LabelSelectorRequirement.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LabelSelectorAttributes { + return LabelSelectorAttributes.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): LabelSelectorAttributes { + const message = createBaseLabelSelectorAttributes(); + message.rawSelector = object.rawSelector ?? ''; + message.requirements = object.requirements?.map((e) => LabelSelectorRequirement.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseLocalSubjectAccessReview(): LocalSubjectAccessReview { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const LocalSubjectAccessReview: MessageFns = { + encode(message: LocalSubjectAccessReview, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + SubjectAccessReviewSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + SubjectAccessReviewStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LocalSubjectAccessReview { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLocalSubjectAccessReview(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = SubjectAccessReviewSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = SubjectAccessReviewStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LocalSubjectAccessReview { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? SubjectAccessReviewSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? SubjectAccessReviewStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: LocalSubjectAccessReview): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = SubjectAccessReviewSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = SubjectAccessReviewStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): LocalSubjectAccessReview { + return LocalSubjectAccessReview.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): LocalSubjectAccessReview { + const message = createBaseLocalSubjectAccessReview(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? SubjectAccessReviewSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? SubjectAccessReviewStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseNonResourceAttributes(): NonResourceAttributes { + return { path: '', verb: '' }; +} + +export const NonResourceAttributes: MessageFns = { + encode(message: NonResourceAttributes, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined && message.path !== '') { + writer.uint32(10).string(message.path); + } + if (message.verb !== undefined && message.verb !== '') { + writer.uint32(18).string(message.verb); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NonResourceAttributes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNonResourceAttributes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.verb = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NonResourceAttributes { + return { + path: isSet(object.path) ? globalThis.String(object.path) : '', + verb: isSet(object.verb) ? globalThis.String(object.verb) : '', + }; + }, + + toJSON(message: NonResourceAttributes): unknown { + const obj: any = {}; + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.verb !== undefined && message.verb !== '') { + obj.verb = message.verb; + } + return obj; + }, + + create, I>>(base?: I): NonResourceAttributes { + return NonResourceAttributes.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NonResourceAttributes { + const message = createBaseNonResourceAttributes(); + message.path = object.path ?? ''; + message.verb = object.verb ?? ''; + return message; + }, +}; + +function createBaseNonResourceRule(): NonResourceRule { + return { verbs: [], nonResourceURLs: [] }; +} + +export const NonResourceRule: MessageFns = { + encode(message: NonResourceRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.verbs) { + writer.uint32(10).string(v!); + } + for (const v of message.nonResourceURLs) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NonResourceRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNonResourceRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.verbs.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.nonResourceURLs.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NonResourceRule { + return { + verbs: globalThis.Array.isArray(object?.verbs) + ? object.verbs.map((e: any) => globalThis.String(e)) + : [], + nonResourceURLs: globalThis.Array.isArray(object?.nonResourceURLs) + ? object.nonResourceURLs.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: NonResourceRule): unknown { + const obj: any = {}; + if (message.verbs?.length) { + obj.verbs = message.verbs; + } + if (message.nonResourceURLs?.length) { + obj.nonResourceURLs = message.nonResourceURLs; + } + return obj; + }, + + create, I>>(base?: I): NonResourceRule { + return NonResourceRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NonResourceRule { + const message = createBaseNonResourceRule(); + message.verbs = object.verbs?.map((e) => e) || []; + message.nonResourceURLs = object.nonResourceURLs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseResourceAttributes(): ResourceAttributes { + return { + namespace: '', + verb: '', + group: '', + version: '', + resource: '', + subresource: '', + name: '', + fieldSelector: undefined, + labelSelector: undefined, + }; +} + +export const ResourceAttributes: MessageFns = { + encode(message: ResourceAttributes, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(10).string(message.namespace); + } + if (message.verb !== undefined && message.verb !== '') { + writer.uint32(18).string(message.verb); + } + if (message.group !== undefined && message.group !== '') { + writer.uint32(26).string(message.group); + } + if (message.version !== undefined && message.version !== '') { + writer.uint32(34).string(message.version); + } + if (message.resource !== undefined && message.resource !== '') { + writer.uint32(42).string(message.resource); + } + if (message.subresource !== undefined && message.subresource !== '') { + writer.uint32(50).string(message.subresource); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(58).string(message.name); + } + if (message.fieldSelector !== undefined) { + FieldSelectorAttributes.encode(message.fieldSelector, writer.uint32(66).fork()).join(); + } + if (message.labelSelector !== undefined) { + LabelSelectorAttributes.encode(message.labelSelector, writer.uint32(74).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceAttributes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceAttributes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.namespace = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.verb = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.group = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.version = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.resource = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.subresource = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.name = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.fieldSelector = FieldSelectorAttributes.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.labelSelector = LabelSelectorAttributes.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceAttributes { + return { + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + verb: isSet(object.verb) ? globalThis.String(object.verb) : '', + group: isSet(object.group) ? globalThis.String(object.group) : '', + version: isSet(object.version) ? globalThis.String(object.version) : '', + resource: isSet(object.resource) ? globalThis.String(object.resource) : '', + subresource: isSet(object.subresource) ? globalThis.String(object.subresource) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + fieldSelector: isSet(object.fieldSelector) + ? FieldSelectorAttributes.fromJSON(object.fieldSelector) + : undefined, + labelSelector: isSet(object.labelSelector) + ? LabelSelectorAttributes.fromJSON(object.labelSelector) + : undefined, + }; + }, + + toJSON(message: ResourceAttributes): unknown { + const obj: any = {}; + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + if (message.verb !== undefined && message.verb !== '') { + obj.verb = message.verb; + } + if (message.group !== undefined && message.group !== '') { + obj.group = message.group; + } + if (message.version !== undefined && message.version !== '') { + obj.version = message.version; + } + if (message.resource !== undefined && message.resource !== '') { + obj.resource = message.resource; + } + if (message.subresource !== undefined && message.subresource !== '') { + obj.subresource = message.subresource; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.fieldSelector !== undefined) { + obj.fieldSelector = FieldSelectorAttributes.toJSON(message.fieldSelector); + } + if (message.labelSelector !== undefined) { + obj.labelSelector = LabelSelectorAttributes.toJSON(message.labelSelector); + } + return obj; + }, + + create, I>>(base?: I): ResourceAttributes { + return ResourceAttributes.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceAttributes { + const message = createBaseResourceAttributes(); + message.namespace = object.namespace ?? ''; + message.verb = object.verb ?? ''; + message.group = object.group ?? ''; + message.version = object.version ?? ''; + message.resource = object.resource ?? ''; + message.subresource = object.subresource ?? ''; + message.name = object.name ?? ''; + message.fieldSelector = + object.fieldSelector !== undefined && object.fieldSelector !== null + ? FieldSelectorAttributes.fromPartial(object.fieldSelector) + : undefined; + message.labelSelector = + object.labelSelector !== undefined && object.labelSelector !== null + ? LabelSelectorAttributes.fromPartial(object.labelSelector) + : undefined; + return message; + }, +}; + +function createBaseResourceRule(): ResourceRule { + return { verbs: [], apiGroups: [], resources: [], resourceNames: [] }; +} + +export const ResourceRule: MessageFns = { + encode(message: ResourceRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.verbs) { + writer.uint32(10).string(v!); + } + for (const v of message.apiGroups) { + writer.uint32(18).string(v!); + } + for (const v of message.resources) { + writer.uint32(26).string(v!); + } + for (const v of message.resourceNames) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.verbs.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.apiGroups.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.resources.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.resourceNames.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceRule { + return { + verbs: globalThis.Array.isArray(object?.verbs) + ? object.verbs.map((e: any) => globalThis.String(e)) + : [], + apiGroups: globalThis.Array.isArray(object?.apiGroups) + ? object.apiGroups.map((e: any) => globalThis.String(e)) + : [], + resources: globalThis.Array.isArray(object?.resources) + ? object.resources.map((e: any) => globalThis.String(e)) + : [], + resourceNames: globalThis.Array.isArray(object?.resourceNames) + ? object.resourceNames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ResourceRule): unknown { + const obj: any = {}; + if (message.verbs?.length) { + obj.verbs = message.verbs; + } + if (message.apiGroups?.length) { + obj.apiGroups = message.apiGroups; + } + if (message.resources?.length) { + obj.resources = message.resources; + } + if (message.resourceNames?.length) { + obj.resourceNames = message.resourceNames; + } + return obj; + }, + + create, I>>(base?: I): ResourceRule { + return ResourceRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceRule { + const message = createBaseResourceRule(); + message.verbs = object.verbs?.map((e) => e) || []; + message.apiGroups = object.apiGroups?.map((e) => e) || []; + message.resources = object.resources?.map((e) => e) || []; + message.resourceNames = object.resourceNames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSelfSubjectAccessReview(): SelfSubjectAccessReview { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const SelfSubjectAccessReview: MessageFns = { + encode(message: SelfSubjectAccessReview, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + SelfSubjectAccessReviewSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + SubjectAccessReviewStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SelfSubjectAccessReview { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSelfSubjectAccessReview(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = SelfSubjectAccessReviewSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = SubjectAccessReviewStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SelfSubjectAccessReview { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? SelfSubjectAccessReviewSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? SubjectAccessReviewStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: SelfSubjectAccessReview): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = SelfSubjectAccessReviewSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = SubjectAccessReviewStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): SelfSubjectAccessReview { + return SelfSubjectAccessReview.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SelfSubjectAccessReview { + const message = createBaseSelfSubjectAccessReview(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? SelfSubjectAccessReviewSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? SubjectAccessReviewStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseSelfSubjectAccessReviewSpec(): SelfSubjectAccessReviewSpec { + return { resourceAttributes: undefined, nonResourceAttributes: undefined }; +} + +export const SelfSubjectAccessReviewSpec: MessageFns = { + encode(message: SelfSubjectAccessReviewSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.resourceAttributes !== undefined) { + ResourceAttributes.encode(message.resourceAttributes, writer.uint32(10).fork()).join(); + } + if (message.nonResourceAttributes !== undefined) { + NonResourceAttributes.encode(message.nonResourceAttributes, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SelfSubjectAccessReviewSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSelfSubjectAccessReviewSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resourceAttributes = ResourceAttributes.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.nonResourceAttributes = NonResourceAttributes.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SelfSubjectAccessReviewSpec { + return { + resourceAttributes: isSet(object.resourceAttributes) + ? ResourceAttributes.fromJSON(object.resourceAttributes) + : undefined, + nonResourceAttributes: isSet(object.nonResourceAttributes) + ? NonResourceAttributes.fromJSON(object.nonResourceAttributes) + : undefined, + }; + }, + + toJSON(message: SelfSubjectAccessReviewSpec): unknown { + const obj: any = {}; + if (message.resourceAttributes !== undefined) { + obj.resourceAttributes = ResourceAttributes.toJSON(message.resourceAttributes); + } + if (message.nonResourceAttributes !== undefined) { + obj.nonResourceAttributes = NonResourceAttributes.toJSON(message.nonResourceAttributes); + } + return obj; + }, + + create, I>>( + base?: I, + ): SelfSubjectAccessReviewSpec { + return SelfSubjectAccessReviewSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SelfSubjectAccessReviewSpec { + const message = createBaseSelfSubjectAccessReviewSpec(); + message.resourceAttributes = + object.resourceAttributes !== undefined && object.resourceAttributes !== null + ? ResourceAttributes.fromPartial(object.resourceAttributes) + : undefined; + message.nonResourceAttributes = + object.nonResourceAttributes !== undefined && object.nonResourceAttributes !== null + ? NonResourceAttributes.fromPartial(object.nonResourceAttributes) + : undefined; + return message; + }, +}; + +function createBaseSelfSubjectRulesReview(): SelfSubjectRulesReview { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const SelfSubjectRulesReview: MessageFns = { + encode(message: SelfSubjectRulesReview, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + SelfSubjectRulesReviewSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + SubjectRulesReviewStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SelfSubjectRulesReview { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSelfSubjectRulesReview(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = SelfSubjectRulesReviewSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = SubjectRulesReviewStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SelfSubjectRulesReview { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? SelfSubjectRulesReviewSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? SubjectRulesReviewStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: SelfSubjectRulesReview): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = SelfSubjectRulesReviewSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = SubjectRulesReviewStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): SelfSubjectRulesReview { + return SelfSubjectRulesReview.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SelfSubjectRulesReview { + const message = createBaseSelfSubjectRulesReview(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? SelfSubjectRulesReviewSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? SubjectRulesReviewStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseSelfSubjectRulesReviewSpec(): SelfSubjectRulesReviewSpec { + return { namespace: '' }; +} + +export const SelfSubjectRulesReviewSpec: MessageFns = { + encode(message: SelfSubjectRulesReviewSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(10).string(message.namespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SelfSubjectRulesReviewSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSelfSubjectRulesReviewSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.namespace = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SelfSubjectRulesReviewSpec { + return { namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '' }; + }, + + toJSON(message: SelfSubjectRulesReviewSpec): unknown { + const obj: any = {}; + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + return obj; + }, + + create, I>>( + base?: I, + ): SelfSubjectRulesReviewSpec { + return SelfSubjectRulesReviewSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SelfSubjectRulesReviewSpec { + const message = createBaseSelfSubjectRulesReviewSpec(); + message.namespace = object.namespace ?? ''; + return message; + }, +}; + +function createBaseSubjectAccessReview(): SubjectAccessReview { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const SubjectAccessReview: MessageFns = { + encode(message: SubjectAccessReview, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + SubjectAccessReviewSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + SubjectAccessReviewStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SubjectAccessReview { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubjectAccessReview(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = SubjectAccessReviewSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = SubjectAccessReviewStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SubjectAccessReview { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? SubjectAccessReviewSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? SubjectAccessReviewStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: SubjectAccessReview): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = SubjectAccessReviewSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = SubjectAccessReviewStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): SubjectAccessReview { + return SubjectAccessReview.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SubjectAccessReview { + const message = createBaseSubjectAccessReview(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? SubjectAccessReviewSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? SubjectAccessReviewStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseSubjectAccessReviewSpec(): SubjectAccessReviewSpec { + return { + resourceAttributes: undefined, + nonResourceAttributes: undefined, + user: '', + groups: [], + extra: {}, + uid: '', + }; +} + +export const SubjectAccessReviewSpec: MessageFns = { + encode(message: SubjectAccessReviewSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.resourceAttributes !== undefined) { + ResourceAttributes.encode(message.resourceAttributes, writer.uint32(10).fork()).join(); + } + if (message.nonResourceAttributes !== undefined) { + NonResourceAttributes.encode(message.nonResourceAttributes, writer.uint32(18).fork()).join(); + } + if (message.user !== undefined && message.user !== '') { + writer.uint32(26).string(message.user); + } + for (const v of message.groups) { + writer.uint32(34).string(v!); + } + globalThis.Object.entries(message.extra).forEach(([key, value]: [string, ExtraValue]) => { + SubjectAccessReviewSpec_ExtraEntry.encode( + { key: key as any, value }, + writer.uint32(42).fork(), + ).join(); + }); + if (message.uid !== undefined && message.uid !== '') { + writer.uint32(50).string(message.uid); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SubjectAccessReviewSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubjectAccessReviewSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resourceAttributes = ResourceAttributes.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.nonResourceAttributes = NonResourceAttributes.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.user = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.groups.push(reader.string()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + const entry5 = SubjectAccessReviewSpec_ExtraEntry.decode(reader, reader.uint32()); + if (entry5.value !== undefined) { + message.extra[entry5.key] = entry5.value; + } + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.uid = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SubjectAccessReviewSpec { + return { + resourceAttributes: isSet(object.resourceAttributes) + ? ResourceAttributes.fromJSON(object.resourceAttributes) + : undefined, + nonResourceAttributes: isSet(object.nonResourceAttributes) + ? NonResourceAttributes.fromJSON(object.nonResourceAttributes) + : undefined, + user: isSet(object.user) ? globalThis.String(object.user) : '', + groups: globalThis.Array.isArray(object?.groups) + ? object.groups.map((e: any) => globalThis.String(e)) + : [], + extra: isObject(object.extra) + ? (globalThis.Object.entries(object.extra) as [string, any][]).reduce( + (acc: { [key: string]: ExtraValue }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: ExtraValue.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + uid: isSet(object.uid) ? globalThis.String(object.uid) : '', + }; + }, + + toJSON(message: SubjectAccessReviewSpec): unknown { + const obj: any = {}; + if (message.resourceAttributes !== undefined) { + obj.resourceAttributes = ResourceAttributes.toJSON(message.resourceAttributes); + } + if (message.nonResourceAttributes !== undefined) { + obj.nonResourceAttributes = NonResourceAttributes.toJSON(message.nonResourceAttributes); + } + if (message.user !== undefined && message.user !== '') { + obj.user = message.user; + } + if (message.groups?.length) { + obj.groups = message.groups; + } + if (message.extra) { + const entries = globalThis.Object.entries(message.extra) as [string, ExtraValue][]; + if (entries.length > 0) { + obj.extra = {}; + entries.forEach(([k, v]) => { + obj.extra[k] = ExtraValue.toJSON(v); + }); + } + } + if (message.uid !== undefined && message.uid !== '') { + obj.uid = message.uid; + } + return obj; + }, + + create, I>>(base?: I): SubjectAccessReviewSpec { + return SubjectAccessReviewSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SubjectAccessReviewSpec { + const message = createBaseSubjectAccessReviewSpec(); + message.resourceAttributes = + object.resourceAttributes !== undefined && object.resourceAttributes !== null + ? ResourceAttributes.fromPartial(object.resourceAttributes) + : undefined; + message.nonResourceAttributes = + object.nonResourceAttributes !== undefined && object.nonResourceAttributes !== null + ? NonResourceAttributes.fromPartial(object.nonResourceAttributes) + : undefined; + message.user = object.user ?? ''; + message.groups = object.groups?.map((e) => e) || []; + message.extra = (globalThis.Object.entries(object.extra ?? {}) as [string, ExtraValue][]).reduce( + (acc: { [key: string]: ExtraValue }, [key, value]: [string, ExtraValue]) => { + if (value !== undefined) { + acc[key] = ExtraValue.fromPartial(value); + } + return acc; + }, + {}, + ); + message.uid = object.uid ?? ''; + return message; + }, +}; + +function createBaseSubjectAccessReviewSpec_ExtraEntry(): SubjectAccessReviewSpec_ExtraEntry { + return { key: '', value: undefined }; +} + +export const SubjectAccessReviewSpec_ExtraEntry: MessageFns = { + encode( + message: SubjectAccessReviewSpec_ExtraEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ExtraValue.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SubjectAccessReviewSpec_ExtraEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubjectAccessReviewSpec_ExtraEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = ExtraValue.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SubjectAccessReviewSpec_ExtraEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? ExtraValue.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: SubjectAccessReviewSpec_ExtraEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ExtraValue.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): SubjectAccessReviewSpec_ExtraEntry { + return SubjectAccessReviewSpec_ExtraEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SubjectAccessReviewSpec_ExtraEntry { + const message = createBaseSubjectAccessReviewSpec_ExtraEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? ExtraValue.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseSubjectAccessReviewStatus(): SubjectAccessReviewStatus { + return { allowed: false, denied: false, reason: '', evaluationError: '' }; +} + +export const SubjectAccessReviewStatus: MessageFns = { + encode(message: SubjectAccessReviewStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowed !== undefined && message.allowed !== false) { + writer.uint32(8).bool(message.allowed); + } + if (message.denied !== undefined && message.denied !== false) { + writer.uint32(32).bool(message.denied); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(18).string(message.reason); + } + if (message.evaluationError !== undefined && message.evaluationError !== '') { + writer.uint32(26).string(message.evaluationError); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SubjectAccessReviewStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubjectAccessReviewStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.allowed = reader.bool(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.denied = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.reason = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.evaluationError = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SubjectAccessReviewStatus { + return { + allowed: isSet(object.allowed) ? globalThis.Boolean(object.allowed) : false, + denied: isSet(object.denied) ? globalThis.Boolean(object.denied) : false, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + evaluationError: isSet(object.evaluationError) ? globalThis.String(object.evaluationError) : '', + }; + }, + + toJSON(message: SubjectAccessReviewStatus): unknown { + const obj: any = {}; + if (message.allowed !== undefined && message.allowed !== false) { + obj.allowed = message.allowed; + } + if (message.denied !== undefined && message.denied !== false) { + obj.denied = message.denied; + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.evaluationError !== undefined && message.evaluationError !== '') { + obj.evaluationError = message.evaluationError; + } + return obj; + }, + + create, I>>(base?: I): SubjectAccessReviewStatus { + return SubjectAccessReviewStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SubjectAccessReviewStatus { + const message = createBaseSubjectAccessReviewStatus(); + message.allowed = object.allowed ?? false; + message.denied = object.denied ?? false; + message.reason = object.reason ?? ''; + message.evaluationError = object.evaluationError ?? ''; + return message; + }, +}; + +function createBaseSubjectRulesReviewStatus(): SubjectRulesReviewStatus { + return { resourceRules: [], nonResourceRules: [], incomplete: false, evaluationError: '' }; +} + +export const SubjectRulesReviewStatus: MessageFns = { + encode(message: SubjectRulesReviewStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.resourceRules) { + ResourceRule.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.nonResourceRules) { + NonResourceRule.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.incomplete !== undefined && message.incomplete !== false) { + writer.uint32(24).bool(message.incomplete); + } + if (message.evaluationError !== undefined && message.evaluationError !== '') { + writer.uint32(34).string(message.evaluationError); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SubjectRulesReviewStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubjectRulesReviewStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resourceRules.push(ResourceRule.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.nonResourceRules.push(NonResourceRule.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.incomplete = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.evaluationError = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SubjectRulesReviewStatus { + return { + resourceRules: globalThis.Array.isArray(object?.resourceRules) + ? object.resourceRules.map((e: any) => ResourceRule.fromJSON(e)) + : [], + nonResourceRules: globalThis.Array.isArray(object?.nonResourceRules) + ? object.nonResourceRules.map((e: any) => NonResourceRule.fromJSON(e)) + : [], + incomplete: isSet(object.incomplete) ? globalThis.Boolean(object.incomplete) : false, + evaluationError: isSet(object.evaluationError) ? globalThis.String(object.evaluationError) : '', + }; + }, + + toJSON(message: SubjectRulesReviewStatus): unknown { + const obj: any = {}; + if (message.resourceRules?.length) { + obj.resourceRules = message.resourceRules.map((e) => ResourceRule.toJSON(e)); + } + if (message.nonResourceRules?.length) { + obj.nonResourceRules = message.nonResourceRules.map((e) => NonResourceRule.toJSON(e)); + } + if (message.incomplete !== undefined && message.incomplete !== false) { + obj.incomplete = message.incomplete; + } + if (message.evaluationError !== undefined && message.evaluationError !== '') { + obj.evaluationError = message.evaluationError; + } + return obj; + }, + + create, I>>(base?: I): SubjectRulesReviewStatus { + return SubjectRulesReviewStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SubjectRulesReviewStatus { + const message = createBaseSubjectRulesReviewStatus(); + message.resourceRules = object.resourceRules?.map((e) => ResourceRule.fromPartial(e)) || []; + message.nonResourceRules = object.nonResourceRules?.map((e) => NonResourceRule.fromPartial(e)) || []; + message.incomplete = object.incomplete ?? false; + message.evaluationError = object.evaluationError ?? ''; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/autoscaling/v1/generated.ts b/src/proto/generated/k8s.io/api/autoscaling/v1/generated.ts new file mode 100644 index 00000000000..79f0d98b95e --- /dev/null +++ b/src/proto/generated/k8s.io/api/autoscaling/v1/generated.ts @@ -0,0 +1,3264 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/autoscaling/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { Quantity } from '../../../apimachinery/pkg/api/resource/generated.js'; +import { + LabelSelector, + ListMeta, + ObjectMeta, + Time, +} from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** + * ContainerResourceMetricSource indicates how to scale on a resource metric known to + * Kubernetes, as specified in the requests and limits, describing a single container in + * each of the pods of the current scale target(e.g. CPU or memory). The values will be + * averaged together before being compared to the target. Such metrics are built into + * Kubernetes, and have special scaling options on top of those available to + * normal per-pod metrics using the "pods" source. Only one "target" type + * should be set. + */ +export interface ContainerResourceMetricSource { + /** name is the name of the resource in question. */ + name?: string | undefined; + /** + * targetAverageUtilization is the target value of the average of the + * resource metric across all relevant pods, represented as a percentage of + * the requested value of the resource for the pods. + * +optional + */ + targetAverageUtilization?: number | undefined; + /** + * targetAverageValue is the target value of the average of the + * resource metric across all relevant pods, as a raw value (instead of as + * a percentage of the request), similar to the "pods" metric source type. + * +optional + */ + targetAverageValue?: Quantity | undefined; + /** container is the name of the container in the pods of the scaling target. */ + container?: string | undefined; +} + +/** + * ContainerResourceMetricStatus indicates the current value of a resource metric known to + * Kubernetes, as specified in requests and limits, describing a single container in each pod in the + * current scale target (e.g. CPU or memory). Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available to + * normal per-pod metrics using the "pods" source. + */ +export interface ContainerResourceMetricStatus { + /** name is the name of the resource in question. */ + name?: string | undefined; + /** + * currentAverageUtilization is the current value of the average of the + * resource metric across all relevant pods, represented as a percentage of + * the requested value of the resource for the pods. It will only be + * present if `targetAverageValue` was set in the corresponding metric + * specification. + * +optional + */ + currentAverageUtilization?: number | undefined; + /** + * currentAverageValue is the current value of the average of the + * resource metric across all relevant pods, as a raw value (instead of as + * a percentage of the request), similar to the "pods" metric source type. + * It will always be set, regardless of the corresponding metric specification. + */ + currentAverageValue?: Quantity | undefined; + /** container is the name of the container in the pods of the scaling taget */ + container?: string | undefined; +} + +/** + * CrossVersionObjectReference contains enough information to let you identify the referred resource. + * +structType=atomic + */ +export interface CrossVersionObjectReference { + /** + * kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +k8s:alpha(since: "1.37")=+k8s:required + */ + kind?: string | undefined; + /** + * name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + * +k8s:alpha(since: "1.37")=+k8s:required + */ + name?: string | undefined; + /** + * apiVersion is the API version of the referent + * +optional + */ + apiVersion?: string | undefined; +} + +/** + * ExternalMetricSource indicates how to scale on a metric not associated with + * any Kubernetes object (for example length of queue in cloud + * messaging service, or QPS from loadbalancer running outside of cluster). + */ +export interface ExternalMetricSource { + /** metricName is the name of the metric in question. */ + metricName?: string | undefined; + /** + * metricSelector is used to identify a specific time series + * within a given metric. + * +optional + */ + metricSelector?: LabelSelector | undefined; + /** + * targetValue is the target value of the metric (as a quantity). + * Mutually exclusive with TargetAverageValue. + * +optional + */ + targetValue?: Quantity | undefined; + /** + * targetAverageValue is the target per-pod value of global metric (as a quantity). + * Mutually exclusive with TargetValue. + * +optional + */ + targetAverageValue?: Quantity | undefined; +} + +/** + * ExternalMetricStatus indicates the current value of a global metric + * not associated with any Kubernetes object. + */ +export interface ExternalMetricStatus { + /** + * metricName is the name of a metric used for autoscaling in + * metric system. + */ + metricName?: string | undefined; + /** + * metricSelector is used to identify a specific time series + * within a given metric. + * +optional + */ + metricSelector?: LabelSelector | undefined; + /** currentValue is the current value of the metric (as a quantity) */ + currentValue?: Quantity | undefined; + /** + * currentAverageValue is the current value of metric averaged over autoscaled pods. + * +optional + */ + currentAverageValue?: Quantity | undefined; +} + +/** + * configuration of a horizontal pod autoscaler. + * +k8s:supportsSubresource="/status" + */ +export interface HorizontalPodAutoscaler { + /** + * metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec defines the behaviour of autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. + * +required + */ + spec?: HorizontalPodAutoscalerSpec | undefined; + /** + * status is the current information about the autoscaler. + * +optional + */ + status?: HorizontalPodAutoscalerStatus | undefined; +} + +/** + * HorizontalPodAutoscalerCondition describes the state of + * a HorizontalPodAutoscaler at a certain point. + */ +export interface HorizontalPodAutoscalerCondition { + /** type describes the current condition */ + type?: string | undefined; + /** status is the status of the condition (True, False, Unknown) */ + status?: string | undefined; + /** + * lastTransitionTime is the last time the condition transitioned from + * one status to another + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * reason is the reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * message is a human-readable explanation containing details about + * the transition + * +optional + */ + message?: string | undefined; + /** + * observedGeneration represents the .metadata.generation that the condition was set based upon. + * For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + * with respect to the current state of the instance. + * +optional + */ + observedGeneration?: number | undefined; +} + +/** list of horizontal pod autoscaler objects. */ +export interface HorizontalPodAutoscalerList { + /** + * Standard list metadata. + * +optional + */ + metadata?: ListMeta | undefined; + /** items is the list of horizontal pod autoscaler objects. */ + items: HorizontalPodAutoscaler[]; +} + +/** specification of a horizontal pod autoscaler. */ +export interface HorizontalPodAutoscalerSpec { + /** + * scaleTargetRef is the reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption + * and will set the desired number of pods by using its Scale subresource. + */ + scaleTargetRef?: CrossVersionObjectReference | undefined; + /** + * minReplicas is the lower limit for the number of replicas to which the autoscaler + * can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the + * alpha feature gate HPAScaleToZero is enabled and at least one Object or External + * metric is configured. Scaling is active as long as at least one metric value is + * available. + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 + * +k8s:beta(since: "1.37")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 + */ + minReplicas?: number | undefined; + /** + * maxReplicas is the upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas. + * +required + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:minimum=1 + */ + maxReplicas?: number | undefined; + /** + * targetCPUUtilizationPercentage is the target average CPU utilization (represented as a percentage of requested CPU) over all the pods; + * if not specified the default autoscaling policy will be used. + * +optional + */ + targetCPUUtilizationPercentage?: number | undefined; +} + +/** current status of a horizontal pod autoscaler */ +export interface HorizontalPodAutoscalerStatus { + /** + * observedGeneration is the most recent generation observed by this autoscaler. + * +optional + */ + observedGeneration?: number | undefined; + /** + * lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods; + * used by the autoscaler to control how often the number of pods is changed. + * +optional + */ + lastScaleTime?: Time | undefined; + /** currentReplicas is the current number of replicas of pods managed by this autoscaler. */ + currentReplicas?: number | undefined; + /** desiredReplicas is the desired number of replicas of pods managed by this autoscaler. */ + desiredReplicas?: number | undefined; + /** + * currentCPUUtilizationPercentage is the current average CPU utilization over all pods, represented as a percentage of requested CPU, + * e.g. 70 means that an average pod is using now 70% of its requested CPU. + * +optional + */ + currentCPUUtilizationPercentage?: number | undefined; +} + +/** + * MetricSpec specifies how to scale based on a single metric + * (only `type` and one other matching field should be set at once). + */ +export interface MetricSpec { + /** + * type is the type of metric source. It should be one of "ContainerResource", + * "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. + */ + type?: string | undefined; + /** + * object refers to a metric describing a single kubernetes object + * (for example, hits-per-second on an Ingress object). + * +optional + */ + object?: ObjectMetricSource | undefined; + /** + * pods refers to a metric describing each pod in the current scale target + * (for example, transactions-processed-per-second). The values will be + * averaged together before being compared to the target value. + * +optional + */ + pods?: PodsMetricSource | undefined; + /** + * resource refers to a resource metric (such as those specified in + * requests and limits) known to Kubernetes describing each pod in the + * current scale target (e.g. CPU or memory). Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available + * to normal per-pod metrics using the "pods" source. + * +optional + */ + resource?: ResourceMetricSource | undefined; + /** + * containerResource refers to a resource metric (such as those specified in + * requests and limits) known to Kubernetes describing a single container in each pod of the + * current scale target (e.g. CPU or memory). Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available + * to normal per-pod metrics using the "pods" source. + * +optional + */ + containerResource?: ContainerResourceMetricSource | undefined; + /** + * external refers to a global metric that is not associated + * with any Kubernetes object. It allows autoscaling based on information + * coming from components running outside of cluster + * (for example length of queue in cloud messaging service, or + * QPS from loadbalancer running outside of cluster). + * +optional + */ + external?: ExternalMetricSource | undefined; +} + +/** MetricStatus describes the last-read state of a single metric. */ +export interface MetricStatus { + /** + * type is the type of metric source. It will be one of "ContainerResource", + * "External", "Object", "Pods" or "Resource", each corresponds to a matching field in the object. + */ + type?: string | undefined; + /** + * object refers to a metric describing a single kubernetes object + * (for example, hits-per-second on an Ingress object). + * +optional + */ + object?: ObjectMetricStatus | undefined; + /** + * pods refers to a metric describing each pod in the current scale target + * (for example, transactions-processed-per-second). The values will be + * averaged together before being compared to the target value. + * +optional + */ + pods?: PodsMetricStatus | undefined; + /** + * resource refers to a resource metric (such as those specified in + * requests and limits) known to Kubernetes describing each pod in the + * current scale target (e.g. CPU or memory). Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available + * to normal per-pod metrics using the "pods" source. + * +optional + */ + resource?: ResourceMetricStatus | undefined; + /** + * containerResource refers to a resource metric (such as those specified in + * requests and limits) known to Kubernetes describing a single container in each pod in the + * current scale target (e.g. CPU or memory). Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available + * to normal per-pod metrics using the "pods" source. + * +optional + */ + containerResource?: ContainerResourceMetricStatus | undefined; + /** + * external refers to a global metric that is not associated + * with any Kubernetes object. It allows autoscaling based on information + * coming from components running outside of cluster + * (for example length of queue in cloud messaging service, or + * QPS from loadbalancer running outside of cluster). + * +optional + */ + external?: ExternalMetricStatus | undefined; +} + +/** + * ObjectMetricSource indicates how to scale on a metric describing a + * kubernetes object (for example, hits-per-second on an Ingress object). + */ +export interface ObjectMetricSource { + /** target is the described Kubernetes object. */ + target?: CrossVersionObjectReference | undefined; + /** metricName is the name of the metric in question. */ + metricName?: string | undefined; + /** targetValue is the target value of the metric (as a quantity). */ + targetValue?: Quantity | undefined; + /** + * selector is the string-encoded form of a standard kubernetes label selector for the given metric. + * When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping + * When unset, just the metricName will be used to gather metrics. + * +optional + */ + selector?: LabelSelector | undefined; + /** + * averageValue is the target value of the average of the + * metric across all relevant pods (as a quantity) + * +optional + */ + averageValue?: Quantity | undefined; +} + +/** + * ObjectMetricStatus indicates the current value of a metric describing a + * kubernetes object (for example, hits-per-second on an Ingress object). + */ +export interface ObjectMetricStatus { + /** target is the described Kubernetes object. */ + target?: CrossVersionObjectReference | undefined; + /** metricName is the name of the metric in question. */ + metricName?: string | undefined; + /** currentValue is the current value of the metric (as a quantity). */ + currentValue?: Quantity | undefined; + /** + * selector is the string-encoded form of a standard kubernetes label selector for the given metric + * When set in the ObjectMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping. + * When unset, just the metricName will be used to gather metrics. + * +optional + */ + selector?: LabelSelector | undefined; + /** + * averageValue is the current value of the average of the + * metric across all relevant pods (as a quantity) + * +optional + */ + averageValue?: Quantity | undefined; +} + +/** + * PodsMetricSource indicates how to scale on a metric describing each pod in + * the current scale target (for example, transactions-processed-per-second). + * The values will be averaged together before being compared to the target + * value. + */ +export interface PodsMetricSource { + /** metricName is the name of the metric in question */ + metricName?: string | undefined; + /** + * targetAverageValue is the target value of the average of the + * metric across all relevant pods (as a quantity) + */ + targetAverageValue?: Quantity | undefined; + /** + * selector is the string-encoded form of a standard kubernetes label selector for the given metric + * When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping + * When unset, just the metricName will be used to gather metrics. + * +optional + */ + selector?: LabelSelector | undefined; +} + +/** + * PodsMetricStatus indicates the current value of a metric describing each pod in + * the current scale target (for example, transactions-processed-per-second). + */ +export interface PodsMetricStatus { + /** metricName is the name of the metric in question */ + metricName?: string | undefined; + /** + * currentAverageValue is the current value of the average of the + * metric across all relevant pods (as a quantity) + */ + currentAverageValue?: Quantity | undefined; + /** + * selector is the string-encoded form of a standard kubernetes label selector for the given metric + * When set in the PodsMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping. + * When unset, just the metricName will be used to gather metrics. + * +optional + */ + selector?: LabelSelector | undefined; +} + +/** + * ResourceMetricSource indicates how to scale on a resource metric known to + * Kubernetes, as specified in requests and limits, describing each pod in the + * current scale target (e.g. CPU or memory). The values will be averaged + * together before being compared to the target. Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available to + * normal per-pod metrics using the "pods" source. Only one "target" type + * should be set. + */ +export interface ResourceMetricSource { + /** name is the name of the resource in question. */ + name?: string | undefined; + /** + * targetAverageUtilization is the target value of the average of the + * resource metric across all relevant pods, represented as a percentage of + * the requested value of the resource for the pods. + * +optional + */ + targetAverageUtilization?: number | undefined; + /** + * targetAverageValue is the target value of the average of the + * resource metric across all relevant pods, as a raw value (instead of as + * a percentage of the request), similar to the "pods" metric source type. + * +optional + */ + targetAverageValue?: Quantity | undefined; +} + +/** + * ResourceMetricStatus indicates the current value of a resource metric known to + * Kubernetes, as specified in requests and limits, describing each pod in the + * current scale target (e.g. CPU or memory). Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available to + * normal per-pod metrics using the "pods" source. + */ +export interface ResourceMetricStatus { + /** name is the name of the resource in question. */ + name?: string | undefined; + /** + * currentAverageUtilization is the current value of the average of the + * resource metric across all relevant pods, represented as a percentage of + * the requested value of the resource for the pods. It will only be + * present if `targetAverageValue` was set in the corresponding metric + * specification. + * +optional + */ + currentAverageUtilization?: number | undefined; + /** + * currentAverageValue is the current value of the average of the + * resource metric across all relevant pods, as a raw value (instead of as + * a percentage of the request), similar to the "pods" metric source type. + * It will always be set, regardless of the corresponding metric specification. + */ + currentAverageValue?: Quantity | undefined; +} + +/** Scale represents a scaling request for a resource. */ +export interface Scale { + /** + * metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * spec defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. + * +optional + */ + spec?: ScaleSpec | undefined; + /** + * status is the current status of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. Read-only. + * +optional + */ + status?: ScaleStatus | undefined; +} + +/** ScaleSpec describes the attributes of a scale subresource. */ +export interface ScaleSpec { + /** + * replicas is the desired number of instances for the scaled object. + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +default=0 + * +k8s:beta(since: "1.37")=+k8s:minimum=0 + */ + replicas?: number | undefined; +} + +/** ScaleStatus represents the current status of a scale subresource. */ +export interface ScaleStatus { + /** replicas is the actual number of observed instances of the scaled object. */ + replicas?: number | undefined; + /** + * selector is the label query over pods that should match the replicas count. This is same + * as the label selector but in the string format to avoid introspection + * by clients. The string will be in the same format as the query-param syntax. + * More info about label selectors: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + * +optional + */ + selector?: string | undefined; +} + +function createBaseContainerResourceMetricSource(): ContainerResourceMetricSource { + return { name: '', targetAverageUtilization: 0, targetAverageValue: undefined, container: '' }; +} + +export const ContainerResourceMetricSource: MessageFns = { + encode(message: ContainerResourceMetricSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.targetAverageUtilization !== undefined && message.targetAverageUtilization !== 0) { + writer.uint32(16).int32(message.targetAverageUtilization); + } + if (message.targetAverageValue !== undefined) { + Quantity.encode(message.targetAverageValue, writer.uint32(26).fork()).join(); + } + if (message.container !== undefined && message.container !== '') { + writer.uint32(42).string(message.container); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerResourceMetricSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerResourceMetricSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.targetAverageUtilization = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.targetAverageValue = Quantity.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.container = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerResourceMetricSource { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + targetAverageUtilization: isSet(object.targetAverageUtilization) + ? globalThis.Number(object.targetAverageUtilization) + : 0, + targetAverageValue: isSet(object.targetAverageValue) + ? Quantity.fromJSON(object.targetAverageValue) + : undefined, + container: isSet(object.container) ? globalThis.String(object.container) : '', + }; + }, + + toJSON(message: ContainerResourceMetricSource): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.targetAverageUtilization !== undefined && message.targetAverageUtilization !== 0) { + obj.targetAverageUtilization = Math.round(message.targetAverageUtilization); + } + if (message.targetAverageValue !== undefined) { + obj.targetAverageValue = Quantity.toJSON(message.targetAverageValue); + } + if (message.container !== undefined && message.container !== '') { + obj.container = message.container; + } + return obj; + }, + + create, I>>( + base?: I, + ): ContainerResourceMetricSource { + return ContainerResourceMetricSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ContainerResourceMetricSource { + const message = createBaseContainerResourceMetricSource(); + message.name = object.name ?? ''; + message.targetAverageUtilization = object.targetAverageUtilization ?? 0; + message.targetAverageValue = + object.targetAverageValue !== undefined && object.targetAverageValue !== null + ? Quantity.fromPartial(object.targetAverageValue) + : undefined; + message.container = object.container ?? ''; + return message; + }, +}; + +function createBaseContainerResourceMetricStatus(): ContainerResourceMetricStatus { + return { name: '', currentAverageUtilization: 0, currentAverageValue: undefined, container: '' }; +} + +export const ContainerResourceMetricStatus: MessageFns = { + encode(message: ContainerResourceMetricStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.currentAverageUtilization !== undefined && message.currentAverageUtilization !== 0) { + writer.uint32(16).int32(message.currentAverageUtilization); + } + if (message.currentAverageValue !== undefined) { + Quantity.encode(message.currentAverageValue, writer.uint32(26).fork()).join(); + } + if (message.container !== undefined && message.container !== '') { + writer.uint32(34).string(message.container); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerResourceMetricStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerResourceMetricStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.currentAverageUtilization = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.currentAverageValue = Quantity.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.container = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerResourceMetricStatus { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + currentAverageUtilization: isSet(object.currentAverageUtilization) + ? globalThis.Number(object.currentAverageUtilization) + : 0, + currentAverageValue: isSet(object.currentAverageValue) + ? Quantity.fromJSON(object.currentAverageValue) + : undefined, + container: isSet(object.container) ? globalThis.String(object.container) : '', + }; + }, + + toJSON(message: ContainerResourceMetricStatus): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.currentAverageUtilization !== undefined && message.currentAverageUtilization !== 0) { + obj.currentAverageUtilization = Math.round(message.currentAverageUtilization); + } + if (message.currentAverageValue !== undefined) { + obj.currentAverageValue = Quantity.toJSON(message.currentAverageValue); + } + if (message.container !== undefined && message.container !== '') { + obj.container = message.container; + } + return obj; + }, + + create, I>>( + base?: I, + ): ContainerResourceMetricStatus { + return ContainerResourceMetricStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ContainerResourceMetricStatus { + const message = createBaseContainerResourceMetricStatus(); + message.name = object.name ?? ''; + message.currentAverageUtilization = object.currentAverageUtilization ?? 0; + message.currentAverageValue = + object.currentAverageValue !== undefined && object.currentAverageValue !== null + ? Quantity.fromPartial(object.currentAverageValue) + : undefined; + message.container = object.container ?? ''; + return message; + }, +}; + +function createBaseCrossVersionObjectReference(): CrossVersionObjectReference { + return { kind: '', name: '', apiVersion: '' }; +} + +export const CrossVersionObjectReference: MessageFns = { + encode(message: CrossVersionObjectReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kind !== undefined && message.kind !== '') { + writer.uint32(10).string(message.kind); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(18).string(message.name); + } + if (message.apiVersion !== undefined && message.apiVersion !== '') { + writer.uint32(26).string(message.apiVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CrossVersionObjectReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCrossVersionObjectReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.apiVersion = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CrossVersionObjectReference { + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + apiVersion: isSet(object.apiVersion) ? globalThis.String(object.apiVersion) : '', + }; + }, + + toJSON(message: CrossVersionObjectReference): unknown { + const obj: any = {}; + if (message.kind !== undefined && message.kind !== '') { + obj.kind = message.kind; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.apiVersion !== undefined && message.apiVersion !== '') { + obj.apiVersion = message.apiVersion; + } + return obj; + }, + + create, I>>( + base?: I, + ): CrossVersionObjectReference { + return CrossVersionObjectReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CrossVersionObjectReference { + const message = createBaseCrossVersionObjectReference(); + message.kind = object.kind ?? ''; + message.name = object.name ?? ''; + message.apiVersion = object.apiVersion ?? ''; + return message; + }, +}; + +function createBaseExternalMetricSource(): ExternalMetricSource { + return { + metricName: '', + metricSelector: undefined, + targetValue: undefined, + targetAverageValue: undefined, + }; +} + +export const ExternalMetricSource: MessageFns = { + encode(message: ExternalMetricSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metricName !== undefined && message.metricName !== '') { + writer.uint32(10).string(message.metricName); + } + if (message.metricSelector !== undefined) { + LabelSelector.encode(message.metricSelector, writer.uint32(18).fork()).join(); + } + if (message.targetValue !== undefined) { + Quantity.encode(message.targetValue, writer.uint32(26).fork()).join(); + } + if (message.targetAverageValue !== undefined) { + Quantity.encode(message.targetAverageValue, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExternalMetricSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExternalMetricSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metricName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.metricSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.targetValue = Quantity.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.targetAverageValue = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ExternalMetricSource { + return { + metricName: isSet(object.metricName) ? globalThis.String(object.metricName) : '', + metricSelector: isSet(object.metricSelector) + ? LabelSelector.fromJSON(object.metricSelector) + : undefined, + targetValue: isSet(object.targetValue) ? Quantity.fromJSON(object.targetValue) : undefined, + targetAverageValue: isSet(object.targetAverageValue) + ? Quantity.fromJSON(object.targetAverageValue) + : undefined, + }; + }, + + toJSON(message: ExternalMetricSource): unknown { + const obj: any = {}; + if (message.metricName !== undefined && message.metricName !== '') { + obj.metricName = message.metricName; + } + if (message.metricSelector !== undefined) { + obj.metricSelector = LabelSelector.toJSON(message.metricSelector); + } + if (message.targetValue !== undefined) { + obj.targetValue = Quantity.toJSON(message.targetValue); + } + if (message.targetAverageValue !== undefined) { + obj.targetAverageValue = Quantity.toJSON(message.targetAverageValue); + } + return obj; + }, + + create, I>>(base?: I): ExternalMetricSource { + return ExternalMetricSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExternalMetricSource { + const message = createBaseExternalMetricSource(); + message.metricName = object.metricName ?? ''; + message.metricSelector = + object.metricSelector !== undefined && object.metricSelector !== null + ? LabelSelector.fromPartial(object.metricSelector) + : undefined; + message.targetValue = + object.targetValue !== undefined && object.targetValue !== null + ? Quantity.fromPartial(object.targetValue) + : undefined; + message.targetAverageValue = + object.targetAverageValue !== undefined && object.targetAverageValue !== null + ? Quantity.fromPartial(object.targetAverageValue) + : undefined; + return message; + }, +}; + +function createBaseExternalMetricStatus(): ExternalMetricStatus { + return { + metricName: '', + metricSelector: undefined, + currentValue: undefined, + currentAverageValue: undefined, + }; +} + +export const ExternalMetricStatus: MessageFns = { + encode(message: ExternalMetricStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metricName !== undefined && message.metricName !== '') { + writer.uint32(10).string(message.metricName); + } + if (message.metricSelector !== undefined) { + LabelSelector.encode(message.metricSelector, writer.uint32(18).fork()).join(); + } + if (message.currentValue !== undefined) { + Quantity.encode(message.currentValue, writer.uint32(26).fork()).join(); + } + if (message.currentAverageValue !== undefined) { + Quantity.encode(message.currentAverageValue, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExternalMetricStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExternalMetricStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metricName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.metricSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.currentValue = Quantity.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.currentAverageValue = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ExternalMetricStatus { + return { + metricName: isSet(object.metricName) ? globalThis.String(object.metricName) : '', + metricSelector: isSet(object.metricSelector) + ? LabelSelector.fromJSON(object.metricSelector) + : undefined, + currentValue: isSet(object.currentValue) ? Quantity.fromJSON(object.currentValue) : undefined, + currentAverageValue: isSet(object.currentAverageValue) + ? Quantity.fromJSON(object.currentAverageValue) + : undefined, + }; + }, + + toJSON(message: ExternalMetricStatus): unknown { + const obj: any = {}; + if (message.metricName !== undefined && message.metricName !== '') { + obj.metricName = message.metricName; + } + if (message.metricSelector !== undefined) { + obj.metricSelector = LabelSelector.toJSON(message.metricSelector); + } + if (message.currentValue !== undefined) { + obj.currentValue = Quantity.toJSON(message.currentValue); + } + if (message.currentAverageValue !== undefined) { + obj.currentAverageValue = Quantity.toJSON(message.currentAverageValue); + } + return obj; + }, + + create, I>>(base?: I): ExternalMetricStatus { + return ExternalMetricStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExternalMetricStatus { + const message = createBaseExternalMetricStatus(); + message.metricName = object.metricName ?? ''; + message.metricSelector = + object.metricSelector !== undefined && object.metricSelector !== null + ? LabelSelector.fromPartial(object.metricSelector) + : undefined; + message.currentValue = + object.currentValue !== undefined && object.currentValue !== null + ? Quantity.fromPartial(object.currentValue) + : undefined; + message.currentAverageValue = + object.currentAverageValue !== undefined && object.currentAverageValue !== null + ? Quantity.fromPartial(object.currentAverageValue) + : undefined; + return message; + }, +}; + +function createBaseHorizontalPodAutoscaler(): HorizontalPodAutoscaler { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const HorizontalPodAutoscaler: MessageFns = { + encode(message: HorizontalPodAutoscaler, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + HorizontalPodAutoscalerSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + HorizontalPodAutoscalerStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HorizontalPodAutoscaler { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHorizontalPodAutoscaler(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = HorizontalPodAutoscalerSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = HorizontalPodAutoscalerStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HorizontalPodAutoscaler { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? HorizontalPodAutoscalerSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? HorizontalPodAutoscalerStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: HorizontalPodAutoscaler): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = HorizontalPodAutoscalerSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = HorizontalPodAutoscalerStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): HorizontalPodAutoscaler { + return HorizontalPodAutoscaler.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): HorizontalPodAutoscaler { + const message = createBaseHorizontalPodAutoscaler(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? HorizontalPodAutoscalerSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? HorizontalPodAutoscalerStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseHorizontalPodAutoscalerCondition(): HorizontalPodAutoscalerCondition { + return { + type: '', + status: '', + lastTransitionTime: undefined, + reason: '', + message: '', + observedGeneration: 0, + }; +} + +export const HorizontalPodAutoscalerCondition: MessageFns = { + encode( + message: HorizontalPodAutoscalerCondition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(26).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(42).string(message.message); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(48).int64(message.observedGeneration); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HorizontalPodAutoscalerCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHorizontalPodAutoscalerCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HorizontalPodAutoscalerCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + }; + }, + + toJSON(message: HorizontalPodAutoscalerCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + return obj; + }, + + create, I>>( + base?: I, + ): HorizontalPodAutoscalerCondition { + return HorizontalPodAutoscalerCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): HorizontalPodAutoscalerCondition { + const message = createBaseHorizontalPodAutoscalerCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + message.observedGeneration = object.observedGeneration ?? 0; + return message; + }, +}; + +function createBaseHorizontalPodAutoscalerList(): HorizontalPodAutoscalerList { + return { metadata: undefined, items: [] }; +} + +export const HorizontalPodAutoscalerList: MessageFns = { + encode(message: HorizontalPodAutoscalerList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + HorizontalPodAutoscaler.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HorizontalPodAutoscalerList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHorizontalPodAutoscalerList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(HorizontalPodAutoscaler.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HorizontalPodAutoscalerList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => HorizontalPodAutoscaler.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HorizontalPodAutoscalerList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => HorizontalPodAutoscaler.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): HorizontalPodAutoscalerList { + return HorizontalPodAutoscalerList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): HorizontalPodAutoscalerList { + const message = createBaseHorizontalPodAutoscalerList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => HorizontalPodAutoscaler.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseHorizontalPodAutoscalerSpec(): HorizontalPodAutoscalerSpec { + return { scaleTargetRef: undefined, minReplicas: 0, maxReplicas: 0, targetCPUUtilizationPercentage: 0 }; +} + +export const HorizontalPodAutoscalerSpec: MessageFns = { + encode(message: HorizontalPodAutoscalerSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.scaleTargetRef !== undefined) { + CrossVersionObjectReference.encode(message.scaleTargetRef, writer.uint32(10).fork()).join(); + } + if (message.minReplicas !== undefined && message.minReplicas !== 0) { + writer.uint32(16).int32(message.minReplicas); + } + if (message.maxReplicas !== undefined && message.maxReplicas !== 0) { + writer.uint32(24).int32(message.maxReplicas); + } + if ( + message.targetCPUUtilizationPercentage !== undefined && + message.targetCPUUtilizationPercentage !== 0 + ) { + writer.uint32(32).int32(message.targetCPUUtilizationPercentage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HorizontalPodAutoscalerSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHorizontalPodAutoscalerSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.scaleTargetRef = CrossVersionObjectReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.minReplicas = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxReplicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.targetCPUUtilizationPercentage = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HorizontalPodAutoscalerSpec { + return { + scaleTargetRef: isSet(object.scaleTargetRef) + ? CrossVersionObjectReference.fromJSON(object.scaleTargetRef) + : undefined, + minReplicas: isSet(object.minReplicas) ? globalThis.Number(object.minReplicas) : 0, + maxReplicas: isSet(object.maxReplicas) ? globalThis.Number(object.maxReplicas) : 0, + targetCPUUtilizationPercentage: isSet(object.targetCPUUtilizationPercentage) + ? globalThis.Number(object.targetCPUUtilizationPercentage) + : 0, + }; + }, + + toJSON(message: HorizontalPodAutoscalerSpec): unknown { + const obj: any = {}; + if (message.scaleTargetRef !== undefined) { + obj.scaleTargetRef = CrossVersionObjectReference.toJSON(message.scaleTargetRef); + } + if (message.minReplicas !== undefined && message.minReplicas !== 0) { + obj.minReplicas = Math.round(message.minReplicas); + } + if (message.maxReplicas !== undefined && message.maxReplicas !== 0) { + obj.maxReplicas = Math.round(message.maxReplicas); + } + if ( + message.targetCPUUtilizationPercentage !== undefined && + message.targetCPUUtilizationPercentage !== 0 + ) { + obj.targetCPUUtilizationPercentage = Math.round(message.targetCPUUtilizationPercentage); + } + return obj; + }, + + create, I>>( + base?: I, + ): HorizontalPodAutoscalerSpec { + return HorizontalPodAutoscalerSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): HorizontalPodAutoscalerSpec { + const message = createBaseHorizontalPodAutoscalerSpec(); + message.scaleTargetRef = + object.scaleTargetRef !== undefined && object.scaleTargetRef !== null + ? CrossVersionObjectReference.fromPartial(object.scaleTargetRef) + : undefined; + message.minReplicas = object.minReplicas ?? 0; + message.maxReplicas = object.maxReplicas ?? 0; + message.targetCPUUtilizationPercentage = object.targetCPUUtilizationPercentage ?? 0; + return message; + }, +}; + +function createBaseHorizontalPodAutoscalerStatus(): HorizontalPodAutoscalerStatus { + return { + observedGeneration: 0, + lastScaleTime: undefined, + currentReplicas: 0, + desiredReplicas: 0, + currentCPUUtilizationPercentage: 0, + }; +} + +export const HorizontalPodAutoscalerStatus: MessageFns = { + encode(message: HorizontalPodAutoscalerStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(8).int64(message.observedGeneration); + } + if (message.lastScaleTime !== undefined) { + Time.encode(message.lastScaleTime, writer.uint32(18).fork()).join(); + } + if (message.currentReplicas !== undefined && message.currentReplicas !== 0) { + writer.uint32(24).int32(message.currentReplicas); + } + if (message.desiredReplicas !== undefined && message.desiredReplicas !== 0) { + writer.uint32(32).int32(message.desiredReplicas); + } + if ( + message.currentCPUUtilizationPercentage !== undefined && + message.currentCPUUtilizationPercentage !== 0 + ) { + writer.uint32(40).int32(message.currentCPUUtilizationPercentage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HorizontalPodAutoscalerStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHorizontalPodAutoscalerStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.lastScaleTime = Time.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.currentReplicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.desiredReplicas = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.currentCPUUtilizationPercentage = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HorizontalPodAutoscalerStatus { + return { + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + lastScaleTime: isSet(object.lastScaleTime) ? Time.fromJSON(object.lastScaleTime) : undefined, + currentReplicas: isSet(object.currentReplicas) ? globalThis.Number(object.currentReplicas) : 0, + desiredReplicas: isSet(object.desiredReplicas) ? globalThis.Number(object.desiredReplicas) : 0, + currentCPUUtilizationPercentage: isSet(object.currentCPUUtilizationPercentage) + ? globalThis.Number(object.currentCPUUtilizationPercentage) + : 0, + }; + }, + + toJSON(message: HorizontalPodAutoscalerStatus): unknown { + const obj: any = {}; + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.lastScaleTime !== undefined) { + obj.lastScaleTime = Time.toJSON(message.lastScaleTime); + } + if (message.currentReplicas !== undefined && message.currentReplicas !== 0) { + obj.currentReplicas = Math.round(message.currentReplicas); + } + if (message.desiredReplicas !== undefined && message.desiredReplicas !== 0) { + obj.desiredReplicas = Math.round(message.desiredReplicas); + } + if ( + message.currentCPUUtilizationPercentage !== undefined && + message.currentCPUUtilizationPercentage !== 0 + ) { + obj.currentCPUUtilizationPercentage = Math.round(message.currentCPUUtilizationPercentage); + } + return obj; + }, + + create, I>>( + base?: I, + ): HorizontalPodAutoscalerStatus { + return HorizontalPodAutoscalerStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): HorizontalPodAutoscalerStatus { + const message = createBaseHorizontalPodAutoscalerStatus(); + message.observedGeneration = object.observedGeneration ?? 0; + message.lastScaleTime = + object.lastScaleTime !== undefined && object.lastScaleTime !== null + ? Time.fromPartial(object.lastScaleTime) + : undefined; + message.currentReplicas = object.currentReplicas ?? 0; + message.desiredReplicas = object.desiredReplicas ?? 0; + message.currentCPUUtilizationPercentage = object.currentCPUUtilizationPercentage ?? 0; + return message; + }, +}; + +function createBaseMetricSpec(): MetricSpec { + return { + type: '', + object: undefined, + pods: undefined, + resource: undefined, + containerResource: undefined, + external: undefined, + }; +} + +export const MetricSpec: MessageFns = { + encode(message: MetricSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.object !== undefined) { + ObjectMetricSource.encode(message.object, writer.uint32(18).fork()).join(); + } + if (message.pods !== undefined) { + PodsMetricSource.encode(message.pods, writer.uint32(26).fork()).join(); + } + if (message.resource !== undefined) { + ResourceMetricSource.encode(message.resource, writer.uint32(34).fork()).join(); + } + if (message.containerResource !== undefined) { + ContainerResourceMetricSource.encode(message.containerResource, writer.uint32(58).fork()).join(); + } + if (message.external !== undefined) { + ExternalMetricSource.encode(message.external, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetricSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetricSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.object = ObjectMetricSource.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.pods = PodsMetricSource.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.resource = ResourceMetricSource.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.containerResource = ContainerResourceMetricSource.decode( + reader, + reader.uint32(), + ); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.external = ExternalMetricSource.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MetricSpec { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + object: isSet(object.object) ? ObjectMetricSource.fromJSON(object.object) : undefined, + pods: isSet(object.pods) ? PodsMetricSource.fromJSON(object.pods) : undefined, + resource: isSet(object.resource) ? ResourceMetricSource.fromJSON(object.resource) : undefined, + containerResource: isSet(object.containerResource) + ? ContainerResourceMetricSource.fromJSON(object.containerResource) + : undefined, + external: isSet(object.external) ? ExternalMetricSource.fromJSON(object.external) : undefined, + }; + }, + + toJSON(message: MetricSpec): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.object !== undefined) { + obj.object = ObjectMetricSource.toJSON(message.object); + } + if (message.pods !== undefined) { + obj.pods = PodsMetricSource.toJSON(message.pods); + } + if (message.resource !== undefined) { + obj.resource = ResourceMetricSource.toJSON(message.resource); + } + if (message.containerResource !== undefined) { + obj.containerResource = ContainerResourceMetricSource.toJSON(message.containerResource); + } + if (message.external !== undefined) { + obj.external = ExternalMetricSource.toJSON(message.external); + } + return obj; + }, + + create, I>>(base?: I): MetricSpec { + return MetricSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MetricSpec { + const message = createBaseMetricSpec(); + message.type = object.type ?? ''; + message.object = + object.object !== undefined && object.object !== null + ? ObjectMetricSource.fromPartial(object.object) + : undefined; + message.pods = + object.pods !== undefined && object.pods !== null + ? PodsMetricSource.fromPartial(object.pods) + : undefined; + message.resource = + object.resource !== undefined && object.resource !== null + ? ResourceMetricSource.fromPartial(object.resource) + : undefined; + message.containerResource = + object.containerResource !== undefined && object.containerResource !== null + ? ContainerResourceMetricSource.fromPartial(object.containerResource) + : undefined; + message.external = + object.external !== undefined && object.external !== null + ? ExternalMetricSource.fromPartial(object.external) + : undefined; + return message; + }, +}; + +function createBaseMetricStatus(): MetricStatus { + return { + type: '', + object: undefined, + pods: undefined, + resource: undefined, + containerResource: undefined, + external: undefined, + }; +} + +export const MetricStatus: MessageFns = { + encode(message: MetricStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.object !== undefined) { + ObjectMetricStatus.encode(message.object, writer.uint32(18).fork()).join(); + } + if (message.pods !== undefined) { + PodsMetricStatus.encode(message.pods, writer.uint32(26).fork()).join(); + } + if (message.resource !== undefined) { + ResourceMetricStatus.encode(message.resource, writer.uint32(34).fork()).join(); + } + if (message.containerResource !== undefined) { + ContainerResourceMetricStatus.encode(message.containerResource, writer.uint32(58).fork()).join(); + } + if (message.external !== undefined) { + ExternalMetricStatus.encode(message.external, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetricStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetricStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.object = ObjectMetricStatus.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.pods = PodsMetricStatus.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.resource = ResourceMetricStatus.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.containerResource = ContainerResourceMetricStatus.decode( + reader, + reader.uint32(), + ); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.external = ExternalMetricStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MetricStatus { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + object: isSet(object.object) ? ObjectMetricStatus.fromJSON(object.object) : undefined, + pods: isSet(object.pods) ? PodsMetricStatus.fromJSON(object.pods) : undefined, + resource: isSet(object.resource) ? ResourceMetricStatus.fromJSON(object.resource) : undefined, + containerResource: isSet(object.containerResource) + ? ContainerResourceMetricStatus.fromJSON(object.containerResource) + : undefined, + external: isSet(object.external) ? ExternalMetricStatus.fromJSON(object.external) : undefined, + }; + }, + + toJSON(message: MetricStatus): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.object !== undefined) { + obj.object = ObjectMetricStatus.toJSON(message.object); + } + if (message.pods !== undefined) { + obj.pods = PodsMetricStatus.toJSON(message.pods); + } + if (message.resource !== undefined) { + obj.resource = ResourceMetricStatus.toJSON(message.resource); + } + if (message.containerResource !== undefined) { + obj.containerResource = ContainerResourceMetricStatus.toJSON(message.containerResource); + } + if (message.external !== undefined) { + obj.external = ExternalMetricStatus.toJSON(message.external); + } + return obj; + }, + + create, I>>(base?: I): MetricStatus { + return MetricStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MetricStatus { + const message = createBaseMetricStatus(); + message.type = object.type ?? ''; + message.object = + object.object !== undefined && object.object !== null + ? ObjectMetricStatus.fromPartial(object.object) + : undefined; + message.pods = + object.pods !== undefined && object.pods !== null + ? PodsMetricStatus.fromPartial(object.pods) + : undefined; + message.resource = + object.resource !== undefined && object.resource !== null + ? ResourceMetricStatus.fromPartial(object.resource) + : undefined; + message.containerResource = + object.containerResource !== undefined && object.containerResource !== null + ? ContainerResourceMetricStatus.fromPartial(object.containerResource) + : undefined; + message.external = + object.external !== undefined && object.external !== null + ? ExternalMetricStatus.fromPartial(object.external) + : undefined; + return message; + }, +}; + +function createBaseObjectMetricSource(): ObjectMetricSource { + return { + target: undefined, + metricName: '', + targetValue: undefined, + selector: undefined, + averageValue: undefined, + }; +} + +export const ObjectMetricSource: MessageFns = { + encode(message: ObjectMetricSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== undefined) { + CrossVersionObjectReference.encode(message.target, writer.uint32(10).fork()).join(); + } + if (message.metricName !== undefined && message.metricName !== '') { + writer.uint32(18).string(message.metricName); + } + if (message.targetValue !== undefined) { + Quantity.encode(message.targetValue, writer.uint32(26).fork()).join(); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(34).fork()).join(); + } + if (message.averageValue !== undefined) { + Quantity.encode(message.averageValue, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ObjectMetricSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseObjectMetricSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.target = CrossVersionObjectReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.metricName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.targetValue = Quantity.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.averageValue = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ObjectMetricSource { + return { + target: isSet(object.target) ? CrossVersionObjectReference.fromJSON(object.target) : undefined, + metricName: isSet(object.metricName) ? globalThis.String(object.metricName) : '', + targetValue: isSet(object.targetValue) ? Quantity.fromJSON(object.targetValue) : undefined, + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + averageValue: isSet(object.averageValue) ? Quantity.fromJSON(object.averageValue) : undefined, + }; + }, + + toJSON(message: ObjectMetricSource): unknown { + const obj: any = {}; + if (message.target !== undefined) { + obj.target = CrossVersionObjectReference.toJSON(message.target); + } + if (message.metricName !== undefined && message.metricName !== '') { + obj.metricName = message.metricName; + } + if (message.targetValue !== undefined) { + obj.targetValue = Quantity.toJSON(message.targetValue); + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.averageValue !== undefined) { + obj.averageValue = Quantity.toJSON(message.averageValue); + } + return obj; + }, + + create, I>>(base?: I): ObjectMetricSource { + return ObjectMetricSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ObjectMetricSource { + const message = createBaseObjectMetricSource(); + message.target = + object.target !== undefined && object.target !== null + ? CrossVersionObjectReference.fromPartial(object.target) + : undefined; + message.metricName = object.metricName ?? ''; + message.targetValue = + object.targetValue !== undefined && object.targetValue !== null + ? Quantity.fromPartial(object.targetValue) + : undefined; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.averageValue = + object.averageValue !== undefined && object.averageValue !== null + ? Quantity.fromPartial(object.averageValue) + : undefined; + return message; + }, +}; + +function createBaseObjectMetricStatus(): ObjectMetricStatus { + return { + target: undefined, + metricName: '', + currentValue: undefined, + selector: undefined, + averageValue: undefined, + }; +} + +export const ObjectMetricStatus: MessageFns = { + encode(message: ObjectMetricStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.target !== undefined) { + CrossVersionObjectReference.encode(message.target, writer.uint32(10).fork()).join(); + } + if (message.metricName !== undefined && message.metricName !== '') { + writer.uint32(18).string(message.metricName); + } + if (message.currentValue !== undefined) { + Quantity.encode(message.currentValue, writer.uint32(26).fork()).join(); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(34).fork()).join(); + } + if (message.averageValue !== undefined) { + Quantity.encode(message.averageValue, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ObjectMetricStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseObjectMetricStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.target = CrossVersionObjectReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.metricName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.currentValue = Quantity.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.averageValue = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ObjectMetricStatus { + return { + target: isSet(object.target) ? CrossVersionObjectReference.fromJSON(object.target) : undefined, + metricName: isSet(object.metricName) ? globalThis.String(object.metricName) : '', + currentValue: isSet(object.currentValue) ? Quantity.fromJSON(object.currentValue) : undefined, + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + averageValue: isSet(object.averageValue) ? Quantity.fromJSON(object.averageValue) : undefined, + }; + }, + + toJSON(message: ObjectMetricStatus): unknown { + const obj: any = {}; + if (message.target !== undefined) { + obj.target = CrossVersionObjectReference.toJSON(message.target); + } + if (message.metricName !== undefined && message.metricName !== '') { + obj.metricName = message.metricName; + } + if (message.currentValue !== undefined) { + obj.currentValue = Quantity.toJSON(message.currentValue); + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.averageValue !== undefined) { + obj.averageValue = Quantity.toJSON(message.averageValue); + } + return obj; + }, + + create, I>>(base?: I): ObjectMetricStatus { + return ObjectMetricStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ObjectMetricStatus { + const message = createBaseObjectMetricStatus(); + message.target = + object.target !== undefined && object.target !== null + ? CrossVersionObjectReference.fromPartial(object.target) + : undefined; + message.metricName = object.metricName ?? ''; + message.currentValue = + object.currentValue !== undefined && object.currentValue !== null + ? Quantity.fromPartial(object.currentValue) + : undefined; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.averageValue = + object.averageValue !== undefined && object.averageValue !== null + ? Quantity.fromPartial(object.averageValue) + : undefined; + return message; + }, +}; + +function createBasePodsMetricSource(): PodsMetricSource { + return { metricName: '', targetAverageValue: undefined, selector: undefined }; +} + +export const PodsMetricSource: MessageFns = { + encode(message: PodsMetricSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metricName !== undefined && message.metricName !== '') { + writer.uint32(10).string(message.metricName); + } + if (message.targetAverageValue !== undefined) { + Quantity.encode(message.targetAverageValue, writer.uint32(18).fork()).join(); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodsMetricSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodsMetricSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metricName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.targetAverageValue = Quantity.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodsMetricSource { + return { + metricName: isSet(object.metricName) ? globalThis.String(object.metricName) : '', + targetAverageValue: isSet(object.targetAverageValue) + ? Quantity.fromJSON(object.targetAverageValue) + : undefined, + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + }; + }, + + toJSON(message: PodsMetricSource): unknown { + const obj: any = {}; + if (message.metricName !== undefined && message.metricName !== '') { + obj.metricName = message.metricName; + } + if (message.targetAverageValue !== undefined) { + obj.targetAverageValue = Quantity.toJSON(message.targetAverageValue); + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + return obj; + }, + + create, I>>(base?: I): PodsMetricSource { + return PodsMetricSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodsMetricSource { + const message = createBasePodsMetricSource(); + message.metricName = object.metricName ?? ''; + message.targetAverageValue = + object.targetAverageValue !== undefined && object.targetAverageValue !== null + ? Quantity.fromPartial(object.targetAverageValue) + : undefined; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + return message; + }, +}; + +function createBasePodsMetricStatus(): PodsMetricStatus { + return { metricName: '', currentAverageValue: undefined, selector: undefined }; +} + +export const PodsMetricStatus: MessageFns = { + encode(message: PodsMetricStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metricName !== undefined && message.metricName !== '') { + writer.uint32(10).string(message.metricName); + } + if (message.currentAverageValue !== undefined) { + Quantity.encode(message.currentAverageValue, writer.uint32(18).fork()).join(); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodsMetricStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodsMetricStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metricName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.currentAverageValue = Quantity.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodsMetricStatus { + return { + metricName: isSet(object.metricName) ? globalThis.String(object.metricName) : '', + currentAverageValue: isSet(object.currentAverageValue) + ? Quantity.fromJSON(object.currentAverageValue) + : undefined, + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + }; + }, + + toJSON(message: PodsMetricStatus): unknown { + const obj: any = {}; + if (message.metricName !== undefined && message.metricName !== '') { + obj.metricName = message.metricName; + } + if (message.currentAverageValue !== undefined) { + obj.currentAverageValue = Quantity.toJSON(message.currentAverageValue); + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + return obj; + }, + + create, I>>(base?: I): PodsMetricStatus { + return PodsMetricStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodsMetricStatus { + const message = createBasePodsMetricStatus(); + message.metricName = object.metricName ?? ''; + message.currentAverageValue = + object.currentAverageValue !== undefined && object.currentAverageValue !== null + ? Quantity.fromPartial(object.currentAverageValue) + : undefined; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + return message; + }, +}; + +function createBaseResourceMetricSource(): ResourceMetricSource { + return { name: '', targetAverageUtilization: 0, targetAverageValue: undefined }; +} + +export const ResourceMetricSource: MessageFns = { + encode(message: ResourceMetricSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.targetAverageUtilization !== undefined && message.targetAverageUtilization !== 0) { + writer.uint32(16).int32(message.targetAverageUtilization); + } + if (message.targetAverageValue !== undefined) { + Quantity.encode(message.targetAverageValue, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceMetricSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceMetricSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.targetAverageUtilization = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.targetAverageValue = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceMetricSource { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + targetAverageUtilization: isSet(object.targetAverageUtilization) + ? globalThis.Number(object.targetAverageUtilization) + : 0, + targetAverageValue: isSet(object.targetAverageValue) + ? Quantity.fromJSON(object.targetAverageValue) + : undefined, + }; + }, + + toJSON(message: ResourceMetricSource): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.targetAverageUtilization !== undefined && message.targetAverageUtilization !== 0) { + obj.targetAverageUtilization = Math.round(message.targetAverageUtilization); + } + if (message.targetAverageValue !== undefined) { + obj.targetAverageValue = Quantity.toJSON(message.targetAverageValue); + } + return obj; + }, + + create, I>>(base?: I): ResourceMetricSource { + return ResourceMetricSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceMetricSource { + const message = createBaseResourceMetricSource(); + message.name = object.name ?? ''; + message.targetAverageUtilization = object.targetAverageUtilization ?? 0; + message.targetAverageValue = + object.targetAverageValue !== undefined && object.targetAverageValue !== null + ? Quantity.fromPartial(object.targetAverageValue) + : undefined; + return message; + }, +}; + +function createBaseResourceMetricStatus(): ResourceMetricStatus { + return { name: '', currentAverageUtilization: 0, currentAverageValue: undefined }; +} + +export const ResourceMetricStatus: MessageFns = { + encode(message: ResourceMetricStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.currentAverageUtilization !== undefined && message.currentAverageUtilization !== 0) { + writer.uint32(16).int32(message.currentAverageUtilization); + } + if (message.currentAverageValue !== undefined) { + Quantity.encode(message.currentAverageValue, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceMetricStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceMetricStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.currentAverageUtilization = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.currentAverageValue = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceMetricStatus { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + currentAverageUtilization: isSet(object.currentAverageUtilization) + ? globalThis.Number(object.currentAverageUtilization) + : 0, + currentAverageValue: isSet(object.currentAverageValue) + ? Quantity.fromJSON(object.currentAverageValue) + : undefined, + }; + }, + + toJSON(message: ResourceMetricStatus): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.currentAverageUtilization !== undefined && message.currentAverageUtilization !== 0) { + obj.currentAverageUtilization = Math.round(message.currentAverageUtilization); + } + if (message.currentAverageValue !== undefined) { + obj.currentAverageValue = Quantity.toJSON(message.currentAverageValue); + } + return obj; + }, + + create, I>>(base?: I): ResourceMetricStatus { + return ResourceMetricStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceMetricStatus { + const message = createBaseResourceMetricStatus(); + message.name = object.name ?? ''; + message.currentAverageUtilization = object.currentAverageUtilization ?? 0; + message.currentAverageValue = + object.currentAverageValue !== undefined && object.currentAverageValue !== null + ? Quantity.fromPartial(object.currentAverageValue) + : undefined; + return message; + }, +}; + +function createBaseScale(): Scale { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const Scale: MessageFns = { + encode(message: Scale, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + ScaleSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + ScaleStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Scale { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScale(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = ScaleSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = ScaleStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Scale { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? ScaleSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? ScaleStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: Scale): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = ScaleSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = ScaleStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): Scale { + return Scale.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Scale { + const message = createBaseScale(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? ScaleSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? ScaleStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseScaleSpec(): ScaleSpec { + return { replicas: 0 }; +} + +export const ScaleSpec: MessageFns = { + encode(message: ScaleSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScaleSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScaleSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ScaleSpec { + return { replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0 }; + }, + + toJSON(message: ScaleSpec): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + return obj; + }, + + create, I>>(base?: I): ScaleSpec { + return ScaleSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ScaleSpec { + const message = createBaseScaleSpec(); + message.replicas = object.replicas ?? 0; + return message; + }, +}; + +function createBaseScaleStatus(): ScaleStatus { + return { replicas: 0, selector: '' }; +} + +export const ScaleStatus: MessageFns = { + encode(message: ScaleStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + if (message.selector !== undefined && message.selector !== '') { + writer.uint32(18).string(message.selector); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScaleStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScaleStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.selector = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ScaleStatus { + return { + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + selector: isSet(object.selector) ? globalThis.String(object.selector) : '', + }; + }, + + toJSON(message: ScaleStatus): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.selector !== undefined && message.selector !== '') { + obj.selector = message.selector; + } + return obj; + }, + + create, I>>(base?: I): ScaleStatus { + return ScaleStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ScaleStatus { + const message = createBaseScaleStatus(); + message.replicas = object.replicas ?? 0; + message.selector = object.selector ?? ''; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error('Value is smaller than Number.MIN_SAFE_INTEGER'); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/autoscaling/v2/generated.ts b/src/proto/generated/k8s.io/api/autoscaling/v2/generated.ts new file mode 100644 index 00000000000..d7e8ac1c036 --- /dev/null +++ b/src/proto/generated/k8s.io/api/autoscaling/v2/generated.ts @@ -0,0 +1,3416 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/autoscaling/v2/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { Quantity } from '../../../apimachinery/pkg/api/resource/generated.js'; +import { + LabelSelector, + ListMeta, + ObjectMeta, + Time, +} from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** + * ContainerResourceMetricSource indicates how to scale on a resource metric known to + * Kubernetes, as specified in requests and limits, describing each pod in the + * current scale target (e.g. CPU or memory). The values will be averaged + * together before being compared to the target. Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available to + * normal per-pod metrics using the "pods" source. Only one "target" type + * should be set. + */ +export interface ContainerResourceMetricSource { + /** name is the name of the resource in question. */ + name?: string | undefined; + /** target specifies the target value for the given metric */ + target?: MetricTarget | undefined; + /** container is the name of the container in the pods of the scaling target */ + container?: string | undefined; +} + +/** + * ContainerResourceMetricStatus indicates the current value of a resource metric known to + * Kubernetes, as specified in requests and limits, describing a single container in each pod in the + * current scale target (e.g. CPU or memory). Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available to + * normal per-pod metrics using the "pods" source. + */ +export interface ContainerResourceMetricStatus { + /** name is the name of the resource in question. */ + name?: string | undefined; + /** current contains the current value for the given metric */ + current?: MetricValueStatus | undefined; + /** container is the name of the container in the pods of the scaling target */ + container?: string | undefined; +} + +/** CrossVersionObjectReference contains enough information to let you identify the referred resource. */ +export interface CrossVersionObjectReference { + /** + * kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +k8s:alpha(since: "1.37")=+k8s:required + */ + kind?: string | undefined; + /** + * name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + * +k8s:alpha(since: "1.37")=+k8s:required + */ + name?: string | undefined; + /** + * apiVersion is the API version of the referent + * +optional + */ + apiVersion?: string | undefined; +} + +/** + * ExternalMetricSource indicates how to scale on a metric not associated with + * any Kubernetes object (for example length of queue in cloud + * messaging service, or QPS from loadbalancer running outside of cluster). + */ +export interface ExternalMetricSource { + /** metric identifies the target metric by name and selector */ + metric?: MetricIdentifier | undefined; + /** target specifies the target value for the given metric */ + target?: MetricTarget | undefined; +} + +/** + * ExternalMetricStatus indicates the current value of a global metric + * not associated with any Kubernetes object. + */ +export interface ExternalMetricStatus { + /** metric identifies the target metric by name and selector */ + metric?: MetricIdentifier | undefined; + /** current contains the current value for the given metric */ + current?: MetricValueStatus | undefined; +} + +/** HPAScalingPolicy is a single policy which must hold true for a specified past interval. */ +export interface HPAScalingPolicy { + /** type is used to specify the scaling policy. */ + type?: string | undefined; + /** + * value contains the amount of change which is permitted by the policy. + * It must be greater than zero + */ + value?: number | undefined; + /** + * periodSeconds specifies the window of time for which the policy should hold true. + * PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). + */ + periodSeconds?: number | undefined; +} + +/** + * HPAScalingRules configures the scaling behavior for one direction via + * scaling Policy Rules and a configurable metric tolerance. + * + * Scaling Policy Rules are applied after calculating DesiredReplicas from metrics for the HPA. + * They can limit the scaling velocity by specifying scaling policies. + * They can prevent flapping by specifying the stabilization window, so that the + * number of replicas is not set instantly, instead, the safest value from the stabilization + * window is chosen. + * + * The tolerance is applied to the metric values and prevents scaling too + * eagerly for small metric variations. + */ +export interface HPAScalingRules { + /** + * stabilizationWindowSeconds is the number of seconds for which past recommendations should be + * considered while scaling up or scaling down. + * StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). + * If not set, use the default values: + * - For scale up: 0 (i.e. no stabilization is done). + * - For scale down: 300 (i.e. the stabilization window is 300 seconds long). + * +optional + */ + stabilizationWindowSeconds?: number | undefined; + /** + * selectPolicy is used to specify which policy should be used. + * If not set, the default value Max is used. + * +optional + */ + selectPolicy?: string | undefined; + /** + * policies is a list of potential scaling polices which can be used during scaling. + * If not set, use the default values: + * - For scale up: allow doubling the number of pods, or an absolute change of 4 pods in a 15s window. + * - For scale down: allow all pods to be removed in a 15s window. + * +listType=atomic + * +optional + */ + policies: HPAScalingPolicy[]; + /** + * tolerance is the tolerance on the ratio between the current and desired + * metric value under which no updates are made to the desired number of + * replicas (e.g. 0.01 for 1%). Must be greater than or equal to zero. If not + * set, the default cluster-wide tolerance is applied (by default 10%). + * + * For example, if autoscaling is configured with a memory consumption target of 100Mi, + * and scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be + * triggered when the actual consumption falls below 95Mi or exceeds 101Mi. + * + * +featureGate=HPAConfigurableTolerance + * +optional + */ + tolerance?: Quantity | undefined; +} + +/** + * HorizontalPodAutoscaler is the configuration for a horizontal pod + * autoscaler, which automatically manages the replica count of any resource + * implementing the scale subresource based on the metrics specified. + * +k8s:supportsSubresource="/status" + */ +export interface HorizontalPodAutoscaler { + /** + * metadata is the standard object metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec is the specification for the behaviour of the autoscaler. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. + * +required + */ + spec?: HorizontalPodAutoscalerSpec | undefined; + /** + * status is the current information about the autoscaler. + * +optional + */ + status?: HorizontalPodAutoscalerStatus | undefined; +} + +/** + * HorizontalPodAutoscalerBehavior configures the scaling behavior of the target + * in both Up and Down directions (scaleUp and scaleDown fields respectively). + */ +export interface HorizontalPodAutoscalerBehavior { + /** + * scaleUp is scaling policy for scaling Up. + * If not set, the default value is the higher of: + * * increase no more than 4 pods per 60 seconds + * * double the number of pods per 60 seconds + * No stabilization is used. + * +optional + */ + scaleUp?: HPAScalingRules | undefined; + /** + * scaleDown is scaling policy for scaling Down. + * If not set, the default value is to allow to scale down to minReplicas pods, with a + * 300 second stabilization window (i.e., the highest recommendation for + * the last 300sec is used). + * +optional + */ + scaleDown?: HPAScalingRules | undefined; +} + +/** + * HorizontalPodAutoscalerCondition describes the state of + * a HorizontalPodAutoscaler at a certain point. + */ +export interface HorizontalPodAutoscalerCondition { + /** type describes the current condition */ + type?: string | undefined; + /** status is the status of the condition (True, False, Unknown) */ + status?: string | undefined; + /** + * lastTransitionTime is the last time the condition transitioned from + * one status to another + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * reason is the reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * message is a human-readable explanation containing details about + * the transition + * +optional + */ + message?: string | undefined; + /** + * observedGeneration represents the .metadata.generation that the condition was set based upon. + * For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + * with respect to the current state of the instance. + * +optional + */ + observedGeneration?: number | undefined; +} + +/** HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects. */ +export interface HorizontalPodAutoscalerList { + /** + * metadata is the standard list metadata. + * +optional + */ + metadata?: ListMeta | undefined; + /** items is the list of horizontal pod autoscaler objects. */ + items: HorizontalPodAutoscaler[]; +} + +/** HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. */ +export interface HorizontalPodAutoscalerSpec { + /** + * scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics + * should be collected, as well as to actually change the replica count. + */ + scaleTargetRef?: CrossVersionObjectReference | undefined; + /** + * minReplicas is the lower limit for the number of replicas to which the autoscaler + * can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the + * alpha feature gate HPAScaleToZero is enabled and at least one Object or External + * metric is configured. Scaling is active as long as at least one metric value is + * available. + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 + * +k8s:beta(since: "1.37")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 + */ + minReplicas?: number | undefined; + /** + * maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. + * It cannot be less that minReplicas. + * +required + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:minimum=1 + */ + maxReplicas?: number | undefined; + /** + * metrics contains the specifications for which to use to calculate the + * desired replica count (the maximum replica count across all metrics will + * be used). The desired replica count is calculated multiplying the + * ratio between the target value and the current value by the current + * number of pods. Ergo, metrics used must decrease as the pod count is + * increased, and vice-versa. See the individual metric source types for + * more information about how each type of metric must respond. + * If not set, the default metric will be set to 80% average CPU utilization. + * +listType=atomic + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + */ + metrics: MetricSpec[]; + /** + * behavior configures the scaling behavior of the target + * in both Up and Down directions (scaleUp and scaleDown fields respectively). + * If not set, the default HPAScalingRules for scale up and scale down are used. + * +optional + */ + behavior?: HorizontalPodAutoscalerBehavior | undefined; +} + +/** HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler. */ +export interface HorizontalPodAutoscalerStatus { + /** + * observedGeneration is the most recent generation observed by this autoscaler. + * +optional + */ + observedGeneration?: number | undefined; + /** + * lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, + * used by the autoscaler to control how often the number of pods is changed. + * +optional + */ + lastScaleTime?: Time | undefined; + /** + * currentReplicas is current number of replicas of pods managed by this autoscaler, + * as last seen by the autoscaler. + * +optional + */ + currentReplicas?: number | undefined; + /** + * desiredReplicas is the desired number of replicas of pods managed by this autoscaler, + * as last calculated by the autoscaler. + */ + desiredReplicas?: number | undefined; + /** + * currentMetrics is the last read state of the metrics used by this autoscaler. + * +listType=atomic + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + */ + currentMetrics: MetricStatus[]; + /** + * conditions is the set of conditions required for this autoscaler to scale its target, + * and indicates whether or not those conditions are met. + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + * +optional + */ + conditions: HorizontalPodAutoscalerCondition[]; +} + +/** MetricIdentifier defines the name and optionally selector for a metric */ +export interface MetricIdentifier { + /** name is the name of the given metric */ + name?: string | undefined; + /** + * selector is the string-encoded form of a standard kubernetes label selector for the given metric + * When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. + * When unset, just the metricName will be used to gather metrics. + * +optional + */ + selector?: LabelSelector | undefined; +} + +/** + * MetricSpec specifies how to scale based on a single metric + * (only `type` and one other matching field should be set at once). + */ +export interface MetricSpec { + /** + * type is the type of metric source. It should be one of "ContainerResource", "External", + * "Object", "Pods" or "Resource", each mapping to a matching field in the object. + */ + type?: string | undefined; + /** + * object refers to a metric describing a single kubernetes object + * (for example, hits-per-second on an Ingress object). + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:opaqueType + */ + object?: ObjectMetricSource | undefined; + /** + * pods refers to a metric describing each pod in the current scale target + * (for example, transactions-processed-per-second). The values will be + * averaged together before being compared to the target value. + * +optional + */ + pods?: PodsMetricSource | undefined; + /** + * resource refers to a resource metric (such as those specified in + * requests and limits) known to Kubernetes describing each pod in the + * current scale target (e.g. CPU or memory). Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available + * to normal per-pod metrics using the "pods" source. + * +optional + */ + resource?: ResourceMetricSource | undefined; + /** + * containerResource refers to a resource metric (such as those specified in + * requests and limits) known to Kubernetes describing a single container in + * each pod of the current scale target (e.g. CPU or memory). Such metrics are + * built in to Kubernetes, and have special scaling options on top of those + * available to normal per-pod metrics using the "pods" source. + * +optional + */ + containerResource?: ContainerResourceMetricSource | undefined; + /** + * external refers to a global metric that is not associated + * with any Kubernetes object. It allows autoscaling based on information + * coming from components running outside of cluster + * (for example length of queue in cloud messaging service, or + * QPS from loadbalancer running outside of cluster). + * +optional + */ + external?: ExternalMetricSource | undefined; +} + +/** MetricStatus describes the last-read state of a single metric. */ +export interface MetricStatus { + /** + * type is the type of metric source. It will be one of "ContainerResource", "External", + * "Object", "Pods" or "Resource", each corresponds to a matching field in the object. + */ + type?: string | undefined; + /** + * object refers to a metric describing a single kubernetes object + * (for example, hits-per-second on an Ingress object). + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:opaqueType + */ + object?: ObjectMetricStatus | undefined; + /** + * pods refers to a metric describing each pod in the current scale target + * (for example, transactions-processed-per-second). The values will be + * averaged together before being compared to the target value. + * +optional + */ + pods?: PodsMetricStatus | undefined; + /** + * resource refers to a resource metric (such as those specified in + * requests and limits) known to Kubernetes describing each pod in the + * current scale target (e.g. CPU or memory). Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available + * to normal per-pod metrics using the "pods" source. + * +optional + */ + resource?: ResourceMetricStatus | undefined; + /** + * containerResource refers to a resource metric (such as those specified in + * requests and limits) known to Kubernetes describing a single container in each pod in the + * current scale target (e.g. CPU or memory). Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available + * to normal per-pod metrics using the "pods" source. + * +optional + */ + containerResource?: ContainerResourceMetricStatus | undefined; + /** + * external refers to a global metric that is not associated + * with any Kubernetes object. It allows autoscaling based on information + * coming from components running outside of cluster + * (for example length of queue in cloud messaging service, or + * QPS from loadbalancer running outside of cluster). + * +optional + */ + external?: ExternalMetricStatus | undefined; +} + +/** MetricTarget defines the target value, average value, or average utilization of a specific metric */ +export interface MetricTarget { + /** type represents whether the metric type is Utilization, Value, or AverageValue */ + type?: string | undefined; + /** + * value is the target value of the metric (as a quantity). + * +optional + */ + value?: Quantity | undefined; + /** + * averageValue is the target value of the average of the + * metric across all relevant pods (as a quantity) + * +optional + */ + averageValue?: Quantity | undefined; + /** + * averageUtilization is the target value of the average of the + * resource metric across all relevant pods, represented as a percentage of + * the requested value of the resource for the pods. + * Currently only valid for Resource metric source type + * +optional + */ + averageUtilization?: number | undefined; +} + +/** MetricValueStatus holds the current value for a metric */ +export interface MetricValueStatus { + /** + * value is the current value of the metric (as a quantity). + * +optional + */ + value?: Quantity | undefined; + /** + * averageValue is the current value of the average of the + * metric across all relevant pods (as a quantity) + * +optional + */ + averageValue?: Quantity | undefined; + /** + * averageUtilization is the current value of the average of the + * resource metric across all relevant pods, represented as a percentage of + * the requested value of the resource for the pods. + * +optional + */ + averageUtilization?: number | undefined; +} + +/** + * ObjectMetricSource indicates how to scale on a metric describing a + * kubernetes object (for example, hits-per-second on an Ingress object). + */ +export interface ObjectMetricSource { + /** describedObject specifies the descriptions of a object,such as kind,name apiVersion */ + describedObject?: CrossVersionObjectReference | undefined; + /** target specifies the target value for the given metric */ + target?: MetricTarget | undefined; + /** metric identifies the target metric by name and selector */ + metric?: MetricIdentifier | undefined; +} + +/** + * ObjectMetricStatus indicates the current value of a metric describing a + * kubernetes object (for example, hits-per-second on an Ingress object). + */ +export interface ObjectMetricStatus { + /** metric identifies the target metric by name and selector */ + metric?: MetricIdentifier | undefined; + /** current contains the current value for the given metric */ + current?: MetricValueStatus | undefined; + /** describedObject specifies the descriptions of a object,such as kind,name apiVersion */ + describedObject?: CrossVersionObjectReference | undefined; +} + +/** + * PodsMetricSource indicates how to scale on a metric describing each pod in + * the current scale target (for example, transactions-processed-per-second). + * The values will be averaged together before being compared to the target + * value. + */ +export interface PodsMetricSource { + /** metric identifies the target metric by name and selector */ + metric?: MetricIdentifier | undefined; + /** target specifies the target value for the given metric */ + target?: MetricTarget | undefined; +} + +/** + * PodsMetricStatus indicates the current value of a metric describing each pod in + * the current scale target (for example, transactions-processed-per-second). + */ +export interface PodsMetricStatus { + /** metric identifies the target metric by name and selector */ + metric?: MetricIdentifier | undefined; + /** current contains the current value for the given metric */ + current?: MetricValueStatus | undefined; +} + +/** + * ResourceMetricSource indicates how to scale on a resource metric known to + * Kubernetes, as specified in requests and limits, describing each pod in the + * current scale target (e.g. CPU or memory). The values will be averaged + * together before being compared to the target. Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available to + * normal per-pod metrics using the "pods" source. Only one "target" type + * should be set. + */ +export interface ResourceMetricSource { + /** name is the name of the resource in question. */ + name?: string | undefined; + /** target specifies the target value for the given metric */ + target?: MetricTarget | undefined; +} + +/** + * ResourceMetricStatus indicates the current value of a resource metric known to + * Kubernetes, as specified in requests and limits, describing each pod in the + * current scale target (e.g. CPU or memory). Such metrics are built in to + * Kubernetes, and have special scaling options on top of those available to + * normal per-pod metrics using the "pods" source. + */ +export interface ResourceMetricStatus { + /** name is the name of the resource in question. */ + name?: string | undefined; + /** current contains the current value for the given metric */ + current?: MetricValueStatus | undefined; +} + +function createBaseContainerResourceMetricSource(): ContainerResourceMetricSource { + return { name: '', target: undefined, container: '' }; +} + +export const ContainerResourceMetricSource: MessageFns = { + encode(message: ContainerResourceMetricSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.target !== undefined) { + MetricTarget.encode(message.target, writer.uint32(18).fork()).join(); + } + if (message.container !== undefined && message.container !== '') { + writer.uint32(26).string(message.container); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerResourceMetricSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerResourceMetricSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.target = MetricTarget.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.container = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerResourceMetricSource { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + target: isSet(object.target) ? MetricTarget.fromJSON(object.target) : undefined, + container: isSet(object.container) ? globalThis.String(object.container) : '', + }; + }, + + toJSON(message: ContainerResourceMetricSource): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.target !== undefined) { + obj.target = MetricTarget.toJSON(message.target); + } + if (message.container !== undefined && message.container !== '') { + obj.container = message.container; + } + return obj; + }, + + create, I>>( + base?: I, + ): ContainerResourceMetricSource { + return ContainerResourceMetricSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ContainerResourceMetricSource { + const message = createBaseContainerResourceMetricSource(); + message.name = object.name ?? ''; + message.target = + object.target !== undefined && object.target !== null + ? MetricTarget.fromPartial(object.target) + : undefined; + message.container = object.container ?? ''; + return message; + }, +}; + +function createBaseContainerResourceMetricStatus(): ContainerResourceMetricStatus { + return { name: '', current: undefined, container: '' }; +} + +export const ContainerResourceMetricStatus: MessageFns = { + encode(message: ContainerResourceMetricStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.current !== undefined) { + MetricValueStatus.encode(message.current, writer.uint32(18).fork()).join(); + } + if (message.container !== undefined && message.container !== '') { + writer.uint32(26).string(message.container); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerResourceMetricStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerResourceMetricStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.current = MetricValueStatus.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.container = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerResourceMetricStatus { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + current: isSet(object.current) ? MetricValueStatus.fromJSON(object.current) : undefined, + container: isSet(object.container) ? globalThis.String(object.container) : '', + }; + }, + + toJSON(message: ContainerResourceMetricStatus): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.current !== undefined) { + obj.current = MetricValueStatus.toJSON(message.current); + } + if (message.container !== undefined && message.container !== '') { + obj.container = message.container; + } + return obj; + }, + + create, I>>( + base?: I, + ): ContainerResourceMetricStatus { + return ContainerResourceMetricStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ContainerResourceMetricStatus { + const message = createBaseContainerResourceMetricStatus(); + message.name = object.name ?? ''; + message.current = + object.current !== undefined && object.current !== null + ? MetricValueStatus.fromPartial(object.current) + : undefined; + message.container = object.container ?? ''; + return message; + }, +}; + +function createBaseCrossVersionObjectReference(): CrossVersionObjectReference { + return { kind: '', name: '', apiVersion: '' }; +} + +export const CrossVersionObjectReference: MessageFns = { + encode(message: CrossVersionObjectReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kind !== undefined && message.kind !== '') { + writer.uint32(10).string(message.kind); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(18).string(message.name); + } + if (message.apiVersion !== undefined && message.apiVersion !== '') { + writer.uint32(26).string(message.apiVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CrossVersionObjectReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCrossVersionObjectReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.apiVersion = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CrossVersionObjectReference { + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + apiVersion: isSet(object.apiVersion) ? globalThis.String(object.apiVersion) : '', + }; + }, + + toJSON(message: CrossVersionObjectReference): unknown { + const obj: any = {}; + if (message.kind !== undefined && message.kind !== '') { + obj.kind = message.kind; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.apiVersion !== undefined && message.apiVersion !== '') { + obj.apiVersion = message.apiVersion; + } + return obj; + }, + + create, I>>( + base?: I, + ): CrossVersionObjectReference { + return CrossVersionObjectReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CrossVersionObjectReference { + const message = createBaseCrossVersionObjectReference(); + message.kind = object.kind ?? ''; + message.name = object.name ?? ''; + message.apiVersion = object.apiVersion ?? ''; + return message; + }, +}; + +function createBaseExternalMetricSource(): ExternalMetricSource { + return { metric: undefined, target: undefined }; +} + +export const ExternalMetricSource: MessageFns = { + encode(message: ExternalMetricSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metric !== undefined) { + MetricIdentifier.encode(message.metric, writer.uint32(10).fork()).join(); + } + if (message.target !== undefined) { + MetricTarget.encode(message.target, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExternalMetricSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExternalMetricSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metric = MetricIdentifier.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.target = MetricTarget.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ExternalMetricSource { + return { + metric: isSet(object.metric) ? MetricIdentifier.fromJSON(object.metric) : undefined, + target: isSet(object.target) ? MetricTarget.fromJSON(object.target) : undefined, + }; + }, + + toJSON(message: ExternalMetricSource): unknown { + const obj: any = {}; + if (message.metric !== undefined) { + obj.metric = MetricIdentifier.toJSON(message.metric); + } + if (message.target !== undefined) { + obj.target = MetricTarget.toJSON(message.target); + } + return obj; + }, + + create, I>>(base?: I): ExternalMetricSource { + return ExternalMetricSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExternalMetricSource { + const message = createBaseExternalMetricSource(); + message.metric = + object.metric !== undefined && object.metric !== null + ? MetricIdentifier.fromPartial(object.metric) + : undefined; + message.target = + object.target !== undefined && object.target !== null + ? MetricTarget.fromPartial(object.target) + : undefined; + return message; + }, +}; + +function createBaseExternalMetricStatus(): ExternalMetricStatus { + return { metric: undefined, current: undefined }; +} + +export const ExternalMetricStatus: MessageFns = { + encode(message: ExternalMetricStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metric !== undefined) { + MetricIdentifier.encode(message.metric, writer.uint32(10).fork()).join(); + } + if (message.current !== undefined) { + MetricValueStatus.encode(message.current, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExternalMetricStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExternalMetricStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metric = MetricIdentifier.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.current = MetricValueStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ExternalMetricStatus { + return { + metric: isSet(object.metric) ? MetricIdentifier.fromJSON(object.metric) : undefined, + current: isSet(object.current) ? MetricValueStatus.fromJSON(object.current) : undefined, + }; + }, + + toJSON(message: ExternalMetricStatus): unknown { + const obj: any = {}; + if (message.metric !== undefined) { + obj.metric = MetricIdentifier.toJSON(message.metric); + } + if (message.current !== undefined) { + obj.current = MetricValueStatus.toJSON(message.current); + } + return obj; + }, + + create, I>>(base?: I): ExternalMetricStatus { + return ExternalMetricStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExternalMetricStatus { + const message = createBaseExternalMetricStatus(); + message.metric = + object.metric !== undefined && object.metric !== null + ? MetricIdentifier.fromPartial(object.metric) + : undefined; + message.current = + object.current !== undefined && object.current !== null + ? MetricValueStatus.fromPartial(object.current) + : undefined; + return message; + }, +}; + +function createBaseHPAScalingPolicy(): HPAScalingPolicy { + return { type: '', value: 0, periodSeconds: 0 }; +} + +export const HPAScalingPolicy: MessageFns = { + encode(message: HPAScalingPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.value !== undefined && message.value !== 0) { + writer.uint32(16).int32(message.value); + } + if (message.periodSeconds !== undefined && message.periodSeconds !== 0) { + writer.uint32(24).int32(message.periodSeconds); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HPAScalingPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHPAScalingPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.value = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.periodSeconds = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HPAScalingPolicy { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + value: isSet(object.value) ? globalThis.Number(object.value) : 0, + periodSeconds: isSet(object.periodSeconds) ? globalThis.Number(object.periodSeconds) : 0, + }; + }, + + toJSON(message: HPAScalingPolicy): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.value !== undefined && message.value !== 0) { + obj.value = Math.round(message.value); + } + if (message.periodSeconds !== undefined && message.periodSeconds !== 0) { + obj.periodSeconds = Math.round(message.periodSeconds); + } + return obj; + }, + + create, I>>(base?: I): HPAScalingPolicy { + return HPAScalingPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HPAScalingPolicy { + const message = createBaseHPAScalingPolicy(); + message.type = object.type ?? ''; + message.value = object.value ?? 0; + message.periodSeconds = object.periodSeconds ?? 0; + return message; + }, +}; + +function createBaseHPAScalingRules(): HPAScalingRules { + return { stabilizationWindowSeconds: 0, selectPolicy: '', policies: [], tolerance: undefined }; +} + +export const HPAScalingRules: MessageFns = { + encode(message: HPAScalingRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stabilizationWindowSeconds !== undefined && message.stabilizationWindowSeconds !== 0) { + writer.uint32(24).int32(message.stabilizationWindowSeconds); + } + if (message.selectPolicy !== undefined && message.selectPolicy !== '') { + writer.uint32(10).string(message.selectPolicy); + } + for (const v of message.policies) { + HPAScalingPolicy.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.tolerance !== undefined) { + Quantity.encode(message.tolerance, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HPAScalingRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHPAScalingRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 24) { + break; + } + + message.stabilizationWindowSeconds = reader.int32(); + continue; + } + case 1: { + if (tag !== 10) { + break; + } + + message.selectPolicy = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.policies.push(HPAScalingPolicy.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.tolerance = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HPAScalingRules { + return { + stabilizationWindowSeconds: isSet(object.stabilizationWindowSeconds) + ? globalThis.Number(object.stabilizationWindowSeconds) + : 0, + selectPolicy: isSet(object.selectPolicy) ? globalThis.String(object.selectPolicy) : '', + policies: globalThis.Array.isArray(object?.policies) + ? object.policies.map((e: any) => HPAScalingPolicy.fromJSON(e)) + : [], + tolerance: isSet(object.tolerance) ? Quantity.fromJSON(object.tolerance) : undefined, + }; + }, + + toJSON(message: HPAScalingRules): unknown { + const obj: any = {}; + if (message.stabilizationWindowSeconds !== undefined && message.stabilizationWindowSeconds !== 0) { + obj.stabilizationWindowSeconds = Math.round(message.stabilizationWindowSeconds); + } + if (message.selectPolicy !== undefined && message.selectPolicy !== '') { + obj.selectPolicy = message.selectPolicy; + } + if (message.policies?.length) { + obj.policies = message.policies.map((e) => HPAScalingPolicy.toJSON(e)); + } + if (message.tolerance !== undefined) { + obj.tolerance = Quantity.toJSON(message.tolerance); + } + return obj; + }, + + create, I>>(base?: I): HPAScalingRules { + return HPAScalingRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HPAScalingRules { + const message = createBaseHPAScalingRules(); + message.stabilizationWindowSeconds = object.stabilizationWindowSeconds ?? 0; + message.selectPolicy = object.selectPolicy ?? ''; + message.policies = object.policies?.map((e) => HPAScalingPolicy.fromPartial(e)) || []; + message.tolerance = + object.tolerance !== undefined && object.tolerance !== null + ? Quantity.fromPartial(object.tolerance) + : undefined; + return message; + }, +}; + +function createBaseHorizontalPodAutoscaler(): HorizontalPodAutoscaler { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const HorizontalPodAutoscaler: MessageFns = { + encode(message: HorizontalPodAutoscaler, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + HorizontalPodAutoscalerSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + HorizontalPodAutoscalerStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HorizontalPodAutoscaler { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHorizontalPodAutoscaler(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = HorizontalPodAutoscalerSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = HorizontalPodAutoscalerStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HorizontalPodAutoscaler { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? HorizontalPodAutoscalerSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? HorizontalPodAutoscalerStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: HorizontalPodAutoscaler): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = HorizontalPodAutoscalerSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = HorizontalPodAutoscalerStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): HorizontalPodAutoscaler { + return HorizontalPodAutoscaler.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): HorizontalPodAutoscaler { + const message = createBaseHorizontalPodAutoscaler(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? HorizontalPodAutoscalerSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? HorizontalPodAutoscalerStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseHorizontalPodAutoscalerBehavior(): HorizontalPodAutoscalerBehavior { + return { scaleUp: undefined, scaleDown: undefined }; +} + +export const HorizontalPodAutoscalerBehavior: MessageFns = { + encode( + message: HorizontalPodAutoscalerBehavior, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.scaleUp !== undefined) { + HPAScalingRules.encode(message.scaleUp, writer.uint32(10).fork()).join(); + } + if (message.scaleDown !== undefined) { + HPAScalingRules.encode(message.scaleDown, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HorizontalPodAutoscalerBehavior { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHorizontalPodAutoscalerBehavior(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.scaleUp = HPAScalingRules.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.scaleDown = HPAScalingRules.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HorizontalPodAutoscalerBehavior { + return { + scaleUp: isSet(object.scaleUp) ? HPAScalingRules.fromJSON(object.scaleUp) : undefined, + scaleDown: isSet(object.scaleDown) ? HPAScalingRules.fromJSON(object.scaleDown) : undefined, + }; + }, + + toJSON(message: HorizontalPodAutoscalerBehavior): unknown { + const obj: any = {}; + if (message.scaleUp !== undefined) { + obj.scaleUp = HPAScalingRules.toJSON(message.scaleUp); + } + if (message.scaleDown !== undefined) { + obj.scaleDown = HPAScalingRules.toJSON(message.scaleDown); + } + return obj; + }, + + create, I>>( + base?: I, + ): HorizontalPodAutoscalerBehavior { + return HorizontalPodAutoscalerBehavior.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): HorizontalPodAutoscalerBehavior { + const message = createBaseHorizontalPodAutoscalerBehavior(); + message.scaleUp = + object.scaleUp !== undefined && object.scaleUp !== null + ? HPAScalingRules.fromPartial(object.scaleUp) + : undefined; + message.scaleDown = + object.scaleDown !== undefined && object.scaleDown !== null + ? HPAScalingRules.fromPartial(object.scaleDown) + : undefined; + return message; + }, +}; + +function createBaseHorizontalPodAutoscalerCondition(): HorizontalPodAutoscalerCondition { + return { + type: '', + status: '', + lastTransitionTime: undefined, + reason: '', + message: '', + observedGeneration: 0, + }; +} + +export const HorizontalPodAutoscalerCondition: MessageFns = { + encode( + message: HorizontalPodAutoscalerCondition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(26).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(42).string(message.message); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(48).int64(message.observedGeneration); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HorizontalPodAutoscalerCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHorizontalPodAutoscalerCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HorizontalPodAutoscalerCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + }; + }, + + toJSON(message: HorizontalPodAutoscalerCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + return obj; + }, + + create, I>>( + base?: I, + ): HorizontalPodAutoscalerCondition { + return HorizontalPodAutoscalerCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): HorizontalPodAutoscalerCondition { + const message = createBaseHorizontalPodAutoscalerCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + message.observedGeneration = object.observedGeneration ?? 0; + return message; + }, +}; + +function createBaseHorizontalPodAutoscalerList(): HorizontalPodAutoscalerList { + return { metadata: undefined, items: [] }; +} + +export const HorizontalPodAutoscalerList: MessageFns = { + encode(message: HorizontalPodAutoscalerList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + HorizontalPodAutoscaler.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HorizontalPodAutoscalerList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHorizontalPodAutoscalerList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(HorizontalPodAutoscaler.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HorizontalPodAutoscalerList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => HorizontalPodAutoscaler.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HorizontalPodAutoscalerList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => HorizontalPodAutoscaler.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): HorizontalPodAutoscalerList { + return HorizontalPodAutoscalerList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): HorizontalPodAutoscalerList { + const message = createBaseHorizontalPodAutoscalerList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => HorizontalPodAutoscaler.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseHorizontalPodAutoscalerSpec(): HorizontalPodAutoscalerSpec { + return { scaleTargetRef: undefined, minReplicas: 0, maxReplicas: 0, metrics: [], behavior: undefined }; +} + +export const HorizontalPodAutoscalerSpec: MessageFns = { + encode(message: HorizontalPodAutoscalerSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.scaleTargetRef !== undefined) { + CrossVersionObjectReference.encode(message.scaleTargetRef, writer.uint32(10).fork()).join(); + } + if (message.minReplicas !== undefined && message.minReplicas !== 0) { + writer.uint32(16).int32(message.minReplicas); + } + if (message.maxReplicas !== undefined && message.maxReplicas !== 0) { + writer.uint32(24).int32(message.maxReplicas); + } + for (const v of message.metrics) { + MetricSpec.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.behavior !== undefined) { + HorizontalPodAutoscalerBehavior.encode(message.behavior, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HorizontalPodAutoscalerSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHorizontalPodAutoscalerSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.scaleTargetRef = CrossVersionObjectReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.minReplicas = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxReplicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.metrics.push(MetricSpec.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.behavior = HorizontalPodAutoscalerBehavior.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HorizontalPodAutoscalerSpec { + return { + scaleTargetRef: isSet(object.scaleTargetRef) + ? CrossVersionObjectReference.fromJSON(object.scaleTargetRef) + : undefined, + minReplicas: isSet(object.minReplicas) ? globalThis.Number(object.minReplicas) : 0, + maxReplicas: isSet(object.maxReplicas) ? globalThis.Number(object.maxReplicas) : 0, + metrics: globalThis.Array.isArray(object?.metrics) + ? object.metrics.map((e: any) => MetricSpec.fromJSON(e)) + : [], + behavior: isSet(object.behavior) + ? HorizontalPodAutoscalerBehavior.fromJSON(object.behavior) + : undefined, + }; + }, + + toJSON(message: HorizontalPodAutoscalerSpec): unknown { + const obj: any = {}; + if (message.scaleTargetRef !== undefined) { + obj.scaleTargetRef = CrossVersionObjectReference.toJSON(message.scaleTargetRef); + } + if (message.minReplicas !== undefined && message.minReplicas !== 0) { + obj.minReplicas = Math.round(message.minReplicas); + } + if (message.maxReplicas !== undefined && message.maxReplicas !== 0) { + obj.maxReplicas = Math.round(message.maxReplicas); + } + if (message.metrics?.length) { + obj.metrics = message.metrics.map((e) => MetricSpec.toJSON(e)); + } + if (message.behavior !== undefined) { + obj.behavior = HorizontalPodAutoscalerBehavior.toJSON(message.behavior); + } + return obj; + }, + + create, I>>( + base?: I, + ): HorizontalPodAutoscalerSpec { + return HorizontalPodAutoscalerSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): HorizontalPodAutoscalerSpec { + const message = createBaseHorizontalPodAutoscalerSpec(); + message.scaleTargetRef = + object.scaleTargetRef !== undefined && object.scaleTargetRef !== null + ? CrossVersionObjectReference.fromPartial(object.scaleTargetRef) + : undefined; + message.minReplicas = object.minReplicas ?? 0; + message.maxReplicas = object.maxReplicas ?? 0; + message.metrics = object.metrics?.map((e) => MetricSpec.fromPartial(e)) || []; + message.behavior = + object.behavior !== undefined && object.behavior !== null + ? HorizontalPodAutoscalerBehavior.fromPartial(object.behavior) + : undefined; + return message; + }, +}; + +function createBaseHorizontalPodAutoscalerStatus(): HorizontalPodAutoscalerStatus { + return { + observedGeneration: 0, + lastScaleTime: undefined, + currentReplicas: 0, + desiredReplicas: 0, + currentMetrics: [], + conditions: [], + }; +} + +export const HorizontalPodAutoscalerStatus: MessageFns = { + encode(message: HorizontalPodAutoscalerStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(8).int64(message.observedGeneration); + } + if (message.lastScaleTime !== undefined) { + Time.encode(message.lastScaleTime, writer.uint32(18).fork()).join(); + } + if (message.currentReplicas !== undefined && message.currentReplicas !== 0) { + writer.uint32(24).int32(message.currentReplicas); + } + if (message.desiredReplicas !== undefined && message.desiredReplicas !== 0) { + writer.uint32(32).int32(message.desiredReplicas); + } + for (const v of message.currentMetrics) { + MetricStatus.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.conditions) { + HorizontalPodAutoscalerCondition.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HorizontalPodAutoscalerStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHorizontalPodAutoscalerStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.lastScaleTime = Time.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.currentReplicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.desiredReplicas = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.currentMetrics.push(MetricStatus.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.conditions.push( + HorizontalPodAutoscalerCondition.decode(reader, reader.uint32()), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HorizontalPodAutoscalerStatus { + return { + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + lastScaleTime: isSet(object.lastScaleTime) ? Time.fromJSON(object.lastScaleTime) : undefined, + currentReplicas: isSet(object.currentReplicas) ? globalThis.Number(object.currentReplicas) : 0, + desiredReplicas: isSet(object.desiredReplicas) ? globalThis.Number(object.desiredReplicas) : 0, + currentMetrics: globalThis.Array.isArray(object?.currentMetrics) + ? object.currentMetrics.map((e: any) => MetricStatus.fromJSON(e)) + : [], + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => HorizontalPodAutoscalerCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HorizontalPodAutoscalerStatus): unknown { + const obj: any = {}; + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.lastScaleTime !== undefined) { + obj.lastScaleTime = Time.toJSON(message.lastScaleTime); + } + if (message.currentReplicas !== undefined && message.currentReplicas !== 0) { + obj.currentReplicas = Math.round(message.currentReplicas); + } + if (message.desiredReplicas !== undefined && message.desiredReplicas !== 0) { + obj.desiredReplicas = Math.round(message.desiredReplicas); + } + if (message.currentMetrics?.length) { + obj.currentMetrics = message.currentMetrics.map((e) => MetricStatus.toJSON(e)); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => HorizontalPodAutoscalerCondition.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): HorizontalPodAutoscalerStatus { + return HorizontalPodAutoscalerStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): HorizontalPodAutoscalerStatus { + const message = createBaseHorizontalPodAutoscalerStatus(); + message.observedGeneration = object.observedGeneration ?? 0; + message.lastScaleTime = + object.lastScaleTime !== undefined && object.lastScaleTime !== null + ? Time.fromPartial(object.lastScaleTime) + : undefined; + message.currentReplicas = object.currentReplicas ?? 0; + message.desiredReplicas = object.desiredReplicas ?? 0; + message.currentMetrics = object.currentMetrics?.map((e) => MetricStatus.fromPartial(e)) || []; + message.conditions = + object.conditions?.map((e) => HorizontalPodAutoscalerCondition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMetricIdentifier(): MetricIdentifier { + return { name: '', selector: undefined }; +} + +export const MetricIdentifier: MessageFns = { + encode(message: MetricIdentifier, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetricIdentifier { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetricIdentifier(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MetricIdentifier { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + }; + }, + + toJSON(message: MetricIdentifier): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + return obj; + }, + + create, I>>(base?: I): MetricIdentifier { + return MetricIdentifier.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MetricIdentifier { + const message = createBaseMetricIdentifier(); + message.name = object.name ?? ''; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + return message; + }, +}; + +function createBaseMetricSpec(): MetricSpec { + return { + type: '', + object: undefined, + pods: undefined, + resource: undefined, + containerResource: undefined, + external: undefined, + }; +} + +export const MetricSpec: MessageFns = { + encode(message: MetricSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.object !== undefined) { + ObjectMetricSource.encode(message.object, writer.uint32(18).fork()).join(); + } + if (message.pods !== undefined) { + PodsMetricSource.encode(message.pods, writer.uint32(26).fork()).join(); + } + if (message.resource !== undefined) { + ResourceMetricSource.encode(message.resource, writer.uint32(34).fork()).join(); + } + if (message.containerResource !== undefined) { + ContainerResourceMetricSource.encode(message.containerResource, writer.uint32(58).fork()).join(); + } + if (message.external !== undefined) { + ExternalMetricSource.encode(message.external, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetricSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetricSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.object = ObjectMetricSource.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.pods = PodsMetricSource.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.resource = ResourceMetricSource.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.containerResource = ContainerResourceMetricSource.decode( + reader, + reader.uint32(), + ); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.external = ExternalMetricSource.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MetricSpec { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + object: isSet(object.object) ? ObjectMetricSource.fromJSON(object.object) : undefined, + pods: isSet(object.pods) ? PodsMetricSource.fromJSON(object.pods) : undefined, + resource: isSet(object.resource) ? ResourceMetricSource.fromJSON(object.resource) : undefined, + containerResource: isSet(object.containerResource) + ? ContainerResourceMetricSource.fromJSON(object.containerResource) + : undefined, + external: isSet(object.external) ? ExternalMetricSource.fromJSON(object.external) : undefined, + }; + }, + + toJSON(message: MetricSpec): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.object !== undefined) { + obj.object = ObjectMetricSource.toJSON(message.object); + } + if (message.pods !== undefined) { + obj.pods = PodsMetricSource.toJSON(message.pods); + } + if (message.resource !== undefined) { + obj.resource = ResourceMetricSource.toJSON(message.resource); + } + if (message.containerResource !== undefined) { + obj.containerResource = ContainerResourceMetricSource.toJSON(message.containerResource); + } + if (message.external !== undefined) { + obj.external = ExternalMetricSource.toJSON(message.external); + } + return obj; + }, + + create, I>>(base?: I): MetricSpec { + return MetricSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MetricSpec { + const message = createBaseMetricSpec(); + message.type = object.type ?? ''; + message.object = + object.object !== undefined && object.object !== null + ? ObjectMetricSource.fromPartial(object.object) + : undefined; + message.pods = + object.pods !== undefined && object.pods !== null + ? PodsMetricSource.fromPartial(object.pods) + : undefined; + message.resource = + object.resource !== undefined && object.resource !== null + ? ResourceMetricSource.fromPartial(object.resource) + : undefined; + message.containerResource = + object.containerResource !== undefined && object.containerResource !== null + ? ContainerResourceMetricSource.fromPartial(object.containerResource) + : undefined; + message.external = + object.external !== undefined && object.external !== null + ? ExternalMetricSource.fromPartial(object.external) + : undefined; + return message; + }, +}; + +function createBaseMetricStatus(): MetricStatus { + return { + type: '', + object: undefined, + pods: undefined, + resource: undefined, + containerResource: undefined, + external: undefined, + }; +} + +export const MetricStatus: MessageFns = { + encode(message: MetricStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.object !== undefined) { + ObjectMetricStatus.encode(message.object, writer.uint32(18).fork()).join(); + } + if (message.pods !== undefined) { + PodsMetricStatus.encode(message.pods, writer.uint32(26).fork()).join(); + } + if (message.resource !== undefined) { + ResourceMetricStatus.encode(message.resource, writer.uint32(34).fork()).join(); + } + if (message.containerResource !== undefined) { + ContainerResourceMetricStatus.encode(message.containerResource, writer.uint32(58).fork()).join(); + } + if (message.external !== undefined) { + ExternalMetricStatus.encode(message.external, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetricStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetricStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.object = ObjectMetricStatus.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.pods = PodsMetricStatus.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.resource = ResourceMetricStatus.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.containerResource = ContainerResourceMetricStatus.decode( + reader, + reader.uint32(), + ); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.external = ExternalMetricStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MetricStatus { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + object: isSet(object.object) ? ObjectMetricStatus.fromJSON(object.object) : undefined, + pods: isSet(object.pods) ? PodsMetricStatus.fromJSON(object.pods) : undefined, + resource: isSet(object.resource) ? ResourceMetricStatus.fromJSON(object.resource) : undefined, + containerResource: isSet(object.containerResource) + ? ContainerResourceMetricStatus.fromJSON(object.containerResource) + : undefined, + external: isSet(object.external) ? ExternalMetricStatus.fromJSON(object.external) : undefined, + }; + }, + + toJSON(message: MetricStatus): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.object !== undefined) { + obj.object = ObjectMetricStatus.toJSON(message.object); + } + if (message.pods !== undefined) { + obj.pods = PodsMetricStatus.toJSON(message.pods); + } + if (message.resource !== undefined) { + obj.resource = ResourceMetricStatus.toJSON(message.resource); + } + if (message.containerResource !== undefined) { + obj.containerResource = ContainerResourceMetricStatus.toJSON(message.containerResource); + } + if (message.external !== undefined) { + obj.external = ExternalMetricStatus.toJSON(message.external); + } + return obj; + }, + + create, I>>(base?: I): MetricStatus { + return MetricStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MetricStatus { + const message = createBaseMetricStatus(); + message.type = object.type ?? ''; + message.object = + object.object !== undefined && object.object !== null + ? ObjectMetricStatus.fromPartial(object.object) + : undefined; + message.pods = + object.pods !== undefined && object.pods !== null + ? PodsMetricStatus.fromPartial(object.pods) + : undefined; + message.resource = + object.resource !== undefined && object.resource !== null + ? ResourceMetricStatus.fromPartial(object.resource) + : undefined; + message.containerResource = + object.containerResource !== undefined && object.containerResource !== null + ? ContainerResourceMetricStatus.fromPartial(object.containerResource) + : undefined; + message.external = + object.external !== undefined && object.external !== null + ? ExternalMetricStatus.fromPartial(object.external) + : undefined; + return message; + }, +}; + +function createBaseMetricTarget(): MetricTarget { + return { type: '', value: undefined, averageValue: undefined, averageUtilization: 0 }; +} + +export const MetricTarget: MessageFns = { + encode(message: MetricTarget, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + if (message.averageValue !== undefined) { + Quantity.encode(message.averageValue, writer.uint32(26).fork()).join(); + } + if (message.averageUtilization !== undefined && message.averageUtilization !== 0) { + writer.uint32(32).int32(message.averageUtilization); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetricTarget { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetricTarget(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.averageValue = Quantity.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.averageUtilization = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MetricTarget { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + averageValue: isSet(object.averageValue) ? Quantity.fromJSON(object.averageValue) : undefined, + averageUtilization: isSet(object.averageUtilization) + ? globalThis.Number(object.averageUtilization) + : 0, + }; + }, + + toJSON(message: MetricTarget): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + if (message.averageValue !== undefined) { + obj.averageValue = Quantity.toJSON(message.averageValue); + } + if (message.averageUtilization !== undefined && message.averageUtilization !== 0) { + obj.averageUtilization = Math.round(message.averageUtilization); + } + return obj; + }, + + create, I>>(base?: I): MetricTarget { + return MetricTarget.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MetricTarget { + const message = createBaseMetricTarget(); + message.type = object.type ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + message.averageValue = + object.averageValue !== undefined && object.averageValue !== null + ? Quantity.fromPartial(object.averageValue) + : undefined; + message.averageUtilization = object.averageUtilization ?? 0; + return message; + }, +}; + +function createBaseMetricValueStatus(): MetricValueStatus { + return { value: undefined, averageValue: undefined, averageUtilization: 0 }; +} + +export const MetricValueStatus: MessageFns = { + encode(message: MetricValueStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(10).fork()).join(); + } + if (message.averageValue !== undefined) { + Quantity.encode(message.averageValue, writer.uint32(18).fork()).join(); + } + if (message.averageUtilization !== undefined && message.averageUtilization !== 0) { + writer.uint32(24).int32(message.averageUtilization); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetricValueStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetricValueStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.averageValue = Quantity.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.averageUtilization = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MetricValueStatus { + return { + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + averageValue: isSet(object.averageValue) ? Quantity.fromJSON(object.averageValue) : undefined, + averageUtilization: isSet(object.averageUtilization) + ? globalThis.Number(object.averageUtilization) + : 0, + }; + }, + + toJSON(message: MetricValueStatus): unknown { + const obj: any = {}; + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + if (message.averageValue !== undefined) { + obj.averageValue = Quantity.toJSON(message.averageValue); + } + if (message.averageUtilization !== undefined && message.averageUtilization !== 0) { + obj.averageUtilization = Math.round(message.averageUtilization); + } + return obj; + }, + + create, I>>(base?: I): MetricValueStatus { + return MetricValueStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MetricValueStatus { + const message = createBaseMetricValueStatus(); + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + message.averageValue = + object.averageValue !== undefined && object.averageValue !== null + ? Quantity.fromPartial(object.averageValue) + : undefined; + message.averageUtilization = object.averageUtilization ?? 0; + return message; + }, +}; + +function createBaseObjectMetricSource(): ObjectMetricSource { + return { describedObject: undefined, target: undefined, metric: undefined }; +} + +export const ObjectMetricSource: MessageFns = { + encode(message: ObjectMetricSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.describedObject !== undefined) { + CrossVersionObjectReference.encode(message.describedObject, writer.uint32(10).fork()).join(); + } + if (message.target !== undefined) { + MetricTarget.encode(message.target, writer.uint32(18).fork()).join(); + } + if (message.metric !== undefined) { + MetricIdentifier.encode(message.metric, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ObjectMetricSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseObjectMetricSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.describedObject = CrossVersionObjectReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.target = MetricTarget.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.metric = MetricIdentifier.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ObjectMetricSource { + return { + describedObject: isSet(object.describedObject) + ? CrossVersionObjectReference.fromJSON(object.describedObject) + : undefined, + target: isSet(object.target) ? MetricTarget.fromJSON(object.target) : undefined, + metric: isSet(object.metric) ? MetricIdentifier.fromJSON(object.metric) : undefined, + }; + }, + + toJSON(message: ObjectMetricSource): unknown { + const obj: any = {}; + if (message.describedObject !== undefined) { + obj.describedObject = CrossVersionObjectReference.toJSON(message.describedObject); + } + if (message.target !== undefined) { + obj.target = MetricTarget.toJSON(message.target); + } + if (message.metric !== undefined) { + obj.metric = MetricIdentifier.toJSON(message.metric); + } + return obj; + }, + + create, I>>(base?: I): ObjectMetricSource { + return ObjectMetricSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ObjectMetricSource { + const message = createBaseObjectMetricSource(); + message.describedObject = + object.describedObject !== undefined && object.describedObject !== null + ? CrossVersionObjectReference.fromPartial(object.describedObject) + : undefined; + message.target = + object.target !== undefined && object.target !== null + ? MetricTarget.fromPartial(object.target) + : undefined; + message.metric = + object.metric !== undefined && object.metric !== null + ? MetricIdentifier.fromPartial(object.metric) + : undefined; + return message; + }, +}; + +function createBaseObjectMetricStatus(): ObjectMetricStatus { + return { metric: undefined, current: undefined, describedObject: undefined }; +} + +export const ObjectMetricStatus: MessageFns = { + encode(message: ObjectMetricStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metric !== undefined) { + MetricIdentifier.encode(message.metric, writer.uint32(10).fork()).join(); + } + if (message.current !== undefined) { + MetricValueStatus.encode(message.current, writer.uint32(18).fork()).join(); + } + if (message.describedObject !== undefined) { + CrossVersionObjectReference.encode(message.describedObject, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ObjectMetricStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseObjectMetricStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metric = MetricIdentifier.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.current = MetricValueStatus.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.describedObject = CrossVersionObjectReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ObjectMetricStatus { + return { + metric: isSet(object.metric) ? MetricIdentifier.fromJSON(object.metric) : undefined, + current: isSet(object.current) ? MetricValueStatus.fromJSON(object.current) : undefined, + describedObject: isSet(object.describedObject) + ? CrossVersionObjectReference.fromJSON(object.describedObject) + : undefined, + }; + }, + + toJSON(message: ObjectMetricStatus): unknown { + const obj: any = {}; + if (message.metric !== undefined) { + obj.metric = MetricIdentifier.toJSON(message.metric); + } + if (message.current !== undefined) { + obj.current = MetricValueStatus.toJSON(message.current); + } + if (message.describedObject !== undefined) { + obj.describedObject = CrossVersionObjectReference.toJSON(message.describedObject); + } + return obj; + }, + + create, I>>(base?: I): ObjectMetricStatus { + return ObjectMetricStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ObjectMetricStatus { + const message = createBaseObjectMetricStatus(); + message.metric = + object.metric !== undefined && object.metric !== null + ? MetricIdentifier.fromPartial(object.metric) + : undefined; + message.current = + object.current !== undefined && object.current !== null + ? MetricValueStatus.fromPartial(object.current) + : undefined; + message.describedObject = + object.describedObject !== undefined && object.describedObject !== null + ? CrossVersionObjectReference.fromPartial(object.describedObject) + : undefined; + return message; + }, +}; + +function createBasePodsMetricSource(): PodsMetricSource { + return { metric: undefined, target: undefined }; +} + +export const PodsMetricSource: MessageFns = { + encode(message: PodsMetricSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metric !== undefined) { + MetricIdentifier.encode(message.metric, writer.uint32(10).fork()).join(); + } + if (message.target !== undefined) { + MetricTarget.encode(message.target, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodsMetricSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodsMetricSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metric = MetricIdentifier.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.target = MetricTarget.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodsMetricSource { + return { + metric: isSet(object.metric) ? MetricIdentifier.fromJSON(object.metric) : undefined, + target: isSet(object.target) ? MetricTarget.fromJSON(object.target) : undefined, + }; + }, + + toJSON(message: PodsMetricSource): unknown { + const obj: any = {}; + if (message.metric !== undefined) { + obj.metric = MetricIdentifier.toJSON(message.metric); + } + if (message.target !== undefined) { + obj.target = MetricTarget.toJSON(message.target); + } + return obj; + }, + + create, I>>(base?: I): PodsMetricSource { + return PodsMetricSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodsMetricSource { + const message = createBasePodsMetricSource(); + message.metric = + object.metric !== undefined && object.metric !== null + ? MetricIdentifier.fromPartial(object.metric) + : undefined; + message.target = + object.target !== undefined && object.target !== null + ? MetricTarget.fromPartial(object.target) + : undefined; + return message; + }, +}; + +function createBasePodsMetricStatus(): PodsMetricStatus { + return { metric: undefined, current: undefined }; +} + +export const PodsMetricStatus: MessageFns = { + encode(message: PodsMetricStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metric !== undefined) { + MetricIdentifier.encode(message.metric, writer.uint32(10).fork()).join(); + } + if (message.current !== undefined) { + MetricValueStatus.encode(message.current, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodsMetricStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodsMetricStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metric = MetricIdentifier.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.current = MetricValueStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodsMetricStatus { + return { + metric: isSet(object.metric) ? MetricIdentifier.fromJSON(object.metric) : undefined, + current: isSet(object.current) ? MetricValueStatus.fromJSON(object.current) : undefined, + }; + }, + + toJSON(message: PodsMetricStatus): unknown { + const obj: any = {}; + if (message.metric !== undefined) { + obj.metric = MetricIdentifier.toJSON(message.metric); + } + if (message.current !== undefined) { + obj.current = MetricValueStatus.toJSON(message.current); + } + return obj; + }, + + create, I>>(base?: I): PodsMetricStatus { + return PodsMetricStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodsMetricStatus { + const message = createBasePodsMetricStatus(); + message.metric = + object.metric !== undefined && object.metric !== null + ? MetricIdentifier.fromPartial(object.metric) + : undefined; + message.current = + object.current !== undefined && object.current !== null + ? MetricValueStatus.fromPartial(object.current) + : undefined; + return message; + }, +}; + +function createBaseResourceMetricSource(): ResourceMetricSource { + return { name: '', target: undefined }; +} + +export const ResourceMetricSource: MessageFns = { + encode(message: ResourceMetricSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.target !== undefined) { + MetricTarget.encode(message.target, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceMetricSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceMetricSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.target = MetricTarget.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceMetricSource { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + target: isSet(object.target) ? MetricTarget.fromJSON(object.target) : undefined, + }; + }, + + toJSON(message: ResourceMetricSource): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.target !== undefined) { + obj.target = MetricTarget.toJSON(message.target); + } + return obj; + }, + + create, I>>(base?: I): ResourceMetricSource { + return ResourceMetricSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceMetricSource { + const message = createBaseResourceMetricSource(); + message.name = object.name ?? ''; + message.target = + object.target !== undefined && object.target !== null + ? MetricTarget.fromPartial(object.target) + : undefined; + return message; + }, +}; + +function createBaseResourceMetricStatus(): ResourceMetricStatus { + return { name: '', current: undefined }; +} + +export const ResourceMetricStatus: MessageFns = { + encode(message: ResourceMetricStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.current !== undefined) { + MetricValueStatus.encode(message.current, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceMetricStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceMetricStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.current = MetricValueStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceMetricStatus { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + current: isSet(object.current) ? MetricValueStatus.fromJSON(object.current) : undefined, + }; + }, + + toJSON(message: ResourceMetricStatus): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.current !== undefined) { + obj.current = MetricValueStatus.toJSON(message.current); + } + return obj; + }, + + create, I>>(base?: I): ResourceMetricStatus { + return ResourceMetricStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceMetricStatus { + const message = createBaseResourceMetricStatus(); + message.name = object.name ?? ''; + message.current = + object.current !== undefined && object.current !== null + ? MetricValueStatus.fromPartial(object.current) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error('Value is smaller than Number.MIN_SAFE_INTEGER'); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/batch/v1/generated.ts b/src/proto/generated/k8s.io/api/batch/v1/generated.ts new file mode 100644 index 00000000000..d862da8d223 --- /dev/null +++ b/src/proto/generated/k8s.io/api/batch/v1/generated.ts @@ -0,0 +1,3257 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/batch/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { + LabelSelector, + ListMeta, + ObjectMeta, + Time, +} from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; +import { ObjectReference, PodTemplateSpec } from '../../core/v1/generated.js'; +import { + WorkloadPodGroupDisruptionMode, + WorkloadPodGroupResourceClaim, + WorkloadPodGroupSchedulingConstraints, + WorkloadPodGroupSchedulingPolicy, +} from '../../scheduling/v1alpha3/generated.js'; + +/** + * CronJob represents the configuration of a single cron job. + * +k8s:supportsSubresource="/status" + */ +export interface CronJob { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Specification of the desired behavior of a cron job, including the schedule. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +required + */ + spec?: CronJobSpec | undefined; + /** + * Current status of a cron job. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: CronJobStatus | undefined; +} + +/** CronJobList is a collection of cron jobs. */ +export interface CronJobList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** items is the list of CronJobs. */ + items: CronJob[]; +} + +/** CronJobSpec describes how the job execution will look like and when it will actually run. */ +export interface CronJobSpec { + /** + * The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + schedule?: string | undefined; + /** + * The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. + * If not specified, this will default to the time zone of the kube-controller-manager process. + * The set of valid time zone names and the time zone offset is loaded from the system-wide time zone + * database by the API server during CronJob validation and the controller manager during execution. + * If no system-wide time zone database can be found a bundled version of the database is used instead. + * If the time zone name becomes invalid during the lifetime of a CronJob or due to a change in host + * configuration, the controller will stop creating new new Jobs and will create a system event with the + * reason UnknownTimeZone. + * More information can be found in https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#time-zones + * +optional + */ + timeZone?: string | undefined; + /** + * Optional deadline in seconds for starting the job if it misses scheduled + * time for any reason. Missed jobs executions will be counted as failed ones. + * +optional + */ + startingDeadlineSeconds?: number | undefined; + /** + * Specifies how to treat concurrent executions of a Job. + * Valid values are: + * + * - "Allow" (default): allows CronJobs to run concurrently; + * - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet; + * - "Replace": cancels currently running job and replaces it with a new one + * +optional + */ + concurrencyPolicy?: string | undefined; + /** + * This flag tells the controller to suspend subsequent executions, it does + * not apply to already started executions. Defaults to false. + * +optional + */ + suspend?: boolean | undefined; + /** + * Specifies the job that will be created when executing a CronJob. + * +required + */ + jobTemplate?: JobTemplateSpec | undefined; + /** + * The number of successful finished jobs to retain. Value must be non-negative integer. + * Defaults to 3. + * +optional + */ + successfulJobsHistoryLimit?: number | undefined; + /** + * The number of failed finished jobs to retain. Value must be non-negative integer. + * Defaults to 1. + * +optional + */ + failedJobsHistoryLimit?: number | undefined; +} + +/** CronJobStatus represents the current state of a cron job. */ +export interface CronJobStatus { + /** + * A list of pointers to currently running jobs. + * +optional + * +listType=atomic + */ + active: ObjectReference[]; + /** + * Information when was the last time the job was successfully scheduled. + * +optional + */ + lastScheduleTime?: Time | undefined; + /** + * Information when was the last time the job successfully completed. + * +optional + */ + lastSuccessfulTime?: Time | undefined; +} + +/** + * Job represents the configuration of a single job. + * +k8s:supportsSubresource="/status" + */ +export interface Job { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Specification of the desired behavior of a job. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +required + */ + spec?: JobSpec | undefined; + /** + * Current status of a job. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: JobStatus | undefined; +} + +/** JobCondition describes current state of a job. */ +export interface JobCondition { + /** + * Type of job condition, Complete or Failed. + * +optional + */ + type?: string | undefined; + /** + * Status of the condition, one of True, False, Unknown. + * +optional + */ + status?: string | undefined; + /** + * Last time the condition was checked. + * +optional + */ + lastProbeTime?: Time | undefined; + /** + * Last time the condition transit from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * (brief) reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * Human readable message indicating details about last transition. + * +optional + */ + message?: string | undefined; +} + +/** JobList is a collection of jobs. */ +export interface JobList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** items is the list of Jobs. */ + items: Job[]; +} + +/** + * JobSchedulingConfiguration composes the reusable workload-aware + * scheduling building blocks. + */ +export interface JobSchedulingConfiguration { + /** + * SchedulingPolicy defines the scheduling policy for this Job. + * Exactly one of Basic or Gang must be set. + * This field is immutable after creation: the policy may not be added or + * removed. The policy variant (basic/gang) is frozen by hand-written + * validation; only schedulingPolicy.gang.minCount may be changed. + * + * +optional + * +k8s:optional + * +k8s:update=NoSet + * +k8s:update=NoUnset + */ + schedulingPolicy?: WorkloadPodGroupSchedulingPolicy | undefined; + /** + * SchedulingConstraints defines scheduling constraints (e.g. topology) + * for the Job's pods. + * This field is immutable after creation. + * + * +optional + * +k8s:optional + * +k8s:immutable + */ + schedulingConstraints?: WorkloadPodGroupSchedulingConstraints | undefined; + /** + * DisruptionMode defines the mode in which the Job's pods can be disrupted. + * One of Single, All. + * This field is immutable after creation: it may not be added or removed, + * and the selected mode may not be changed. + * + * +optional + * +k8s:optional + * +k8s:immutable + */ + disruptionMode?: WorkloadPodGroupDisruptionMode | undefined; + /** + * ResourceClaims defines which ResourceClaims may be shared among Pods in + * the Job. Pods consume the devices allocated to a PodGroup's claim by + * defining a claim in its own Spec.ResourceClaims that matches the + * PodGroup's claim exactly. The claim must have the same name and refer to + * the same ResourceClaim or ResourceClaimTemplate. + * At most 4 claims may be set, matching the limit on the resulting PodGroup. + * This list is immutable after creation: entries may neither be added, + * removed, nor modified. + * + * +optional + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + * +k8s:optional + * +k8s:listType=map + * +k8s:listMapKey=name + * +k8s:maxItems=4 + * +k8s:immutable + */ + resourceClaims: WorkloadPodGroupResourceClaim[]; +} + +/** JobSpec describes how the job execution will look like. */ +export interface JobSpec { + /** + * Specifies the maximum desired number of pods the job should + * run at any given time. The actual number of pods running in steady state will + * be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), + * i.e. when the work left to do is less than max parallelism. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + * +optional + */ + parallelism?: number | undefined; + /** + * Specifies the desired number of successfully finished pods the + * job should be run with. Setting to null means that the success of any + * pod signals the success of all pods, and allows parallelism to have any positive + * value. Setting to 1 means that parallelism is limited to 1 and the success of that + * pod signals the success of the job. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + * +optional + */ + completions?: number | undefined; + /** + * Specifies the duration in seconds relative to the startTime that the job + * may be continuously active before the system tries to terminate it; value + * must be positive integer. If a Job is suspended (at creation or through an + * update), this timer will effectively be stopped and reset when the Job is + * resumed again. + * +optional + */ + activeDeadlineSeconds?: number | undefined; + /** + * Specifies the policy of handling failed pods. In particular, it allows to + * specify the set of actions and conditions which need to be + * satisfied to take the associated action. + * If empty, the default behaviour applies - the counter of failed pods, + * represented by the jobs's .status.failed field, is incremented and it is + * checked against the backoffLimit. This field cannot be used in combination + * with restartPolicy=OnFailure. + * + * +optional + */ + podFailurePolicy?: PodFailurePolicy | undefined; + /** + * successPolicy specifies the policy when the Job can be declared as succeeded. + * If empty, the default behavior applies - the Job is declared as succeeded + * only when the number of succeeded pods equals to the completions. + * When the field is specified, it must be immutable and works only for the Indexed Jobs. + * Once the Job meets the SuccessPolicy, the lingering pods are terminated. + * + * +optional + */ + successPolicy?: SuccessPolicy | undefined; + /** + * Specifies the number of retries before marking this job failed. + * Defaults to 6, unless backoffLimitPerIndex (only Indexed Job) is specified. + * When backoffLimitPerIndex is specified, backoffLimit defaults to 2147483647. + * +optional + */ + backoffLimit?: number | undefined; + /** + * Specifies the limit for the number of retries within an + * index before marking this index as failed. When enabled the number of + * failures per index is kept in the pod's + * batch.kubernetes.io/job-index-failure-count annotation. It can only + * be set when Job's completionMode=Indexed, and the Pod's restart + * policy is Never. The field is immutable. + * +optional + */ + backoffLimitPerIndex?: number | undefined; + /** + * Specifies the maximal number of failed indexes before marking the Job as + * failed, when backoffLimitPerIndex is set. Once the number of failed + * indexes exceeds this number the entire Job is marked as Failed and its + * execution is terminated. When left as null the job continues execution of + * all of its indexes and is marked with the `Complete` Job condition. + * It can only be specified when backoffLimitPerIndex is set. + * It can be null or up to completions. It is required and must be + * less than or equal to 10^4 when is completions greater than 10^5. + * +optional + * +k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:dependentRequired("backoffLimitPerIndex") + */ + maxFailedIndexes?: number | undefined; + /** + * A label query over pods that should match the pod count. + * Normally, the system sets this field for you. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + * +optional + */ + selector?: LabelSelector | undefined; + /** + * manualSelector controls generation of pod labels and pod selectors. + * Leave `manualSelector` unset unless you are certain what you are doing. + * When false or unset, the system pick labels unique to this job + * and appends those labels to the pod template. When true, + * the user is responsible for picking unique labels and specifying + * the selector. Failure to pick a unique label may cause this + * and other jobs to not function correctly. However, You may see + * `manualSelector=true` in jobs that were created with the old `extensions/v1beta1` + * API. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#specifying-your-own-pod-selector + * +optional + */ + manualSelector?: boolean | undefined; + /** + * Describes the pod that will be created when executing a job. + * The only allowed template.spec.restartPolicy values are "Never" or "OnFailure". + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + * +required + */ + template?: PodTemplateSpec | undefined; + /** + * ttlSecondsAfterFinished limits the lifetime of a Job that has finished + * execution (either Complete or Failed). If this field is set, + * ttlSecondsAfterFinished after the Job finishes, it is eligible to be + * automatically deleted. When the Job is being deleted, its lifecycle + * guarantees (e.g. finalizers) will be honored. If this field is unset, + * the Job won't be automatically deleted. If this field is set to zero, + * the Job becomes eligible to be deleted immediately after it finishes. + * +optional + */ + ttlSecondsAfterFinished?: number | undefined; + /** + * completionMode specifies how Pod completions are tracked. It can be + * `NonIndexed` (default) or `Indexed`. + * + * `NonIndexed` means that the Job is considered complete when there have + * been .spec.completions successfully completed Pods. Each Pod completion is + * homologous to each other. + * + * `Indexed` means that the Pods of a + * Job get an associated completion index from 0 to (.spec.completions - 1), + * available in the annotation batch.kubernetes.io/job-completion-index. + * The Job is considered complete when there is one successfully completed Pod + * for each index. + * When value is `Indexed`, .spec.completions must be specified and + * `.spec.parallelism` must be less than or equal to 10^5. + * In addition, The Pod name takes the form + * `$(job-name)-$(index)-$(random-string)`, + * the Pod hostname takes the form `$(job-name)-$(index)`. + * + * More completion modes can be added in the future. + * If the Job controller observes a mode that it doesn't recognize, which + * is possible during upgrades due to version skew, the controller + * skips updates for the Job. + * +optional + */ + completionMode?: string | undefined; + /** + * suspend specifies whether the Job controller should create Pods or not. If + * a Job is created with suspend set to true, no Pods are created by the Job + * controller. If a Job is suspended after creation (i.e. the flag goes from + * false to true), the Job controller will delete all active Pods associated + * with this Job. Users must design their workload to gracefully handle this. + * Suspending a Job will reset the StartTime field of the Job, effectively + * resetting the ActiveDeadlineSeconds timer too. Defaults to false. + * + * +optional + */ + suspend?: boolean | undefined; + /** + * podReplacementPolicy specifies when to create replacement Pods. + * Possible values are: + * - TerminatingOrFailed means that we recreate pods + * when they are terminating (has a metadata.deletionTimestamp) or failed. + * - Failed means to wait until a previously created Pod is fully terminated (has phase + * Failed or Succeeded) before creating a replacement Pod. + * + * When using podFailurePolicy, Failed is the the only allowed value. + * TerminatingOrFailed and Failed are allowed values when podFailurePolicy is not in use. + * +optional + */ + podReplacementPolicy?: string | undefined; + /** + * ManagedBy field indicates the controller that manages a Job. The k8s Job + * controller reconciles jobs which don't have this field at all or the field + * value is the reserved string `kubernetes.io/job-controller`, but skips + * reconciling Jobs with a custom value for this field. + * The value must be a valid domain-prefixed path (e.g. acme.io/foo) - + * all characters before the first "/" must be a valid subdomain as defined + * by RFC 1123. All characters trailing the first "/" must be valid HTTP Path + * characters as defined by RFC 3986. The value cannot exceed 63 characters. + * This field is immutable. + * +optional + */ + managedBy?: string | undefined; + /** + * scheduling defines the Workload-aware Scheduling configuration for this Job. + * When set, it specifies the scheduling policy (basic or gang), topology + * constraints, disruption mode, and shared resource claims. + * When omitted, the Job defaults to the basic scheduling policy, which behaves + * as standard pod-by-pod scheduling. + * This field is alpha-level and requires the WorkloadWithJob feature gate. + * This field is immutable, including whether it is set at all, only + * policy.gang.minCount may be changed after creation. + * + * +featureGate=WorkloadWithJob + * +optional + * +k8s:ifDisabled(WorkloadWithJob)=+k8s:forbidden + * +k8s:optional + * +k8s:update=NoSet + * +k8s:update=NoUnset + */ + scheduling?: JobSchedulingConfiguration | undefined; +} + +/** JobStatus represents the current state of a Job. */ +export interface JobStatus { + /** + * The latest available observations of an object's current state. When a Job + * fails, one of the conditions will have type "Failed" and status true. When + * a Job is suspended, one of the conditions will have type "Suspended" and + * status true; when the Job is resumed, the status of this condition will + * become false. When a Job is completed, one of the conditions will have + * type "Complete" and status true. + * + * A job is considered finished when it is in a terminal condition, either + * "Complete" or "Failed". A Job cannot have both the "Complete" and "Failed" conditions. + * Additionally, it cannot be in the "Complete" and "FailureTarget" conditions. + * The "Complete", "Failed" and "FailureTarget" conditions cannot be disabled. + * + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=atomic + */ + conditions: JobCondition[]; + /** + * Represents time when the job controller started processing a job. When a + * Job is created in the suspended state, this field is not set until the + * first time it is resumed. This field is reset every time a Job is resumed + * from suspension. It is represented in RFC3339 form and is in UTC. + * + * Once set, the field can only be removed when the job is suspended. + * The field cannot be modified while the job is unsuspended or finished. + * + * +optional + */ + startTime?: Time | undefined; + /** + * Represents time when the job was completed. It is not guaranteed to + * be set in happens-before order across separate operations. + * It is represented in RFC3339 form and is in UTC. + * The completion time is set when the job finishes successfully, and only then. + * The value cannot be updated or removed. The value indicates the same or + * later point in time as the startTime field. + * +optional + */ + completionTime?: Time | undefined; + /** + * The number of pending and running pods which are not terminating (without + * a deletionTimestamp). + * The value is zero for finished jobs. + * +optional + */ + active?: number | undefined; + /** + * The number of pods which reached phase Succeeded. + * The value increases monotonically for a given spec. However, it may + * decrease in reaction to scale down of elastic indexed jobs. + * +optional + */ + succeeded?: number | undefined; + /** + * The number of pods which reached phase Failed. + * The value increases monotonically. + * +optional + */ + failed?: number | undefined; + /** + * The number of pods which are terminating (in phase Pending or Running + * and have a deletionTimestamp). + * +optional + */ + terminating?: number | undefined; + /** + * completedIndexes holds the completed indexes when .spec.completionMode = + * "Indexed" in a text format. The indexes are represented as decimal integers + * separated by commas. The numbers are listed in increasing order. Three or + * more consecutive numbers are compressed and represented by the first and + * last element of the series, separated by a hyphen. + * For example, if the completed indexes are 1, 3, 4, 5 and 7, they are + * represented as "1,3-5,7". + * +optional + */ + completedIndexes?: string | undefined; + /** + * FailedIndexes holds the failed indexes when spec.backoffLimitPerIndex is set. + * The indexes are represented in the text format analogous as for the + * `completedIndexes` field, ie. they are kept as decimal integers + * separated by commas. The numbers are listed in increasing order. Three or + * more consecutive numbers are compressed and represented by the first and + * last element of the series, separated by a hyphen. + * For example, if the failed indexes are 1, 3, 4, 5 and 7, they are + * represented as "1,3-5,7". + * The set of failed indexes cannot overlap with the set of completed indexes. + * + * +optional + */ + failedIndexes?: string | undefined; + /** + * uncountedTerminatedPods holds the UIDs of Pods that have terminated but + * the job controller hasn't yet accounted for in the status counters. + * + * The job controller creates pods with a finalizer. When a pod terminates + * (succeeded or failed), the controller does three steps to account for it + * in the job status: + * + * 1. Add the pod UID to the arrays in this field. + * 2. Remove the pod finalizer. + * 3. Remove the pod UID from the arrays while increasing the corresponding + * counter. + * + * Old jobs might not be tracked using this field, in which case the field + * remains null. + * The structure is empty for finished jobs. + * +optional + */ + uncountedTerminatedPods?: UncountedTerminatedPods | undefined; + /** + * The number of active pods which have a Ready condition and are not + * terminating (without a deletionTimestamp). + */ + ready?: number | undefined; +} + +/** JobTemplateSpec describes the data a Job should have when created from a template */ +export interface JobTemplateSpec { + /** + * Standard object's metadata of the jobs created from this template. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * Specification of the desired behavior of the job. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +required + */ + spec?: JobSpec | undefined; +} + +/** PodFailurePolicy describes how failed pods influence the backoffLimit. */ +export interface PodFailurePolicy { + /** + * A list of pod failure policy rules. The rules are evaluated in order. + * Once a rule matches a Pod failure, the remaining of the rules are ignored. + * When no rule matches the Pod failure, the default handling applies - the + * counter of pod failures is incremented and it is checked against + * the backoffLimit. At most 20 elements are allowed. + * +listType=atomic + * +optional + */ + rules: PodFailurePolicyRule[]; +} + +/** + * PodFailurePolicyOnExitCodesRequirement describes the requirement for handling + * a failed pod based on its container exit codes. In particular, it lookups the + * .state.terminated.exitCode for each app container and init container status, + * represented by the .status.containerStatuses and .status.initContainerStatuses + * fields in the Pod status, respectively. Containers completed with success + * (exit code 0) are excluded from the requirement check. + */ +export interface PodFailurePolicyOnExitCodesRequirement { + /** + * Restricts the check for exit codes to the container with the + * specified name. When null, the rule applies to all containers. + * When specified, it should match one the container or initContainer + * names in the pod template. + * +optional + */ + containerName?: string | undefined; + /** + * Represents the relationship between the container exit code(s) and the + * specified values. Containers completed with success (exit code 0) are + * excluded from the requirement check. Possible values are: + * + * - In: the requirement is satisfied if at least one container exit code + * (might be multiple if there are multiple containers not restricted + * by the 'containerName' field) is in the set of specified values. + * - NotIn: the requirement is satisfied if at least one container exit code + * (might be multiple if there are multiple containers not restricted + * by the 'containerName' field) is not in the set of specified values. + * Additional values are considered to be added in the future. Clients should + * react to an unknown operator by assuming the requirement is not satisfied. + * +required + */ + operator?: string | undefined; + /** + * Specifies the set of values. Each returned container exit code (might be + * multiple in case of multiple containers) is checked against this set of + * values with respect to the operator. The list of values must be ordered + * and must not contain duplicates. Value '0' cannot be used for the In operator. + * At least one element is required. At most 255 elements are allowed. + * +listType=set + * +required + */ + values: number[]; +} + +/** + * PodFailurePolicyOnPodConditionsPattern describes a pattern for matching + * an actual pod condition type. + */ +export interface PodFailurePolicyOnPodConditionsPattern { + /** + * Specifies the required Pod condition type. To match a pod condition + * it is required that specified type equals the pod condition type. + * +required + */ + type?: string | undefined; + /** + * Specifies the required Pod condition status. To match a pod condition + * it is required that the specified status equals the pod condition status. + * Defaults to True. + * +optional + */ + status?: string | undefined; +} + +/** + * PodFailurePolicyRule describes how a pod failure is handled when the requirements are met. + * One of onExitCodes and onPodConditions, but not both, can be used in each rule. + */ +export interface PodFailurePolicyRule { + /** + * Specifies the action taken on a pod failure when the requirements are satisfied. + * Possible values are: + * + * - FailJob: indicates that the pod's job is marked as Failed and all + * running pods are terminated. + * - FailIndex: indicates that the pod's index is marked as Failed and will + * not be restarted. + * - Ignore: indicates that the counter towards the .backoffLimit is not + * incremented and a replacement pod is created. + * - Count: indicates that the pod is handled in the default way - the + * counter towards the .backoffLimit is incremented. + * Additional values are considered to be added in the future. Clients should + * react to an unknown action by skipping the rule. + * +required + */ + action?: string | undefined; + /** + * Represents the requirement on the container exit codes. + * +optional + */ + onExitCodes?: PodFailurePolicyOnExitCodesRequirement | undefined; + /** + * Represents the requirement on the pod conditions. The requirement is represented + * as a list of pod condition patterns. The requirement is satisfied if at + * least one pattern matches an actual pod condition. At most 20 elements are allowed. + * +listType=atomic + * +optional + */ + onPodConditions: PodFailurePolicyOnPodConditionsPattern[]; +} + +/** SuccessPolicy describes when a Job can be declared as succeeded based on the success of some indexes. */ +export interface SuccessPolicy { + /** + * rules represents the list of alternative rules for the declaring the Jobs + * as successful before `.status.succeeded >= .spec.completions`. Once any of the rules are met, + * the "SuccessCriteriaMet" condition is added, and the lingering pods are removed. + * The terminal state for such a Job has the "Complete" condition. + * Additionally, these rules are evaluated in order; Once the Job meets one of the rules, + * other rules are ignored. At most 20 elements are allowed. + * +listType=atomic + * +required + */ + rules: SuccessPolicyRule[]; +} + +/** + * 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 { + /** + * succeededIndexes specifies the set of indexes + * which need to be contained in the actual set of the succeeded indexes for the Job. + * The list of indexes must be within 0 to ".spec.completions-1" and + * must not contain duplicates. At least one element is required. + * The indexes are represented as intervals separated by commas. + * The intervals can be a decimal integer or a pair of decimal integers separated by a hyphen. + * The number are listed in represented by the first and last element of the series, + * separated by a hyphen. + * For example, if the completed indexes are 1, 3, 4, 5 and 7, they are + * represented as "1,3-5,7". + * When this field is null, this field doesn't default to any value + * and is never evaluated at any time. + * + * +optional + */ + succeededIndexes?: string | undefined; + /** + * succeededCount specifies the minimal required size of the actual set of the succeeded indexes + * for the Job. When succeededCount is used along with succeededIndexes, the check is + * constrained only to the set of indexes specified by succeededIndexes. + * For example, given that succeededIndexes is "1-4", succeededCount is "3", + * and completed indexes are "1", "3", and "5", the Job isn't declared as succeeded + * because only "1" and "3" indexes are considered in that rules. + * When this field is null, this doesn't default to any value and + * is never evaluated at any time. + * When specified it needs to be a positive integer. + * + * +optional + */ + succeededCount?: number | undefined; +} + +/** + * UncountedTerminatedPods holds UIDs of Pods that have terminated but haven't + * been accounted in Job status counters. + */ +export interface UncountedTerminatedPods { + /** + * succeeded holds UIDs of succeeded Pods. + * +listType=set + * +optional + */ + succeeded: string[]; + /** + * failed holds UIDs of failed Pods. + * +listType=set + * +optional + */ + failed: string[]; +} + +function createBaseCronJob(): CronJob { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const CronJob: MessageFns = { + encode(message: CronJob, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + CronJobSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + CronJobStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CronJob { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCronJob(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = CronJobSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = CronJobStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CronJob { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? CronJobSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? CronJobStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: CronJob): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = CronJobSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = CronJobStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): CronJob { + return CronJob.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CronJob { + const message = createBaseCronJob(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? CronJobSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? CronJobStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseCronJobList(): CronJobList { + return { metadata: undefined, items: [] }; +} + +export const CronJobList: MessageFns = { + encode(message: CronJobList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + CronJob.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CronJobList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCronJobList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(CronJob.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CronJobList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => CronJob.fromJSON(e)) + : [], + }; + }, + + toJSON(message: CronJobList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => CronJob.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CronJobList { + return CronJobList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CronJobList { + const message = createBaseCronJobList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => CronJob.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCronJobSpec(): CronJobSpec { + return { + schedule: '', + timeZone: '', + startingDeadlineSeconds: 0, + concurrencyPolicy: '', + suspend: false, + jobTemplate: undefined, + successfulJobsHistoryLimit: 0, + failedJobsHistoryLimit: 0, + }; +} + +export const CronJobSpec: MessageFns = { + encode(message: CronJobSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.schedule !== undefined && message.schedule !== '') { + writer.uint32(10).string(message.schedule); + } + if (message.timeZone !== undefined && message.timeZone !== '') { + writer.uint32(66).string(message.timeZone); + } + if (message.startingDeadlineSeconds !== undefined && message.startingDeadlineSeconds !== 0) { + writer.uint32(16).int64(message.startingDeadlineSeconds); + } + if (message.concurrencyPolicy !== undefined && message.concurrencyPolicy !== '') { + writer.uint32(26).string(message.concurrencyPolicy); + } + if (message.suspend !== undefined && message.suspend !== false) { + writer.uint32(32).bool(message.suspend); + } + if (message.jobTemplate !== undefined) { + JobTemplateSpec.encode(message.jobTemplate, writer.uint32(42).fork()).join(); + } + if (message.successfulJobsHistoryLimit !== undefined && message.successfulJobsHistoryLimit !== 0) { + writer.uint32(48).int32(message.successfulJobsHistoryLimit); + } + if (message.failedJobsHistoryLimit !== undefined && message.failedJobsHistoryLimit !== 0) { + writer.uint32(56).int32(message.failedJobsHistoryLimit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CronJobSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCronJobSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.schedule = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.timeZone = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.startingDeadlineSeconds = longToNumber(reader.int64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.concurrencyPolicy = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.suspend = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.jobTemplate = JobTemplateSpec.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.successfulJobsHistoryLimit = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.failedJobsHistoryLimit = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CronJobSpec { + return { + schedule: isSet(object.schedule) ? globalThis.String(object.schedule) : '', + timeZone: isSet(object.timeZone) ? globalThis.String(object.timeZone) : '', + startingDeadlineSeconds: isSet(object.startingDeadlineSeconds) + ? globalThis.Number(object.startingDeadlineSeconds) + : 0, + concurrencyPolicy: isSet(object.concurrencyPolicy) + ? globalThis.String(object.concurrencyPolicy) + : '', + suspend: isSet(object.suspend) ? globalThis.Boolean(object.suspend) : false, + jobTemplate: isSet(object.jobTemplate) ? JobTemplateSpec.fromJSON(object.jobTemplate) : undefined, + successfulJobsHistoryLimit: isSet(object.successfulJobsHistoryLimit) + ? globalThis.Number(object.successfulJobsHistoryLimit) + : 0, + failedJobsHistoryLimit: isSet(object.failedJobsHistoryLimit) + ? globalThis.Number(object.failedJobsHistoryLimit) + : 0, + }; + }, + + toJSON(message: CronJobSpec): unknown { + const obj: any = {}; + if (message.schedule !== undefined && message.schedule !== '') { + obj.schedule = message.schedule; + } + if (message.timeZone !== undefined && message.timeZone !== '') { + obj.timeZone = message.timeZone; + } + if (message.startingDeadlineSeconds !== undefined && message.startingDeadlineSeconds !== 0) { + obj.startingDeadlineSeconds = Math.round(message.startingDeadlineSeconds); + } + if (message.concurrencyPolicy !== undefined && message.concurrencyPolicy !== '') { + obj.concurrencyPolicy = message.concurrencyPolicy; + } + if (message.suspend !== undefined && message.suspend !== false) { + obj.suspend = message.suspend; + } + if (message.jobTemplate !== undefined) { + obj.jobTemplate = JobTemplateSpec.toJSON(message.jobTemplate); + } + if (message.successfulJobsHistoryLimit !== undefined && message.successfulJobsHistoryLimit !== 0) { + obj.successfulJobsHistoryLimit = Math.round(message.successfulJobsHistoryLimit); + } + if (message.failedJobsHistoryLimit !== undefined && message.failedJobsHistoryLimit !== 0) { + obj.failedJobsHistoryLimit = Math.round(message.failedJobsHistoryLimit); + } + return obj; + }, + + create, I>>(base?: I): CronJobSpec { + return CronJobSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CronJobSpec { + const message = createBaseCronJobSpec(); + message.schedule = object.schedule ?? ''; + message.timeZone = object.timeZone ?? ''; + message.startingDeadlineSeconds = object.startingDeadlineSeconds ?? 0; + message.concurrencyPolicy = object.concurrencyPolicy ?? ''; + message.suspend = object.suspend ?? false; + message.jobTemplate = + object.jobTemplate !== undefined && object.jobTemplate !== null + ? JobTemplateSpec.fromPartial(object.jobTemplate) + : undefined; + message.successfulJobsHistoryLimit = object.successfulJobsHistoryLimit ?? 0; + message.failedJobsHistoryLimit = object.failedJobsHistoryLimit ?? 0; + return message; + }, +}; + +function createBaseCronJobStatus(): CronJobStatus { + return { active: [], lastScheduleTime: undefined, lastSuccessfulTime: undefined }; +} + +export const CronJobStatus: MessageFns = { + encode(message: CronJobStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.active) { + ObjectReference.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.lastScheduleTime !== undefined) { + Time.encode(message.lastScheduleTime, writer.uint32(34).fork()).join(); + } + if (message.lastSuccessfulTime !== undefined) { + Time.encode(message.lastSuccessfulTime, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CronJobStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCronJobStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.active.push(ObjectReference.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lastScheduleTime = Time.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.lastSuccessfulTime = Time.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CronJobStatus { + return { + active: globalThis.Array.isArray(object?.active) + ? object.active.map((e: any) => ObjectReference.fromJSON(e)) + : [], + lastScheduleTime: isSet(object.lastScheduleTime) + ? Time.fromJSON(object.lastScheduleTime) + : undefined, + lastSuccessfulTime: isSet(object.lastSuccessfulTime) + ? Time.fromJSON(object.lastSuccessfulTime) + : undefined, + }; + }, + + toJSON(message: CronJobStatus): unknown { + const obj: any = {}; + if (message.active?.length) { + obj.active = message.active.map((e) => ObjectReference.toJSON(e)); + } + if (message.lastScheduleTime !== undefined) { + obj.lastScheduleTime = Time.toJSON(message.lastScheduleTime); + } + if (message.lastSuccessfulTime !== undefined) { + obj.lastSuccessfulTime = Time.toJSON(message.lastSuccessfulTime); + } + return obj; + }, + + create, I>>(base?: I): CronJobStatus { + return CronJobStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CronJobStatus { + const message = createBaseCronJobStatus(); + message.active = object.active?.map((e) => ObjectReference.fromPartial(e)) || []; + message.lastScheduleTime = + object.lastScheduleTime !== undefined && object.lastScheduleTime !== null + ? Time.fromPartial(object.lastScheduleTime) + : undefined; + message.lastSuccessfulTime = + object.lastSuccessfulTime !== undefined && object.lastSuccessfulTime !== null + ? Time.fromPartial(object.lastSuccessfulTime) + : undefined; + return message; + }, +}; + +function createBaseJob(): Job { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const Job: MessageFns = { + encode(message: Job, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + JobSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + JobStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Job { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJob(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = JobSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = JobStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Job { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? JobSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? JobStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: Job): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = JobSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = JobStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): Job { + return Job.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Job { + const message = createBaseJob(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null ? JobSpec.fromPartial(object.spec) : undefined; + message.status = + object.status !== undefined && object.status !== null + ? JobStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseJobCondition(): JobCondition { + return { + type: '', + status: '', + lastProbeTime: undefined, + lastTransitionTime: undefined, + reason: '', + message: '', + }; +} + +export const JobCondition: MessageFns = { + encode(message: JobCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastProbeTime !== undefined) { + Time.encode(message.lastProbeTime, writer.uint32(26).fork()).join(); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(34).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(42).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(50).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): JobCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJobCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastProbeTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.reason = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): JobCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastProbeTime: isSet(object.lastProbeTime) ? Time.fromJSON(object.lastProbeTime) : undefined, + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: JobCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastProbeTime !== undefined) { + obj.lastProbeTime = Time.toJSON(message.lastProbeTime); + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): JobCondition { + return JobCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): JobCondition { + const message = createBaseJobCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastProbeTime = + object.lastProbeTime !== undefined && object.lastProbeTime !== null + ? Time.fromPartial(object.lastProbeTime) + : undefined; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseJobList(): JobList { + return { metadata: undefined, items: [] }; +} + +export const JobList: MessageFns = { + encode(message: JobList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Job.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): JobList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJobList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Job.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): JobList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Job.fromJSON(e)) + : [], + }; + }, + + toJSON(message: JobList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Job.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): JobList { + return JobList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): JobList { + const message = createBaseJobList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Job.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseJobSchedulingConfiguration(): JobSchedulingConfiguration { + return { + schedulingPolicy: undefined, + schedulingConstraints: undefined, + disruptionMode: undefined, + resourceClaims: [], + }; +} + +export const JobSchedulingConfiguration: MessageFns = { + encode(message: JobSchedulingConfiguration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.schedulingPolicy !== undefined) { + WorkloadPodGroupSchedulingPolicy.encode( + message.schedulingPolicy, + writer.uint32(10).fork(), + ).join(); + } + if (message.schedulingConstraints !== undefined) { + WorkloadPodGroupSchedulingConstraints.encode( + message.schedulingConstraints, + writer.uint32(18).fork(), + ).join(); + } + if (message.disruptionMode !== undefined) { + WorkloadPodGroupDisruptionMode.encode(message.disruptionMode, writer.uint32(26).fork()).join(); + } + for (const v of message.resourceClaims) { + WorkloadPodGroupResourceClaim.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): JobSchedulingConfiguration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJobSchedulingConfiguration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.schedulingPolicy = WorkloadPodGroupSchedulingPolicy.decode( + reader, + reader.uint32(), + ); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.schedulingConstraints = WorkloadPodGroupSchedulingConstraints.decode( + reader, + reader.uint32(), + ); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.disruptionMode = WorkloadPodGroupDisruptionMode.decode( + reader, + reader.uint32(), + ); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.resourceClaims.push( + WorkloadPodGroupResourceClaim.decode(reader, reader.uint32()), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): JobSchedulingConfiguration { + return { + schedulingPolicy: isSet(object.schedulingPolicy) + ? WorkloadPodGroupSchedulingPolicy.fromJSON(object.schedulingPolicy) + : undefined, + schedulingConstraints: isSet(object.schedulingConstraints) + ? WorkloadPodGroupSchedulingConstraints.fromJSON(object.schedulingConstraints) + : undefined, + disruptionMode: isSet(object.disruptionMode) + ? WorkloadPodGroupDisruptionMode.fromJSON(object.disruptionMode) + : undefined, + resourceClaims: globalThis.Array.isArray(object?.resourceClaims) + ? object.resourceClaims.map((e: any) => WorkloadPodGroupResourceClaim.fromJSON(e)) + : [], + }; + }, + + toJSON(message: JobSchedulingConfiguration): unknown { + const obj: any = {}; + if (message.schedulingPolicy !== undefined) { + obj.schedulingPolicy = WorkloadPodGroupSchedulingPolicy.toJSON(message.schedulingPolicy); + } + if (message.schedulingConstraints !== undefined) { + obj.schedulingConstraints = WorkloadPodGroupSchedulingConstraints.toJSON( + message.schedulingConstraints, + ); + } + if (message.disruptionMode !== undefined) { + obj.disruptionMode = WorkloadPodGroupDisruptionMode.toJSON(message.disruptionMode); + } + if (message.resourceClaims?.length) { + obj.resourceClaims = message.resourceClaims.map((e) => WorkloadPodGroupResourceClaim.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): JobSchedulingConfiguration { + return JobSchedulingConfiguration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): JobSchedulingConfiguration { + const message = createBaseJobSchedulingConfiguration(); + message.schedulingPolicy = + object.schedulingPolicy !== undefined && object.schedulingPolicy !== null + ? WorkloadPodGroupSchedulingPolicy.fromPartial(object.schedulingPolicy) + : undefined; + message.schedulingConstraints = + object.schedulingConstraints !== undefined && object.schedulingConstraints !== null + ? WorkloadPodGroupSchedulingConstraints.fromPartial(object.schedulingConstraints) + : undefined; + message.disruptionMode = + object.disruptionMode !== undefined && object.disruptionMode !== null + ? WorkloadPodGroupDisruptionMode.fromPartial(object.disruptionMode) + : undefined; + message.resourceClaims = + object.resourceClaims?.map((e) => WorkloadPodGroupResourceClaim.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseJobSpec(): JobSpec { + return { + parallelism: 0, + completions: 0, + activeDeadlineSeconds: 0, + podFailurePolicy: undefined, + successPolicy: undefined, + backoffLimit: 0, + backoffLimitPerIndex: 0, + maxFailedIndexes: 0, + selector: undefined, + manualSelector: false, + template: undefined, + ttlSecondsAfterFinished: 0, + completionMode: '', + suspend: false, + podReplacementPolicy: '', + managedBy: '', + scheduling: undefined, + }; +} + +export const JobSpec: MessageFns = { + encode(message: JobSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.parallelism !== undefined && message.parallelism !== 0) { + writer.uint32(8).int32(message.parallelism); + } + if (message.completions !== undefined && message.completions !== 0) { + writer.uint32(16).int32(message.completions); + } + if (message.activeDeadlineSeconds !== undefined && message.activeDeadlineSeconds !== 0) { + writer.uint32(24).int64(message.activeDeadlineSeconds); + } + if (message.podFailurePolicy !== undefined) { + PodFailurePolicy.encode(message.podFailurePolicy, writer.uint32(90).fork()).join(); + } + if (message.successPolicy !== undefined) { + SuccessPolicy.encode(message.successPolicy, writer.uint32(130).fork()).join(); + } + if (message.backoffLimit !== undefined && message.backoffLimit !== 0) { + writer.uint32(56).int32(message.backoffLimit); + } + if (message.backoffLimitPerIndex !== undefined && message.backoffLimitPerIndex !== 0) { + writer.uint32(96).int32(message.backoffLimitPerIndex); + } + if (message.maxFailedIndexes !== undefined && message.maxFailedIndexes !== 0) { + writer.uint32(104).int32(message.maxFailedIndexes); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(34).fork()).join(); + } + if (message.manualSelector !== undefined && message.manualSelector !== false) { + writer.uint32(40).bool(message.manualSelector); + } + if (message.template !== undefined) { + PodTemplateSpec.encode(message.template, writer.uint32(50).fork()).join(); + } + if (message.ttlSecondsAfterFinished !== undefined && message.ttlSecondsAfterFinished !== 0) { + writer.uint32(64).int32(message.ttlSecondsAfterFinished); + } + if (message.completionMode !== undefined && message.completionMode !== '') { + writer.uint32(74).string(message.completionMode); + } + if (message.suspend !== undefined && message.suspend !== false) { + writer.uint32(80).bool(message.suspend); + } + if (message.podReplacementPolicy !== undefined && message.podReplacementPolicy !== '') { + writer.uint32(114).string(message.podReplacementPolicy); + } + if (message.managedBy !== undefined && message.managedBy !== '') { + writer.uint32(122).string(message.managedBy); + } + if (message.scheduling !== undefined) { + JobSchedulingConfiguration.encode(message.scheduling, writer.uint32(138).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): JobSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJobSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.parallelism = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.completions = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.activeDeadlineSeconds = longToNumber(reader.int64()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.podFailurePolicy = PodFailurePolicy.decode(reader, reader.uint32()); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + + message.successPolicy = SuccessPolicy.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.backoffLimit = reader.int32(); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + + message.backoffLimitPerIndex = reader.int32(); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + + message.maxFailedIndexes = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.manualSelector = reader.bool(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.template = PodTemplateSpec.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ttlSecondsAfterFinished = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.completionMode = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + + message.suspend = reader.bool(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.podReplacementPolicy = reader.string(); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.managedBy = reader.string(); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + + message.scheduling = JobSchedulingConfiguration.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): JobSpec { + return { + parallelism: isSet(object.parallelism) ? globalThis.Number(object.parallelism) : 0, + completions: isSet(object.completions) ? globalThis.Number(object.completions) : 0, + activeDeadlineSeconds: isSet(object.activeDeadlineSeconds) + ? globalThis.Number(object.activeDeadlineSeconds) + : 0, + podFailurePolicy: isSet(object.podFailurePolicy) + ? PodFailurePolicy.fromJSON(object.podFailurePolicy) + : undefined, + successPolicy: isSet(object.successPolicy) + ? SuccessPolicy.fromJSON(object.successPolicy) + : undefined, + backoffLimit: isSet(object.backoffLimit) ? globalThis.Number(object.backoffLimit) : 0, + backoffLimitPerIndex: isSet(object.backoffLimitPerIndex) + ? globalThis.Number(object.backoffLimitPerIndex) + : 0, + maxFailedIndexes: isSet(object.maxFailedIndexes) ? globalThis.Number(object.maxFailedIndexes) : 0, + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + manualSelector: isSet(object.manualSelector) ? globalThis.Boolean(object.manualSelector) : false, + template: isSet(object.template) ? PodTemplateSpec.fromJSON(object.template) : undefined, + ttlSecondsAfterFinished: isSet(object.ttlSecondsAfterFinished) + ? globalThis.Number(object.ttlSecondsAfterFinished) + : 0, + completionMode: isSet(object.completionMode) ? globalThis.String(object.completionMode) : '', + suspend: isSet(object.suspend) ? globalThis.Boolean(object.suspend) : false, + podReplacementPolicy: isSet(object.podReplacementPolicy) + ? globalThis.String(object.podReplacementPolicy) + : '', + managedBy: isSet(object.managedBy) ? globalThis.String(object.managedBy) : '', + scheduling: isSet(object.scheduling) + ? JobSchedulingConfiguration.fromJSON(object.scheduling) + : undefined, + }; + }, + + toJSON(message: JobSpec): unknown { + const obj: any = {}; + if (message.parallelism !== undefined && message.parallelism !== 0) { + obj.parallelism = Math.round(message.parallelism); + } + if (message.completions !== undefined && message.completions !== 0) { + obj.completions = Math.round(message.completions); + } + if (message.activeDeadlineSeconds !== undefined && message.activeDeadlineSeconds !== 0) { + obj.activeDeadlineSeconds = Math.round(message.activeDeadlineSeconds); + } + if (message.podFailurePolicy !== undefined) { + obj.podFailurePolicy = PodFailurePolicy.toJSON(message.podFailurePolicy); + } + if (message.successPolicy !== undefined) { + obj.successPolicy = SuccessPolicy.toJSON(message.successPolicy); + } + if (message.backoffLimit !== undefined && message.backoffLimit !== 0) { + obj.backoffLimit = Math.round(message.backoffLimit); + } + if (message.backoffLimitPerIndex !== undefined && message.backoffLimitPerIndex !== 0) { + obj.backoffLimitPerIndex = Math.round(message.backoffLimitPerIndex); + } + if (message.maxFailedIndexes !== undefined && message.maxFailedIndexes !== 0) { + obj.maxFailedIndexes = Math.round(message.maxFailedIndexes); + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.manualSelector !== undefined && message.manualSelector !== false) { + obj.manualSelector = message.manualSelector; + } + if (message.template !== undefined) { + obj.template = PodTemplateSpec.toJSON(message.template); + } + if (message.ttlSecondsAfterFinished !== undefined && message.ttlSecondsAfterFinished !== 0) { + obj.ttlSecondsAfterFinished = Math.round(message.ttlSecondsAfterFinished); + } + if (message.completionMode !== undefined && message.completionMode !== '') { + obj.completionMode = message.completionMode; + } + if (message.suspend !== undefined && message.suspend !== false) { + obj.suspend = message.suspend; + } + if (message.podReplacementPolicy !== undefined && message.podReplacementPolicy !== '') { + obj.podReplacementPolicy = message.podReplacementPolicy; + } + if (message.managedBy !== undefined && message.managedBy !== '') { + obj.managedBy = message.managedBy; + } + if (message.scheduling !== undefined) { + obj.scheduling = JobSchedulingConfiguration.toJSON(message.scheduling); + } + return obj; + }, + + create, I>>(base?: I): JobSpec { + return JobSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): JobSpec { + const message = createBaseJobSpec(); + message.parallelism = object.parallelism ?? 0; + message.completions = object.completions ?? 0; + message.activeDeadlineSeconds = object.activeDeadlineSeconds ?? 0; + message.podFailurePolicy = + object.podFailurePolicy !== undefined && object.podFailurePolicy !== null + ? PodFailurePolicy.fromPartial(object.podFailurePolicy) + : undefined; + message.successPolicy = + object.successPolicy !== undefined && object.successPolicy !== null + ? SuccessPolicy.fromPartial(object.successPolicy) + : undefined; + message.backoffLimit = object.backoffLimit ?? 0; + message.backoffLimitPerIndex = object.backoffLimitPerIndex ?? 0; + message.maxFailedIndexes = object.maxFailedIndexes ?? 0; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.manualSelector = object.manualSelector ?? false; + message.template = + object.template !== undefined && object.template !== null + ? PodTemplateSpec.fromPartial(object.template) + : undefined; + message.ttlSecondsAfterFinished = object.ttlSecondsAfterFinished ?? 0; + message.completionMode = object.completionMode ?? ''; + message.suspend = object.suspend ?? false; + message.podReplacementPolicy = object.podReplacementPolicy ?? ''; + message.managedBy = object.managedBy ?? ''; + message.scheduling = + object.scheduling !== undefined && object.scheduling !== null + ? JobSchedulingConfiguration.fromPartial(object.scheduling) + : undefined; + return message; + }, +}; + +function createBaseJobStatus(): JobStatus { + return { + conditions: [], + startTime: undefined, + completionTime: undefined, + active: 0, + succeeded: 0, + failed: 0, + terminating: 0, + completedIndexes: '', + failedIndexes: '', + uncountedTerminatedPods: undefined, + ready: 0, + }; +} + +export const JobStatus: MessageFns = { + encode(message: JobStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.conditions) { + JobCondition.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.startTime !== undefined) { + Time.encode(message.startTime, writer.uint32(18).fork()).join(); + } + if (message.completionTime !== undefined) { + Time.encode(message.completionTime, writer.uint32(26).fork()).join(); + } + if (message.active !== undefined && message.active !== 0) { + writer.uint32(32).int32(message.active); + } + if (message.succeeded !== undefined && message.succeeded !== 0) { + writer.uint32(40).int32(message.succeeded); + } + if (message.failed !== undefined && message.failed !== 0) { + writer.uint32(48).int32(message.failed); + } + if (message.terminating !== undefined && message.terminating !== 0) { + writer.uint32(88).int32(message.terminating); + } + if (message.completedIndexes !== undefined && message.completedIndexes !== '') { + writer.uint32(58).string(message.completedIndexes); + } + if (message.failedIndexes !== undefined && message.failedIndexes !== '') { + writer.uint32(82).string(message.failedIndexes); + } + if (message.uncountedTerminatedPods !== undefined) { + UncountedTerminatedPods.encode(message.uncountedTerminatedPods, writer.uint32(66).fork()).join(); + } + if (message.ready !== undefined && message.ready !== 0) { + writer.uint32(72).int32(message.ready); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): JobStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJobStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.conditions.push(JobCondition.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.startTime = Time.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.completionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.active = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.succeeded = reader.int32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.failed = reader.int32(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + + message.terminating = reader.int32(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.completedIndexes = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.failedIndexes = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.uncountedTerminatedPods = UncountedTerminatedPods.decode( + reader, + reader.uint32(), + ); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.ready = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): JobStatus { + return { + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => JobCondition.fromJSON(e)) + : [], + startTime: isSet(object.startTime) ? Time.fromJSON(object.startTime) : undefined, + completionTime: isSet(object.completionTime) ? Time.fromJSON(object.completionTime) : undefined, + active: isSet(object.active) ? globalThis.Number(object.active) : 0, + succeeded: isSet(object.succeeded) ? globalThis.Number(object.succeeded) : 0, + failed: isSet(object.failed) ? globalThis.Number(object.failed) : 0, + terminating: isSet(object.terminating) ? globalThis.Number(object.terminating) : 0, + completedIndexes: isSet(object.completedIndexes) + ? globalThis.String(object.completedIndexes) + : '', + failedIndexes: isSet(object.failedIndexes) ? globalThis.String(object.failedIndexes) : '', + uncountedTerminatedPods: isSet(object.uncountedTerminatedPods) + ? UncountedTerminatedPods.fromJSON(object.uncountedTerminatedPods) + : undefined, + ready: isSet(object.ready) ? globalThis.Number(object.ready) : 0, + }; + }, + + toJSON(message: JobStatus): unknown { + const obj: any = {}; + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => JobCondition.toJSON(e)); + } + if (message.startTime !== undefined) { + obj.startTime = Time.toJSON(message.startTime); + } + if (message.completionTime !== undefined) { + obj.completionTime = Time.toJSON(message.completionTime); + } + if (message.active !== undefined && message.active !== 0) { + obj.active = Math.round(message.active); + } + if (message.succeeded !== undefined && message.succeeded !== 0) { + obj.succeeded = Math.round(message.succeeded); + } + if (message.failed !== undefined && message.failed !== 0) { + obj.failed = Math.round(message.failed); + } + if (message.terminating !== undefined && message.terminating !== 0) { + obj.terminating = Math.round(message.terminating); + } + if (message.completedIndexes !== undefined && message.completedIndexes !== '') { + obj.completedIndexes = message.completedIndexes; + } + if (message.failedIndexes !== undefined && message.failedIndexes !== '') { + obj.failedIndexes = message.failedIndexes; + } + if (message.uncountedTerminatedPods !== undefined) { + obj.uncountedTerminatedPods = UncountedTerminatedPods.toJSON(message.uncountedTerminatedPods); + } + if (message.ready !== undefined && message.ready !== 0) { + obj.ready = Math.round(message.ready); + } + return obj; + }, + + create, I>>(base?: I): JobStatus { + return JobStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): JobStatus { + const message = createBaseJobStatus(); + message.conditions = object.conditions?.map((e) => JobCondition.fromPartial(e)) || []; + message.startTime = + object.startTime !== undefined && object.startTime !== null + ? Time.fromPartial(object.startTime) + : undefined; + message.completionTime = + object.completionTime !== undefined && object.completionTime !== null + ? Time.fromPartial(object.completionTime) + : undefined; + message.active = object.active ?? 0; + message.succeeded = object.succeeded ?? 0; + message.failed = object.failed ?? 0; + message.terminating = object.terminating ?? 0; + message.completedIndexes = object.completedIndexes ?? ''; + message.failedIndexes = object.failedIndexes ?? ''; + message.uncountedTerminatedPods = + object.uncountedTerminatedPods !== undefined && object.uncountedTerminatedPods !== null + ? UncountedTerminatedPods.fromPartial(object.uncountedTerminatedPods) + : undefined; + message.ready = object.ready ?? 0; + return message; + }, +}; + +function createBaseJobTemplateSpec(): JobTemplateSpec { + return { metadata: undefined, spec: undefined }; +} + +export const JobTemplateSpec: MessageFns = { + encode(message: JobTemplateSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + JobSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): JobTemplateSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJobTemplateSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = JobSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): JobTemplateSpec { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? JobSpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: JobTemplateSpec): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = JobSpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>(base?: I): JobTemplateSpec { + return JobTemplateSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): JobTemplateSpec { + const message = createBaseJobTemplateSpec(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null ? JobSpec.fromPartial(object.spec) : undefined; + return message; + }, +}; + +function createBasePodFailurePolicy(): PodFailurePolicy { + return { rules: [] }; +} + +export const PodFailurePolicy: MessageFns = { + encode(message: PodFailurePolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rules) { + PodFailurePolicyRule.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodFailurePolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodFailurePolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.rules.push(PodFailurePolicyRule.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodFailurePolicy { + return { + rules: globalThis.Array.isArray(object?.rules) + ? object.rules.map((e: any) => PodFailurePolicyRule.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PodFailurePolicy): unknown { + const obj: any = {}; + if (message.rules?.length) { + obj.rules = message.rules.map((e) => PodFailurePolicyRule.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PodFailurePolicy { + return PodFailurePolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodFailurePolicy { + const message = createBasePodFailurePolicy(); + message.rules = object.rules?.map((e) => PodFailurePolicyRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePodFailurePolicyOnExitCodesRequirement(): PodFailurePolicyOnExitCodesRequirement { + return { containerName: '', operator: '', values: [] }; +} + +export const PodFailurePolicyOnExitCodesRequirement: MessageFns = { + encode( + message: PodFailurePolicyOnExitCodesRequirement, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.containerName !== undefined && message.containerName !== '') { + writer.uint32(10).string(message.containerName); + } + if (message.operator !== undefined && message.operator !== '') { + writer.uint32(18).string(message.operator); + } + for (const v of message.values) { + writer.uint32(24).int32(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodFailurePolicyOnExitCodesRequirement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodFailurePolicyOnExitCodesRequirement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.containerName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.operator = reader.string(); + continue; + } + case 3: { + if (tag === 24) { + message.values.push(reader.int32()); + + continue; + } + + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.values.push(reader.int32()); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodFailurePolicyOnExitCodesRequirement { + return { + containerName: isSet(object.containerName) ? globalThis.String(object.containerName) : '', + operator: isSet(object.operator) ? globalThis.String(object.operator) : '', + values: globalThis.Array.isArray(object?.values) + ? object.values.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: PodFailurePolicyOnExitCodesRequirement): unknown { + const obj: any = {}; + if (message.containerName !== undefined && message.containerName !== '') { + obj.containerName = message.containerName; + } + if (message.operator !== undefined && message.operator !== '') { + obj.operator = message.operator; + } + if (message.values?.length) { + obj.values = message.values.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PodFailurePolicyOnExitCodesRequirement { + return PodFailurePolicyOnExitCodesRequirement.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodFailurePolicyOnExitCodesRequirement { + const message = createBasePodFailurePolicyOnExitCodesRequirement(); + message.containerName = object.containerName ?? ''; + message.operator = object.operator ?? ''; + message.values = object.values?.map((e) => e) || []; + return message; + }, +}; + +function createBasePodFailurePolicyOnPodConditionsPattern(): PodFailurePolicyOnPodConditionsPattern { + return { type: '', status: '' }; +} + +export const PodFailurePolicyOnPodConditionsPattern: MessageFns = { + encode( + message: PodFailurePolicyOnPodConditionsPattern, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodFailurePolicyOnPodConditionsPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodFailurePolicyOnPodConditionsPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodFailurePolicyOnPodConditionsPattern { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + }; + }, + + toJSON(message: PodFailurePolicyOnPodConditionsPattern): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + return obj; + }, + + create, I>>( + base?: I, + ): PodFailurePolicyOnPodConditionsPattern { + return PodFailurePolicyOnPodConditionsPattern.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodFailurePolicyOnPodConditionsPattern { + const message = createBasePodFailurePolicyOnPodConditionsPattern(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + return message; + }, +}; + +function createBasePodFailurePolicyRule(): PodFailurePolicyRule { + return { action: '', onExitCodes: undefined, onPodConditions: [] }; +} + +export const PodFailurePolicyRule: MessageFns = { + encode(message: PodFailurePolicyRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.action !== undefined && message.action !== '') { + writer.uint32(10).string(message.action); + } + if (message.onExitCodes !== undefined) { + PodFailurePolicyOnExitCodesRequirement.encode( + message.onExitCodes, + writer.uint32(18).fork(), + ).join(); + } + for (const v of message.onPodConditions) { + PodFailurePolicyOnPodConditionsPattern.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodFailurePolicyRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodFailurePolicyRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.action = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.onExitCodes = PodFailurePolicyOnExitCodesRequirement.decode( + reader, + reader.uint32(), + ); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.onPodConditions.push( + PodFailurePolicyOnPodConditionsPattern.decode(reader, reader.uint32()), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodFailurePolicyRule { + return { + action: isSet(object.action) ? globalThis.String(object.action) : '', + onExitCodes: isSet(object.onExitCodes) + ? PodFailurePolicyOnExitCodesRequirement.fromJSON(object.onExitCodes) + : undefined, + onPodConditions: globalThis.Array.isArray(object?.onPodConditions) + ? object.onPodConditions.map((e: any) => PodFailurePolicyOnPodConditionsPattern.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PodFailurePolicyRule): unknown { + const obj: any = {}; + if (message.action !== undefined && message.action !== '') { + obj.action = message.action; + } + if (message.onExitCodes !== undefined) { + obj.onExitCodes = PodFailurePolicyOnExitCodesRequirement.toJSON(message.onExitCodes); + } + if (message.onPodConditions?.length) { + obj.onPodConditions = message.onPodConditions.map((e) => + PodFailurePolicyOnPodConditionsPattern.toJSON(e), + ); + } + return obj; + }, + + create, I>>(base?: I): PodFailurePolicyRule { + return PodFailurePolicyRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodFailurePolicyRule { + const message = createBasePodFailurePolicyRule(); + message.action = object.action ?? ''; + message.onExitCodes = + object.onExitCodes !== undefined && object.onExitCodes !== null + ? PodFailurePolicyOnExitCodesRequirement.fromPartial(object.onExitCodes) + : undefined; + message.onPodConditions = + object.onPodConditions?.map((e) => PodFailurePolicyOnPodConditionsPattern.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSuccessPolicy(): SuccessPolicy { + return { rules: [] }; +} + +export const SuccessPolicy: MessageFns = { + encode(message: SuccessPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rules) { + SuccessPolicyRule.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SuccessPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSuccessPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.rules.push(SuccessPolicyRule.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SuccessPolicy { + return { + rules: globalThis.Array.isArray(object?.rules) + ? object.rules.map((e: any) => SuccessPolicyRule.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SuccessPolicy): unknown { + const obj: any = {}; + if (message.rules?.length) { + obj.rules = message.rules.map((e) => SuccessPolicyRule.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SuccessPolicy { + return SuccessPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SuccessPolicy { + const message = createBaseSuccessPolicy(); + message.rules = object.rules?.map((e) => SuccessPolicyRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSuccessPolicyRule(): SuccessPolicyRule { + return { succeededIndexes: '', succeededCount: 0 }; +} + +export const SuccessPolicyRule: MessageFns = { + encode(message: SuccessPolicyRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.succeededIndexes !== undefined && message.succeededIndexes !== '') { + writer.uint32(10).string(message.succeededIndexes); + } + if (message.succeededCount !== undefined && message.succeededCount !== 0) { + writer.uint32(16).int32(message.succeededCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SuccessPolicyRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSuccessPolicyRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.succeededIndexes = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.succeededCount = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SuccessPolicyRule { + return { + succeededIndexes: isSet(object.succeededIndexes) + ? globalThis.String(object.succeededIndexes) + : '', + succeededCount: isSet(object.succeededCount) ? globalThis.Number(object.succeededCount) : 0, + }; + }, + + toJSON(message: SuccessPolicyRule): unknown { + const obj: any = {}; + if (message.succeededIndexes !== undefined && message.succeededIndexes !== '') { + obj.succeededIndexes = message.succeededIndexes; + } + if (message.succeededCount !== undefined && message.succeededCount !== 0) { + obj.succeededCount = Math.round(message.succeededCount); + } + return obj; + }, + + create, I>>(base?: I): SuccessPolicyRule { + return SuccessPolicyRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SuccessPolicyRule { + const message = createBaseSuccessPolicyRule(); + message.succeededIndexes = object.succeededIndexes ?? ''; + message.succeededCount = object.succeededCount ?? 0; + return message; + }, +}; + +function createBaseUncountedTerminatedPods(): UncountedTerminatedPods { + return { succeeded: [], failed: [] }; +} + +export const UncountedTerminatedPods: MessageFns = { + encode(message: UncountedTerminatedPods, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.succeeded) { + writer.uint32(10).string(v!); + } + for (const v of message.failed) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UncountedTerminatedPods { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUncountedTerminatedPods(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.succeeded.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.failed.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): UncountedTerminatedPods { + return { + succeeded: globalThis.Array.isArray(object?.succeeded) + ? object.succeeded.map((e: any) => globalThis.String(e)) + : [], + failed: globalThis.Array.isArray(object?.failed) + ? object.failed.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: UncountedTerminatedPods): unknown { + const obj: any = {}; + if (message.succeeded?.length) { + obj.succeeded = message.succeeded; + } + if (message.failed?.length) { + obj.failed = message.failed; + } + return obj; + }, + + create, I>>(base?: I): UncountedTerminatedPods { + return UncountedTerminatedPods.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): UncountedTerminatedPods { + const message = createBaseUncountedTerminatedPods(); + message.succeeded = object.succeeded?.map((e) => e) || []; + message.failed = object.failed?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error('Value is smaller than Number.MIN_SAFE_INTEGER'); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/certificates/v1/generated.ts b/src/proto/generated/k8s.io/api/certificates/v1/generated.ts new file mode 100644 index 00000000000..62182ce1613 --- /dev/null +++ b/src/proto/generated/k8s.io/api/certificates/v1/generated.ts @@ -0,0 +1,2514 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/certificates/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { Condition, ListMeta, ObjectMeta, Time } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** + * CertificateSigningRequest objects provide a mechanism to obtain x509 certificates + * by submitting a certificate signing request, and having it asynchronously approved and issued. + * + * Kubelets use this API to obtain: + * 1. client certificates to authenticate to kube-apiserver (with the "kubernetes.io/kube-apiserver-client-kubelet" signerName). + * 2. serving certificates for TLS endpoints kube-apiserver can connect to securely (with the "kubernetes.io/kubelet-serving" signerName). + * + * This API can be used to request client certificates to authenticate to kube-apiserver + * (with the "kubernetes.io/kube-apiserver-client" signerName), + * or to obtain certificates from custom non-Kubernetes signers. + * +k8s:supportsSubresource="/status" + * +k8s:supportsSubresource="/approval" + */ +export interface CertificateSigningRequest { + /** +optional */ + metadata?: ObjectMeta | undefined; + /** + * spec contains the certificate request, and is immutable after creation. + * Only the request, signerName, expirationSeconds, and usages fields can be set on creation. + * Other fields are derived by Kubernetes and cannot be modified by users. + */ + spec?: CertificateSigningRequestSpec | undefined; + /** + * status contains information about whether the request is approved or denied, + * and the certificate issued by the signer, or the failure condition indicating signer failure. + * +optional + */ + status?: CertificateSigningRequestStatus | undefined; +} + +/** CertificateSigningRequestCondition describes a condition of a CertificateSigningRequest object */ +export interface CertificateSigningRequestCondition { + /** + * type of the condition. Known conditions are "Approved", "Denied", and "Failed". + * + * An "Approved" condition is added via the /approval subresource, + * indicating the request was approved and should be issued by the signer. + * + * A "Denied" condition is added via the /approval subresource, + * indicating the request was denied and should not be issued by the signer. + * + * A "Failed" condition is added via the /status subresource, + * indicating the signer failed to issue the certificate. + * + * Approved and Denied conditions are mutually exclusive. + * Approved, Denied, and Failed conditions cannot be removed once added. + * + * Only one condition of a given type is allowed. + */ + type?: string | undefined; + /** + * status of the condition, one of True, False, Unknown. + * Approved, Denied, and Failed conditions may not be "False" or "Unknown". + */ + status?: string | undefined; + /** + * reason indicates a brief reason for the request state + * +optional + */ + reason?: string | undefined; + /** + * message contains a human readable message with details about the request state + * +optional + */ + message?: string | undefined; + /** + * lastUpdateTime is the time of the last update to this condition + * +optional + */ + lastUpdateTime?: Time | undefined; + /** + * lastTransitionTime is the time the condition last transitioned from one status to another. + * If unset, when a new condition type is added or an existing condition's status is changed, + * the server defaults this to the current time. + * +optional + */ + lastTransitionTime?: Time | undefined; +} + +/** CertificateSigningRequestList is a collection of CertificateSigningRequest objects */ +export interface CertificateSigningRequestList { + /** +optional */ + metadata?: ListMeta | undefined; + /** items is a collection of CertificateSigningRequest objects */ + items: CertificateSigningRequest[]; +} + +/** CertificateSigningRequestSpec contains the certificate request. */ +export interface CertificateSigningRequestSpec { + /** + * request contains an x509 certificate signing request encoded in a "CERTIFICATE REQUEST" PEM block. + * When serialized as JSON or YAML, the data is additionally base64-encoded. + */ + request?: Uint8Array | undefined; + /** + * signerName indicates the requested signer, and is a qualified name. + * + * List/watch requests for CertificateSigningRequests can filter on this field using a "spec.signerName=NAME" fieldSelector. + * + * Well-known Kubernetes signers are: + * 1. "kubernetes.io/kube-apiserver-client": issues client certificates that can be used to authenticate to kube-apiserver. + * Requests for this signer are never auto-approved by kube-controller-manager, can be issued by the "csrsigning" controller in kube-controller-manager. + * 2. "kubernetes.io/kube-apiserver-client-kubelet": issues client certificates that kubelets use to authenticate to kube-apiserver. + * Requests for this signer can be auto-approved by the "csrapproving" controller in kube-controller-manager, and can be issued by the "csrsigning" controller in kube-controller-manager. + * 3. "kubernetes.io/kubelet-serving" issues serving certificates that kubelets use to serve TLS endpoints, which kube-apiserver can connect to securely. + * Requests for this signer are never auto-approved by kube-controller-manager, and can be issued by the "csrsigning" controller in kube-controller-manager. + * + * More details are available at https://k8s.io/docs/reference/access-authn-authz/certificate-signing-requests/#kubernetes-signers + * + * Custom signerNames can also be specified. The signer defines: + * 1. Trust distribution: how trust (CA bundles) are distributed. + * 2. Permitted subjects: and behavior when a disallowed subject is requested. + * 3. Required, permitted, or forbidden x509 extensions in the request (including whether subjectAltNames are allowed, which types, restrictions on allowed values) and behavior when a disallowed extension is requested. + * 4. Required, permitted, or forbidden key usages / extended key usages. + * 5. Expiration/certificate lifetime: whether it is fixed by the signer, configurable by the admin. + * 6. Whether or not requests for CA certificates are allowed. + */ + signerName?: string | undefined; + /** + * expirationSeconds is the requested duration of validity of the issued + * certificate. The certificate signer may issue a certificate with a different + * validity duration so a client must check the delta between the notBefore and + * and notAfter fields in the issued certificate to determine the actual duration. + * + * The v1.22+ in-tree implementations of the well-known Kubernetes signers will + * honor this field as long as the requested duration is not greater than the + * maximum duration they will honor per the --cluster-signing-duration CLI + * flag to the Kubernetes controller manager. + * + * Certificate signers may not honor this field for various reasons: + * + * 1. Old signer that is unaware of the field (such as the in-tree + * implementations prior to v1.22) + * 2. Signer whose configured maximum is shorter than the requested duration + * 3. Signer whose configured minimum is longer than the requested duration + * + * The minimum valid value for expirationSeconds is 600, i.e. 10 minutes. + * + * +optional + */ + expirationSeconds?: number | undefined; + /** + * usages specifies a set of key usages requested in the issued certificate. + * + * Requests for TLS client certificates typically request: "digital signature", "key encipherment", "client auth". + * + * Requests for TLS serving certificates typically request: "key encipherment", "digital signature", "server auth". + * + * Valid values are: + * "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" + * +listType=atomic + */ + usages: string[]; + /** + * username contains the name of the user that created the CertificateSigningRequest. + * Populated by the API server on creation and immutable. + * +optional + */ + username?: string | undefined; + /** + * uid contains the uid of the user that created the CertificateSigningRequest. + * Populated by the API server on creation and immutable. + * +optional + */ + uid?: string | undefined; + /** + * groups contains group membership of the user that created the CertificateSigningRequest. + * Populated by the API server on creation and immutable. + * +listType=atomic + * +optional + */ + groups: string[]; + /** + * extra contains extra attributes of the user that created the CertificateSigningRequest. + * Populated by the API server on creation and immutable. + * +optional + */ + extra: { [key: string]: ExtraValue }; +} + +export interface CertificateSigningRequestSpec_ExtraEntry { + key: string; + value: ExtraValue | undefined; +} + +/** + * CertificateSigningRequestStatus contains conditions used to indicate + * approved/denied/failed status of the request, and the issued certificate. + */ +export interface CertificateSigningRequestStatus { + /** + * conditions applied to the request. Known conditions are "Approved", "Denied", and "Failed". + * +listType=map + * +listMapKey=type + * +optional + * +k8s:beta(since: "1.37")=+k8s:listType=map + * +k8s:beta(since: "1.37")=+k8s:listMapKey=type + * +k8s:beta(since: "1.37")=+k8s:customUnique + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember + * +k8s:beta(since: "1.37")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember + */ + conditions: CertificateSigningRequestCondition[]; + /** + * certificate is populated with an issued certificate by the signer after an Approved condition is present. + * This field is set via the /status subresource. Once populated, this field is immutable. + * + * If the certificate signing request is denied, a condition of type "Denied" is added and this field remains empty. + * If the signer cannot issue the certificate, a condition of type "Failed" is added and this field remains empty. + * + * Validation requirements: + * 1. certificate must contain one or more PEM blocks. + * 2. All PEM blocks must have the "CERTIFICATE" label, contain no headers, and the encoded data + * must be a BER-encoded ASN.1 Certificate structure as described in section 4 of RFC5280. + * 3. Non-PEM content may appear before or after the "CERTIFICATE" PEM blocks and is unvalidated, + * to allow for explanatory text as described in section 5.2 of RFC7468. + * + * If more than one PEM block is present, and the definition of the requested spec.signerName + * does not indicate otherwise, the first block is the issued certificate, + * and subsequent blocks should be treated as intermediate certificates and presented in TLS handshakes. + * + * The certificate is encoded in PEM format. + * + * When serialized as JSON or YAML, the data is additionally base64-encoded, so it consists of: + * + * base64( + * -----BEGIN CERTIFICATE----- + * ... + * -----END CERTIFICATE----- + * ) + * + * +optional + */ + certificate?: Uint8Array | undefined; +} + +/** + * ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors + * (root certificates). + * + * ClusterTrustBundle objects are considered to be readable by any authenticated + * user in the cluster, because they can be mounted by pods using the + * `clusterTrustBundle` projection. All service accounts have read access to + * ClusterTrustBundles by default. Users who only have namespace-level access + * to a cluster can read ClusterTrustBundles by impersonating a serviceaccount + * that they have access to. + * + * It can be optionally associated with a particular signer, in which case it + * contains one valid set of trust anchors for that signer. Signers may have + * multiple associated ClusterTrustBundles; each is an independent set of trust + * anchors for that signer. Admission control is used to enforce that only users + * with permissions on the signer can create or modify the corresponding bundle. + */ +export interface ClusterTrustBundle { + /** + * metadata contains the object metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** spec contains the signer (if any) and trust anchors. */ + spec?: ClusterTrustBundleSpec | undefined; +} + +/** ClusterTrustBundleList is a collection of ClusterTrustBundle objects */ +export interface ClusterTrustBundleList { + /** + * metadata contains the list metadata. + * + * +optional + */ + metadata?: ListMeta | undefined; + /** items is a collection of ClusterTrustBundle objects */ + items: ClusterTrustBundle[]; +} + +/** ClusterTrustBundleSpec contains the signer and trust anchors. */ +export interface ClusterTrustBundleSpec { + /** + * signerName indicates the associated signer, if any. + * + * In order to create or update a ClusterTrustBundle that sets signerName, + * you must have the following cluster-scoped permission: + * group=certificates.k8s.io resource=signers resourceName= + * verb=attest. + * + * If signerName is not empty, then the ClusterTrustBundle object must be + * named with the signer name as a prefix (translating slashes to colons). + * For example, for the signer name `example.com/foo`, valid + * ClusterTrustBundle object names include `example.com:foo:abc` and + * `example.com:foo:v1`. + * + * If signerName is empty, then the ClusterTrustBundle object's name must + * not have such a prefix. + * + * List/watch requests for ClusterTrustBundles can filter on this field + * using a `spec.signerName=NAME` field selector. + * + * +optional + * +k8s:alpha(since:"1.37")=+k8s:optional + * +k8s:alpha(since:"1.37")=+k8s:immutable + */ + signerName?: string | undefined; + /** + * trustBundle contains the individual X.509 trust anchors for this + * bundle, as PEM bundle of PEM-wrapped, DER-formatted X.509 certificates. + * + * The data must consist only of PEM certificate blocks that parse as valid + * X.509 certificates. Each certificate must include a basic constraints + * extension with the CA bit set. The API server will reject objects that + * contain duplicate certificates, or that use PEM block headers. + * + * Users of ClusterTrustBundles, including Kubelet, are free to reorder and + * deduplicate certificate blocks in this file according to their own logic, + * as well as to drop PEM block headers and inter-block data. + */ + trustBundle?: string | undefined; +} + +/** + * ExtraValue masks the value so protobuf can generate + * +protobuf.nullable=true + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface ExtraValue { + items: string[]; +} + +/** + * PodCertificateRequest encodes a pod requesting a certificate from a given + * signer. + * + * Kubelets use this API to implement podCertificate projected volumes + * +k8s:supportsSubresource="/status" + */ +export interface PodCertificateRequest { + /** + * metadata contains the object metadata. + * + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec contains the details about the certificate being requested. + * +required + */ + spec?: PodCertificateRequestSpec | undefined; + /** + * status contains the issued certificate, and a standard set of conditions. + * +optional + */ + status?: PodCertificateRequestStatus | undefined; +} + +/** PodCertificateRequestList is a collection of PodCertificateRequest objects */ +export interface PodCertificateRequestList { + /** + * metadata contains the list metadata. + * + * +optional + */ + metadata?: ListMeta | undefined; + /** items is a collection of PodCertificateRequest objects */ + items: PodCertificateRequest[]; +} + +/** + * PodCertificateRequestSpec describes the certificate request. All fields are + * immutable after creation. + */ +export interface PodCertificateRequestSpec { + /** + * signerName indicates the requested signer. + * + * All signer names beginning with `kubernetes.io` are reserved for use by + * the Kubernetes project. There is currently one well-known signer + * documented by the Kubernetes project, + * `kubernetes.io/kube-apiserver-client-pod`, which will issue client + * certificates understood by kube-apiserver. It is currently + * unimplemented. + * + * +required + */ + signerName?: string | undefined; + /** + * podName is the name of the pod into which the certificate will be mounted. + * + * +required + */ + podName?: string | undefined; + /** + * podUID is the UID of the pod into which the certificate will be mounted. + * + * +required + */ + podUID?: string | undefined; + /** + * serviceAccountName is the name of the service account the pod is running as. + * + * +required + */ + serviceAccountName?: string | undefined; + /** + * serviceAccountUID is the UID of the service account the pod is running as. + * + * +required + */ + serviceAccountUID?: string | undefined; + /** + * nodeName is the name of the node the pod is assigned to. + * + * +required + */ + nodeName?: string | undefined; + /** + * nodeUID is the UID of the node the pod is assigned to. + * + * +required + */ + nodeUID?: string | undefined; + /** + * maxExpirationSeconds is the maximum lifetime permitted for the + * certificate. + * + * If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver + * will reject values shorter than 3600 (1 hour). The maximum allowable + * value is 7862400 (91 days). + * + * The signer implementation is then free to issue a certificate with any + * lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 + * seconds (1 hour). This constraint is enforced by kube-apiserver. + * `kubernetes.io` signers will never issue certificates with a lifetime + * longer than 24 hours. + * + * +optional + * +default=86400 + */ + maxExpirationSeconds?: number | undefined; + /** + * A PKCS#10 certificate signing request (DER-serialized) generated by + * Kubelet using the subject private key. + * + * Most signer implementations will ignore the contents of the CSR except to + * extract the subject public key. The API server automatically verifies the + * CSR signature during admission, so the signer does not need to repeat the + * verification. CSRs generated by kubelet are completely empty. + * + * The subject public key must be one of RSA3072, RSA4096, ECDSAP256, + * ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in + * the future. + * + * Signer implementations do not need to support all key types supported by + * kube-apiserver and kubelet. If a signer does not support the key type + * used for a given PodCertificateRequest, it must deny the request by + * setting a status.conditions entry with a type of "Denied" and a reason of + * "UnsupportedKeyType". It may also suggest a key type that it does support + * in the message field. + * + * +required + */ + stubPKCS10Request?: Uint8Array | undefined; + /** + * unverifiedUserAnnotations allow pod authors to pass additional information to + * the signer implementation. Kubernetes does not restrict or validate this + * metadata in any way. + * + * Entries are subject to the same validation as object metadata annotations, + * with the addition that all keys must be domain-prefixed. No restrictions + * are placed on values, except an overall size limitation on the entire field. + * + * Signers should document the keys and values they support. Signers should + * deny requests that contain keys they do not recognize. + * + * +optional + */ + unverifiedUserAnnotations: { [key: string]: string }; +} + +export interface PodCertificateRequestSpec_UnverifiedUserAnnotationsEntry { + key: string; + value: string; +} + +/** + * PodCertificateRequestStatus describes the status of the request, and holds + * the certificate data if the request is issued. + */ +export interface PodCertificateRequestStatus { + /** + * conditions applied to the request. + * + * The types "Issued", "Denied", and "Failed" have special handling. At + * most one of these conditions may be present, and they must have status + * "True". + * + * If the request is denied with `Reason=UnsupportedKeyType`, the signer may + * suggest a key type that will work in the message field. + * + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + * +optional + * +k8s:alpha(since: "1.37")=+k8s:listType=map + * +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + * +k8s:alpha(since: "1.37")=+k8s:optional + */ + conditions: Condition[]; + /** + * certificateChain is populated with an issued certificate by the signer. + * This field is set via the /status subresource. Once populated, this field + * is immutable. + * + * If the certificate signing request is denied, a condition of type + * "Denied" is added and this field remains empty. If the signer cannot + * issue the certificate, a condition of type "Failed" is added and this + * field remains empty. + * + * Validation requirements: + * 1. certificateChain must consist of one or more PEM-formatted certificates. + * 2. Each entry must be a valid PEM-wrapped, DER-encoded ASN.1 Certificate as + * described in section 4 of RFC5280. + * + * If more than one block is present, and the definition of the requested + * spec.signerName does not indicate otherwise, the first block is the + * issued certificate, and subsequent blocks should be treated as + * intermediate certificates and presented in TLS handshakes. When + * projecting the chain into a pod volume, kubelet will drop any data + * in-between the PEM blocks, as well as any PEM block headers. + * + * +optional + */ + certificateChain?: string | undefined; + /** + * notBefore is the time at which the certificate becomes valid. The value + * must be the same as the notBefore value in the leaf certificate in + * certificateChain. This field is set via the /status subresource. Once + * populated, it is immutable. The signer must set this field at the same + * time it sets certificateChain. + * + * +optional + */ + notBefore?: Time | undefined; + /** + * beginRefreshAt is the time at which the kubelet should begin trying to + * refresh the certificate. This field is set via the /status subresource, + * and must be set at the same time as certificateChain. Once populated, + * this field is immutable. + * + * This field is only a hint. Kubelet may start refreshing before or after + * this time if necessary. + * + * +optional + */ + beginRefreshAt?: Time | undefined; + /** + * notAfter is the time at which the certificate expires. The value must be + * the same as the notAfter value in the leaf certificate in + * certificateChain. This field is set via the /status subresource. Once + * populated, it is immutable. The signer must set this field at the same + * time it sets certificateChain. + * + * +optional + */ + notAfter?: Time | undefined; +} + +function createBaseCertificateSigningRequest(): CertificateSigningRequest { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const CertificateSigningRequest: MessageFns = { + encode(message: CertificateSigningRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + CertificateSigningRequestSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + CertificateSigningRequestStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CertificateSigningRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCertificateSigningRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = CertificateSigningRequestSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = CertificateSigningRequestStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CertificateSigningRequest { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? CertificateSigningRequestSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) + ? CertificateSigningRequestStatus.fromJSON(object.status) + : undefined, + }; + }, + + toJSON(message: CertificateSigningRequest): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = CertificateSigningRequestSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = CertificateSigningRequestStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): CertificateSigningRequest { + return CertificateSigningRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CertificateSigningRequest { + const message = createBaseCertificateSigningRequest(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? CertificateSigningRequestSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? CertificateSigningRequestStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseCertificateSigningRequestCondition(): CertificateSigningRequestCondition { + return { + type: '', + status: '', + reason: '', + message: '', + lastUpdateTime: undefined, + lastTransitionTime: undefined, + }; +} + +export const CertificateSigningRequestCondition: MessageFns = { + encode( + message: CertificateSigningRequestCondition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(50).string(message.status); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(18).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(26).string(message.message); + } + if (message.lastUpdateTime !== undefined) { + Time.encode(message.lastUpdateTime, writer.uint32(34).fork()).join(); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CertificateSigningRequestCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCertificateSigningRequestCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.status = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.reason = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lastUpdateTime = Time.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CertificateSigningRequestCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + lastUpdateTime: isSet(object.lastUpdateTime) ? Time.fromJSON(object.lastUpdateTime) : undefined, + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + }; + }, + + toJSON(message: CertificateSigningRequestCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + if (message.lastUpdateTime !== undefined) { + obj.lastUpdateTime = Time.toJSON(message.lastUpdateTime); + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + return obj; + }, + + create, I>>( + base?: I, + ): CertificateSigningRequestCondition { + return CertificateSigningRequestCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CertificateSigningRequestCondition { + const message = createBaseCertificateSigningRequestCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + message.lastUpdateTime = + object.lastUpdateTime !== undefined && object.lastUpdateTime !== null + ? Time.fromPartial(object.lastUpdateTime) + : undefined; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + return message; + }, +}; + +function createBaseCertificateSigningRequestList(): CertificateSigningRequestList { + return { metadata: undefined, items: [] }; +} + +export const CertificateSigningRequestList: MessageFns = { + encode(message: CertificateSigningRequestList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + CertificateSigningRequest.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CertificateSigningRequestList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCertificateSigningRequestList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(CertificateSigningRequest.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CertificateSigningRequestList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => CertificateSigningRequest.fromJSON(e)) + : [], + }; + }, + + toJSON(message: CertificateSigningRequestList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => CertificateSigningRequest.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): CertificateSigningRequestList { + return CertificateSigningRequestList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CertificateSigningRequestList { + const message = createBaseCertificateSigningRequestList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => CertificateSigningRequest.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCertificateSigningRequestSpec(): CertificateSigningRequestSpec { + return { + request: new Uint8Array(0), + signerName: '', + expirationSeconds: 0, + usages: [], + username: '', + uid: '', + groups: [], + extra: {}, + }; +} + +export const CertificateSigningRequestSpec: MessageFns = { + encode(message: CertificateSigningRequestSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.request !== undefined && message.request.length !== 0) { + writer.uint32(10).bytes(message.request); + } + if (message.signerName !== undefined && message.signerName !== '') { + writer.uint32(58).string(message.signerName); + } + if (message.expirationSeconds !== undefined && message.expirationSeconds !== 0) { + writer.uint32(64).int32(message.expirationSeconds); + } + for (const v of message.usages) { + writer.uint32(42).string(v!); + } + if (message.username !== undefined && message.username !== '') { + writer.uint32(18).string(message.username); + } + if (message.uid !== undefined && message.uid !== '') { + writer.uint32(26).string(message.uid); + } + for (const v of message.groups) { + writer.uint32(34).string(v!); + } + globalThis.Object.entries(message.extra).forEach(([key, value]: [string, ExtraValue]) => { + CertificateSigningRequestSpec_ExtraEntry.encode( + { key: key as any, value }, + writer.uint32(50).fork(), + ).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CertificateSigningRequestSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCertificateSigningRequestSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.request = reader.bytes(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.signerName = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.expirationSeconds = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.usages.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.username = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.uid = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.groups.push(reader.string()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + const entry6 = CertificateSigningRequestSpec_ExtraEntry.decode( + reader, + reader.uint32(), + ); + if (entry6.value !== undefined) { + message.extra[entry6.key] = entry6.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CertificateSigningRequestSpec { + return { + request: isSet(object.request) ? bytesFromBase64(object.request) : new Uint8Array(0), + signerName: isSet(object.signerName) ? globalThis.String(object.signerName) : '', + expirationSeconds: isSet(object.expirationSeconds) + ? globalThis.Number(object.expirationSeconds) + : 0, + usages: globalThis.Array.isArray(object?.usages) + ? object.usages.map((e: any) => globalThis.String(e)) + : [], + username: isSet(object.username) ? globalThis.String(object.username) : '', + uid: isSet(object.uid) ? globalThis.String(object.uid) : '', + groups: globalThis.Array.isArray(object?.groups) + ? object.groups.map((e: any) => globalThis.String(e)) + : [], + extra: isObject(object.extra) + ? (globalThis.Object.entries(object.extra) as [string, any][]).reduce( + (acc: { [key: string]: ExtraValue }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: ExtraValue.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: CertificateSigningRequestSpec): unknown { + const obj: any = {}; + if (message.request !== undefined && message.request.length !== 0) { + obj.request = base64FromBytes(message.request); + } + if (message.signerName !== undefined && message.signerName !== '') { + obj.signerName = message.signerName; + } + if (message.expirationSeconds !== undefined && message.expirationSeconds !== 0) { + obj.expirationSeconds = Math.round(message.expirationSeconds); + } + if (message.usages?.length) { + obj.usages = message.usages; + } + if (message.username !== undefined && message.username !== '') { + obj.username = message.username; + } + if (message.uid !== undefined && message.uid !== '') { + obj.uid = message.uid; + } + if (message.groups?.length) { + obj.groups = message.groups; + } + if (message.extra) { + const entries = globalThis.Object.entries(message.extra) as [string, ExtraValue][]; + if (entries.length > 0) { + obj.extra = {}; + entries.forEach(([k, v]) => { + obj.extra[k] = ExtraValue.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>( + base?: I, + ): CertificateSigningRequestSpec { + return CertificateSigningRequestSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CertificateSigningRequestSpec { + const message = createBaseCertificateSigningRequestSpec(); + message.request = object.request ?? new Uint8Array(0); + message.signerName = object.signerName ?? ''; + message.expirationSeconds = object.expirationSeconds ?? 0; + message.usages = object.usages?.map((e) => e) || []; + message.username = object.username ?? ''; + message.uid = object.uid ?? ''; + message.groups = object.groups?.map((e) => e) || []; + message.extra = (globalThis.Object.entries(object.extra ?? {}) as [string, ExtraValue][]).reduce( + (acc: { [key: string]: ExtraValue }, [key, value]: [string, ExtraValue]) => { + if (value !== undefined) { + acc[key] = ExtraValue.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseCertificateSigningRequestSpec_ExtraEntry(): CertificateSigningRequestSpec_ExtraEntry { + return { key: '', value: undefined }; +} + +export const CertificateSigningRequestSpec_ExtraEntry: MessageFns = + { + encode( + message: CertificateSigningRequestSpec_ExtraEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ExtraValue.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CertificateSigningRequestSpec_ExtraEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCertificateSigningRequestSpec_ExtraEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = ExtraValue.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CertificateSigningRequestSpec_ExtraEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? ExtraValue.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: CertificateSigningRequestSpec_ExtraEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ExtraValue.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): CertificateSigningRequestSpec_ExtraEntry { + return CertificateSigningRequestSpec_ExtraEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CertificateSigningRequestSpec_ExtraEntry { + const message = createBaseCertificateSigningRequestSpec_ExtraEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? ExtraValue.fromPartial(object.value) + : undefined; + return message; + }, + }; + +function createBaseCertificateSigningRequestStatus(): CertificateSigningRequestStatus { + return { conditions: [], certificate: new Uint8Array(0) }; +} + +export const CertificateSigningRequestStatus: MessageFns = { + encode( + message: CertificateSigningRequestStatus, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + for (const v of message.conditions) { + CertificateSigningRequestCondition.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.certificate !== undefined && message.certificate.length !== 0) { + writer.uint32(18).bytes(message.certificate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CertificateSigningRequestStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCertificateSigningRequestStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.conditions.push( + CertificateSigningRequestCondition.decode(reader, reader.uint32()), + ); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.certificate = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CertificateSigningRequestStatus { + return { + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => CertificateSigningRequestCondition.fromJSON(e)) + : [], + certificate: isSet(object.certificate) ? bytesFromBase64(object.certificate) : new Uint8Array(0), + }; + }, + + toJSON(message: CertificateSigningRequestStatus): unknown { + const obj: any = {}; + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => CertificateSigningRequestCondition.toJSON(e)); + } + if (message.certificate !== undefined && message.certificate.length !== 0) { + obj.certificate = base64FromBytes(message.certificate); + } + return obj; + }, + + create, I>>( + base?: I, + ): CertificateSigningRequestStatus { + return CertificateSigningRequestStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CertificateSigningRequestStatus { + const message = createBaseCertificateSigningRequestStatus(); + message.conditions = + object.conditions?.map((e) => CertificateSigningRequestCondition.fromPartial(e)) || []; + message.certificate = object.certificate ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseClusterTrustBundle(): ClusterTrustBundle { + return { metadata: undefined, spec: undefined }; +} + +export const ClusterTrustBundle: MessageFns = { + encode(message: ClusterTrustBundle, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + ClusterTrustBundleSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClusterTrustBundle { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClusterTrustBundle(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = ClusterTrustBundleSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ClusterTrustBundle { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? ClusterTrustBundleSpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: ClusterTrustBundle): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = ClusterTrustBundleSpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>(base?: I): ClusterTrustBundle { + return ClusterTrustBundle.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClusterTrustBundle { + const message = createBaseClusterTrustBundle(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? ClusterTrustBundleSpec.fromPartial(object.spec) + : undefined; + return message; + }, +}; + +function createBaseClusterTrustBundleList(): ClusterTrustBundleList { + return { metadata: undefined, items: [] }; +} + +export const ClusterTrustBundleList: MessageFns = { + encode(message: ClusterTrustBundleList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ClusterTrustBundle.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClusterTrustBundleList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClusterTrustBundleList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ClusterTrustBundle.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ClusterTrustBundleList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ClusterTrustBundle.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ClusterTrustBundleList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ClusterTrustBundle.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ClusterTrustBundleList { + return ClusterTrustBundleList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClusterTrustBundleList { + const message = createBaseClusterTrustBundleList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ClusterTrustBundle.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseClusterTrustBundleSpec(): ClusterTrustBundleSpec { + return { signerName: '', trustBundle: '' }; +} + +export const ClusterTrustBundleSpec: MessageFns = { + encode(message: ClusterTrustBundleSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signerName !== undefined && message.signerName !== '') { + writer.uint32(10).string(message.signerName); + } + if (message.trustBundle !== undefined && message.trustBundle !== '') { + writer.uint32(18).string(message.trustBundle); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClusterTrustBundleSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClusterTrustBundleSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.signerName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.trustBundle = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ClusterTrustBundleSpec { + return { + signerName: isSet(object.signerName) ? globalThis.String(object.signerName) : '', + trustBundle: isSet(object.trustBundle) ? globalThis.String(object.trustBundle) : '', + }; + }, + + toJSON(message: ClusterTrustBundleSpec): unknown { + const obj: any = {}; + if (message.signerName !== undefined && message.signerName !== '') { + obj.signerName = message.signerName; + } + if (message.trustBundle !== undefined && message.trustBundle !== '') { + obj.trustBundle = message.trustBundle; + } + return obj; + }, + + create, I>>(base?: I): ClusterTrustBundleSpec { + return ClusterTrustBundleSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClusterTrustBundleSpec { + const message = createBaseClusterTrustBundleSpec(); + message.signerName = object.signerName ?? ''; + message.trustBundle = object.trustBundle ?? ''; + return message; + }, +}; + +function createBaseExtraValue(): ExtraValue { + return { items: [] }; +} + +export const ExtraValue: MessageFns = { + encode(message: ExtraValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.items) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtraValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtraValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.items.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ExtraValue { + return { + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ExtraValue): unknown { + const obj: any = {}; + if (message.items?.length) { + obj.items = message.items; + } + return obj; + }, + + create, I>>(base?: I): ExtraValue { + return ExtraValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtraValue { + const message = createBaseExtraValue(); + message.items = object.items?.map((e) => e) || []; + return message; + }, +}; + +function createBasePodCertificateRequest(): PodCertificateRequest { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const PodCertificateRequest: MessageFns = { + encode(message: PodCertificateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + PodCertificateRequestSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + PodCertificateRequestStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodCertificateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodCertificateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = PodCertificateRequestSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = PodCertificateRequestStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodCertificateRequest { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? PodCertificateRequestSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? PodCertificateRequestStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: PodCertificateRequest): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = PodCertificateRequestSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = PodCertificateRequestStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): PodCertificateRequest { + return PodCertificateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodCertificateRequest { + const message = createBasePodCertificateRequest(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? PodCertificateRequestSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? PodCertificateRequestStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBasePodCertificateRequestList(): PodCertificateRequestList { + return { metadata: undefined, items: [] }; +} + +export const PodCertificateRequestList: MessageFns = { + encode(message: PodCertificateRequestList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + PodCertificateRequest.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodCertificateRequestList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodCertificateRequestList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(PodCertificateRequest.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodCertificateRequestList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => PodCertificateRequest.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PodCertificateRequestList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => PodCertificateRequest.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PodCertificateRequestList { + return PodCertificateRequestList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodCertificateRequestList { + const message = createBasePodCertificateRequestList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => PodCertificateRequest.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePodCertificateRequestSpec(): PodCertificateRequestSpec { + return { + signerName: '', + podName: '', + podUID: '', + serviceAccountName: '', + serviceAccountUID: '', + nodeName: '', + nodeUID: '', + maxExpirationSeconds: 0, + stubPKCS10Request: new Uint8Array(0), + unverifiedUserAnnotations: {}, + }; +} + +export const PodCertificateRequestSpec: MessageFns = { + encode(message: PodCertificateRequestSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signerName !== undefined && message.signerName !== '') { + writer.uint32(10).string(message.signerName); + } + if (message.podName !== undefined && message.podName !== '') { + writer.uint32(18).string(message.podName); + } + if (message.podUID !== undefined && message.podUID !== '') { + writer.uint32(26).string(message.podUID); + } + if (message.serviceAccountName !== undefined && message.serviceAccountName !== '') { + writer.uint32(34).string(message.serviceAccountName); + } + if (message.serviceAccountUID !== undefined && message.serviceAccountUID !== '') { + writer.uint32(42).string(message.serviceAccountUID); + } + if (message.nodeName !== undefined && message.nodeName !== '') { + writer.uint32(50).string(message.nodeName); + } + if (message.nodeUID !== undefined && message.nodeUID !== '') { + writer.uint32(58).string(message.nodeUID); + } + if (message.maxExpirationSeconds !== undefined && message.maxExpirationSeconds !== 0) { + writer.uint32(64).int32(message.maxExpirationSeconds); + } + if (message.stubPKCS10Request !== undefined && message.stubPKCS10Request.length !== 0) { + writer.uint32(98).bytes(message.stubPKCS10Request); + } + globalThis.Object.entries(message.unverifiedUserAnnotations).forEach( + ([key, value]: [string, string]) => { + PodCertificateRequestSpec_UnverifiedUserAnnotationsEntry.encode( + { key: key as any, value }, + writer.uint32(90).fork(), + ).join(); + }, + ); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodCertificateRequestSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodCertificateRequestSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.signerName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.podName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.podUID = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.serviceAccountName = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.serviceAccountUID = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.nodeName = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.nodeUID = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.maxExpirationSeconds = reader.int32(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.stubPKCS10Request = reader.bytes(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + const entry11 = PodCertificateRequestSpec_UnverifiedUserAnnotationsEntry.decode( + reader, + reader.uint32(), + ); + if (entry11.value !== undefined) { + message.unverifiedUserAnnotations[entry11.key] = entry11.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodCertificateRequestSpec { + return { + signerName: isSet(object.signerName) ? globalThis.String(object.signerName) : '', + podName: isSet(object.podName) ? globalThis.String(object.podName) : '', + podUID: isSet(object.podUID) ? globalThis.String(object.podUID) : '', + serviceAccountName: isSet(object.serviceAccountName) + ? globalThis.String(object.serviceAccountName) + : '', + serviceAccountUID: isSet(object.serviceAccountUID) + ? globalThis.String(object.serviceAccountUID) + : '', + nodeName: isSet(object.nodeName) ? globalThis.String(object.nodeName) : '', + nodeUID: isSet(object.nodeUID) ? globalThis.String(object.nodeUID) : '', + maxExpirationSeconds: isSet(object.maxExpirationSeconds) + ? globalThis.Number(object.maxExpirationSeconds) + : 0, + stubPKCS10Request: isSet(object.stubPKCS10Request) + ? bytesFromBase64(object.stubPKCS10Request) + : new Uint8Array(0), + unverifiedUserAnnotations: isObject(object.unverifiedUserAnnotations) + ? (globalThis.Object.entries(object.unverifiedUserAnnotations) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: PodCertificateRequestSpec): unknown { + const obj: any = {}; + if (message.signerName !== undefined && message.signerName !== '') { + obj.signerName = message.signerName; + } + if (message.podName !== undefined && message.podName !== '') { + obj.podName = message.podName; + } + if (message.podUID !== undefined && message.podUID !== '') { + obj.podUID = message.podUID; + } + if (message.serviceAccountName !== undefined && message.serviceAccountName !== '') { + obj.serviceAccountName = message.serviceAccountName; + } + if (message.serviceAccountUID !== undefined && message.serviceAccountUID !== '') { + obj.serviceAccountUID = message.serviceAccountUID; + } + if (message.nodeName !== undefined && message.nodeName !== '') { + obj.nodeName = message.nodeName; + } + if (message.nodeUID !== undefined && message.nodeUID !== '') { + obj.nodeUID = message.nodeUID; + } + if (message.maxExpirationSeconds !== undefined && message.maxExpirationSeconds !== 0) { + obj.maxExpirationSeconds = Math.round(message.maxExpirationSeconds); + } + if (message.stubPKCS10Request !== undefined && message.stubPKCS10Request.length !== 0) { + obj.stubPKCS10Request = base64FromBytes(message.stubPKCS10Request); + } + if (message.unverifiedUserAnnotations) { + const entries = globalThis.Object.entries(message.unverifiedUserAnnotations) as [ + string, + string, + ][]; + if (entries.length > 0) { + obj.unverifiedUserAnnotations = {}; + entries.forEach(([k, v]) => { + obj.unverifiedUserAnnotations[k] = v; + }); + } + } + return obj; + }, + + create, I>>(base?: I): PodCertificateRequestSpec { + return PodCertificateRequestSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodCertificateRequestSpec { + const message = createBasePodCertificateRequestSpec(); + message.signerName = object.signerName ?? ''; + message.podName = object.podName ?? ''; + message.podUID = object.podUID ?? ''; + message.serviceAccountName = object.serviceAccountName ?? ''; + message.serviceAccountUID = object.serviceAccountUID ?? ''; + message.nodeName = object.nodeName ?? ''; + message.nodeUID = object.nodeUID ?? ''; + message.maxExpirationSeconds = object.maxExpirationSeconds ?? 0; + message.stubPKCS10Request = object.stubPKCS10Request ?? new Uint8Array(0); + message.unverifiedUserAnnotations = ( + globalThis.Object.entries(object.unverifiedUserAnnotations ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBasePodCertificateRequestSpec_UnverifiedUserAnnotationsEntry(): PodCertificateRequestSpec_UnverifiedUserAnnotationsEntry { + return { key: '', value: '' }; +} + +export const PodCertificateRequestSpec_UnverifiedUserAnnotationsEntry: MessageFns = + { + encode( + message: PodCertificateRequestSpec_UnverifiedUserAnnotationsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): PodCertificateRequestSpec_UnverifiedUserAnnotationsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodCertificateRequestSpec_UnverifiedUserAnnotationsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodCertificateRequestSpec_UnverifiedUserAnnotationsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: PodCertificateRequestSpec_UnverifiedUserAnnotationsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): PodCertificateRequestSpec_UnverifiedUserAnnotationsEntry { + return PodCertificateRequestSpec_UnverifiedUserAnnotationsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial< + I extends Exact, I>, + >(object: I): PodCertificateRequestSpec_UnverifiedUserAnnotationsEntry { + const message = createBasePodCertificateRequestSpec_UnverifiedUserAnnotationsEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, + }; + +function createBasePodCertificateRequestStatus(): PodCertificateRequestStatus { + return { + conditions: [], + certificateChain: '', + notBefore: undefined, + beginRefreshAt: undefined, + notAfter: undefined, + }; +} + +export const PodCertificateRequestStatus: MessageFns = { + encode(message: PodCertificateRequestStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.conditions) { + Condition.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.certificateChain !== undefined && message.certificateChain !== '') { + writer.uint32(18).string(message.certificateChain); + } + if (message.notBefore !== undefined) { + Time.encode(message.notBefore, writer.uint32(34).fork()).join(); + } + if (message.beginRefreshAt !== undefined) { + Time.encode(message.beginRefreshAt, writer.uint32(42).fork()).join(); + } + if (message.notAfter !== undefined) { + Time.encode(message.notAfter, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodCertificateRequestStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodCertificateRequestStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.conditions.push(Condition.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.certificateChain = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.notBefore = Time.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.beginRefreshAt = Time.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.notAfter = Time.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodCertificateRequestStatus { + return { + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => Condition.fromJSON(e)) + : [], + certificateChain: isSet(object.certificateChain) + ? globalThis.String(object.certificateChain) + : '', + notBefore: isSet(object.notBefore) ? Time.fromJSON(object.notBefore) : undefined, + beginRefreshAt: isSet(object.beginRefreshAt) ? Time.fromJSON(object.beginRefreshAt) : undefined, + notAfter: isSet(object.notAfter) ? Time.fromJSON(object.notAfter) : undefined, + }; + }, + + toJSON(message: PodCertificateRequestStatus): unknown { + const obj: any = {}; + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => Condition.toJSON(e)); + } + if (message.certificateChain !== undefined && message.certificateChain !== '') { + obj.certificateChain = message.certificateChain; + } + if (message.notBefore !== undefined) { + obj.notBefore = Time.toJSON(message.notBefore); + } + if (message.beginRefreshAt !== undefined) { + obj.beginRefreshAt = Time.toJSON(message.beginRefreshAt); + } + if (message.notAfter !== undefined) { + obj.notAfter = Time.toJSON(message.notAfter); + } + return obj; + }, + + create, I>>( + base?: I, + ): PodCertificateRequestStatus { + return PodCertificateRequestStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodCertificateRequestStatus { + const message = createBasePodCertificateRequestStatus(); + message.conditions = object.conditions?.map((e) => Condition.fromPartial(e)) || []; + message.certificateChain = object.certificateChain ?? ''; + message.notBefore = + object.notBefore !== undefined && object.notBefore !== null + ? Time.fromPartial(object.notBefore) + : undefined; + message.beginRefreshAt = + object.beginRefreshAt !== undefined && object.beginRefreshAt !== null + ? Time.fromPartial(object.beginRefreshAt) + : undefined; + message.notAfter = + object.notAfter !== undefined && object.notAfter !== null + ? Time.fromPartial(object.notAfter) + : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from((globalThis as any).Buffer.from(b64, 'base64')); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return (globalThis as any).Buffer.from(arr).toString('base64'); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join('')); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/coordination/v1/generated.ts b/src/proto/generated/k8s.io/api/coordination/v1/generated.ts new file mode 100644 index 00000000000..5869652f3fd --- /dev/null +++ b/src/proto/generated/k8s.io/api/coordination/v1/generated.ts @@ -0,0 +1,480 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/coordination/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { ListMeta, MicroTime, ObjectMeta } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** Lease defines a lease concept. */ +export interface Lease { + /** + * metadata is the standard object metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec contains the specification of the Lease. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: LeaseSpec | undefined; +} + +/** LeaseList is a list of Lease objects. */ +export interface LeaseList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** items is a list of schema objects. */ + items: Lease[]; +} + +/** LeaseSpec is a specification of a Lease. */ +export interface LeaseSpec { + /** + * holderIdentity contains the identity of the holder of a current lease. + * If Coordinated Leader Election is used, the holder identity must be + * equal to the elected LeaseCandidate.metadata.name field. + * +optional + */ + holderIdentity?: string | undefined; + /** + * leaseDurationSeconds is a duration that candidates for a lease need + * to wait to force acquire it. This is measured against the time of last + * observed renewTime. + * +optional + */ + leaseDurationSeconds?: number | undefined; + /** + * acquireTime is a time when the current lease was acquired. + * +optional + */ + acquireTime?: MicroTime | undefined; + /** + * renewTime is a time when the current holder of a lease has last + * updated the lease. + * +optional + */ + renewTime?: MicroTime | undefined; + /** + * leaseTransitions is the number of transitions of a lease between + * holders. + * +optional + */ + leaseTransitions?: number | undefined; + /** + * strategy indicates the strategy for picking the leader for coordinated leader election. + * If the field is not specified, there is no active coordination for this lease. + * (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled. + * +featureGate=CoordinatedLeaderElection + * +optional + */ + strategy?: string | undefined; + /** + * preferredHolder signals to a lease holder that the lease has a + * more optimal holder and should be given up. + * This field can only be set if Strategy is also set. + * +featureGate=CoordinatedLeaderElection + * +optional + */ + preferredHolder?: string | undefined; +} + +function createBaseLease(): Lease { + return { metadata: undefined, spec: undefined }; +} + +export const Lease: MessageFns = { + encode(message: Lease, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + LeaseSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Lease { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLease(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = LeaseSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Lease { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? LeaseSpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: Lease): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = LeaseSpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>(base?: I): Lease { + return Lease.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Lease { + const message = createBaseLease(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? LeaseSpec.fromPartial(object.spec) + : undefined; + return message; + }, +}; + +function createBaseLeaseList(): LeaseList { + return { metadata: undefined, items: [] }; +} + +export const LeaseList: MessageFns = { + encode(message: LeaseList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Lease.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LeaseList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLeaseList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Lease.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LeaseList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Lease.fromJSON(e)) + : [], + }; + }, + + toJSON(message: LeaseList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Lease.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LeaseList { + return LeaseList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LeaseList { + const message = createBaseLeaseList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Lease.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseLeaseSpec(): LeaseSpec { + return { + holderIdentity: '', + leaseDurationSeconds: 0, + acquireTime: undefined, + renewTime: undefined, + leaseTransitions: 0, + strategy: '', + preferredHolder: '', + }; +} + +export const LeaseSpec: MessageFns = { + encode(message: LeaseSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.holderIdentity !== undefined && message.holderIdentity !== '') { + writer.uint32(10).string(message.holderIdentity); + } + if (message.leaseDurationSeconds !== undefined && message.leaseDurationSeconds !== 0) { + writer.uint32(16).int32(message.leaseDurationSeconds); + } + if (message.acquireTime !== undefined) { + MicroTime.encode(message.acquireTime, writer.uint32(26).fork()).join(); + } + if (message.renewTime !== undefined) { + MicroTime.encode(message.renewTime, writer.uint32(34).fork()).join(); + } + if (message.leaseTransitions !== undefined && message.leaseTransitions !== 0) { + writer.uint32(40).int32(message.leaseTransitions); + } + if (message.strategy !== undefined && message.strategy !== '') { + writer.uint32(50).string(message.strategy); + } + if (message.preferredHolder !== undefined && message.preferredHolder !== '') { + writer.uint32(58).string(message.preferredHolder); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LeaseSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLeaseSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.holderIdentity = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.leaseDurationSeconds = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.acquireTime = MicroTime.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.renewTime = MicroTime.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.leaseTransitions = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.strategy = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.preferredHolder = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LeaseSpec { + return { + holderIdentity: isSet(object.holderIdentity) ? globalThis.String(object.holderIdentity) : '', + leaseDurationSeconds: isSet(object.leaseDurationSeconds) + ? globalThis.Number(object.leaseDurationSeconds) + : 0, + acquireTime: isSet(object.acquireTime) ? MicroTime.fromJSON(object.acquireTime) : undefined, + renewTime: isSet(object.renewTime) ? MicroTime.fromJSON(object.renewTime) : undefined, + leaseTransitions: isSet(object.leaseTransitions) ? globalThis.Number(object.leaseTransitions) : 0, + strategy: isSet(object.strategy) ? globalThis.String(object.strategy) : '', + preferredHolder: isSet(object.preferredHolder) ? globalThis.String(object.preferredHolder) : '', + }; + }, + + toJSON(message: LeaseSpec): unknown { + const obj: any = {}; + if (message.holderIdentity !== undefined && message.holderIdentity !== '') { + obj.holderIdentity = message.holderIdentity; + } + if (message.leaseDurationSeconds !== undefined && message.leaseDurationSeconds !== 0) { + obj.leaseDurationSeconds = Math.round(message.leaseDurationSeconds); + } + if (message.acquireTime !== undefined) { + obj.acquireTime = MicroTime.toJSON(message.acquireTime); + } + if (message.renewTime !== undefined) { + obj.renewTime = MicroTime.toJSON(message.renewTime); + } + if (message.leaseTransitions !== undefined && message.leaseTransitions !== 0) { + obj.leaseTransitions = Math.round(message.leaseTransitions); + } + if (message.strategy !== undefined && message.strategy !== '') { + obj.strategy = message.strategy; + } + if (message.preferredHolder !== undefined && message.preferredHolder !== '') { + obj.preferredHolder = message.preferredHolder; + } + return obj; + }, + + create, I>>(base?: I): LeaseSpec { + return LeaseSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LeaseSpec { + const message = createBaseLeaseSpec(); + message.holderIdentity = object.holderIdentity ?? ''; + message.leaseDurationSeconds = object.leaseDurationSeconds ?? 0; + message.acquireTime = + object.acquireTime !== undefined && object.acquireTime !== null + ? MicroTime.fromPartial(object.acquireTime) + : undefined; + message.renewTime = + object.renewTime !== undefined && object.renewTime !== null + ? MicroTime.fromPartial(object.renewTime) + : undefined; + message.leaseTransitions = object.leaseTransitions ?? 0; + message.strategy = object.strategy ?? ''; + message.preferredHolder = object.preferredHolder ?? ''; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/core/v1/generated.ts b/src/proto/generated/k8s.io/api/core/v1/generated.ts new file mode 100644 index 00000000000..55cf5e335ab --- /dev/null +++ b/src/proto/generated/k8s.io/api/core/v1/generated.ts @@ -0,0 +1,45397 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/core/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { Quantity } from '../../../apimachinery/pkg/api/resource/generated.js'; +import { + Condition, + LabelSelector, + ListMeta, + MicroTime, + ObjectMeta, + OwnerReference, + Time, +} from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; +import { RawExtension } from '../../../apimachinery/pkg/runtime/generated.js'; +import { IntOrString } from '../../../apimachinery/pkg/util/intstr/generated.js'; + +/** + * Represents a Persistent Disk resource in AWS. + * + * An AWS EBS disk must exist before mounting to a container. The disk + * must also be in the same AWS zone as the kubelet. An AWS EBS disk + * can only be mounted as read/write once. AWS EBS volumes support + * ownership management and SELinux relabeling. + */ +export interface AWSElasticBlockStoreVolumeSource { + /** + * volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). + * More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + */ + volumeID?: string | undefined; + /** + * fsType is the filesystem type of the volume that you want to mount. + * Tip: Ensure that the filesystem type is supported by the host operating system. + * Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + * TODO: how do we prevent errors in the filesystem from compromising the machine + * +optional + */ + fsType?: string | undefined; + /** + * partition is the partition in the volume that you want to mount. + * If omitted, the default is to mount by volume name. + * Examples: For volume /dev/sda1, you specify the partition as "1". + * Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + * +optional + */ + partition?: number | undefined; + /** + * readOnly value true will force the readOnly setting in VolumeMounts. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + * +optional + */ + readOnly?: boolean | undefined; +} + +/** Affinity is a group of affinity scheduling rules. */ +export interface Affinity { + /** + * Describes node affinity scheduling rules for the pod. + * +optional + */ + nodeAffinity?: NodeAffinity | undefined; + /** + * Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)). + * +optional + */ + podAffinity?: PodAffinity | undefined; + /** + * Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)). + * +optional + */ + podAntiAffinity?: PodAntiAffinity | undefined; +} + +/** + * AppArmorProfile defines a pod or container's AppArmor settings. + * +union + */ +export interface AppArmorProfile { + /** + * type indicates which kind of AppArmor profile will be applied. + * Valid options are: + * Localhost - a profile pre-loaded on the node. + * RuntimeDefault - the container runtime's default profile. + * Unconfined - no AppArmor enforcement. + * +unionDiscriminator + */ + type?: string | undefined; + /** + * localhostProfile indicates a profile loaded on the node that should be used. + * The profile must be preconfigured on the node to work. + * Must match the loaded name of the profile. + * Must be set if and only if type is "Localhost". + * +optional + */ + localhostProfile?: string | undefined; +} + +/** AttachedVolume describes a volume attached to a node */ +export interface AttachedVolume { + /** Name of the attached volume */ + name?: string | undefined; + /** DevicePath represents the device path where the volume should be available */ + devicePath?: string | undefined; +} + +/** + * AvoidPods describes pods that should avoid this node. This is the value for a + * Node annotation with key scheduler.alpha.kubernetes.io/preferAvoidPods and + * will eventually become a field of NodeStatus. + */ +export interface AvoidPods { + /** + * Bounded-sized list of signatures of pods that should avoid this node, sorted + * in timestamp order from oldest to newest. Size of the slice is unspecified. + * +optional + * +listType=atomic + */ + preferAvoidPods: PreferAvoidPodsEntry[]; +} + +/** AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. */ +export interface AzureDiskVolumeSource { + /** diskName is the Name of the data disk in the blob storage */ + diskName?: string | undefined; + /** diskURI is the URI of data disk in the blob storage */ + diskURI?: string | undefined; + /** + * cachingMode is the Host Caching mode: None, Read Only, Read Write. + * +optional + * +default=ref(AzureDataDiskCachingReadWrite) + */ + cachingMode?: string | undefined; + /** + * fsType is Filesystem type to mount. + * Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * +optional + * +default="ext4" + */ + fsType?: string | undefined; + /** + * readOnly Defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * +optional + * +default=false + */ + readOnly?: boolean | undefined; + /** + * kind expected values are Shared: multiple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared + * +default=ref(AzureSharedBlobDisk) + */ + kind?: string | undefined; +} + +/** AzureFile represents an Azure File Service mount on the host and bind mount to the pod. */ +export interface AzureFilePersistentVolumeSource { + /** secretName is the name of secret that contains Azure Storage Account Name and Key */ + secretName?: string | undefined; + /** shareName is the azure Share Name */ + shareName?: string | undefined; + /** + * readOnly defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * +optional + */ + readOnly?: boolean | undefined; + /** + * secretNamespace is the namespace of the secret that contains Azure Storage Account Name and Key + * default is the same as the Pod + * +optional + */ + secretNamespace?: string | undefined; +} + +/** AzureFile represents an Azure File Service mount on the host and bind mount to the pod. */ +export interface AzureFileVolumeSource { + /** secretName is the name of secret that contains Azure Storage Account Name and Key */ + secretName?: string | undefined; + /** shareName is the azure share Name */ + shareName?: string | undefined; + /** + * readOnly defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * +optional + */ + readOnly?: boolean | undefined; +} + +/** Binding ties one object to another; for example, a pod is bound to a node by a scheduler. */ +export interface Binding { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** The target object that you want to bind to the standard object. */ + target?: ObjectReference | undefined; +} + +/** Represents storage that is managed by an external CSI volume driver */ +export interface CSIPersistentVolumeSource { + /** + * driver is the name of the driver to use for this volume. + * Required. + */ + driver?: string | undefined; + /** + * volumeHandle is the unique volume name returned by the CSI volume + * plugin’s CreateVolume to refer to the volume on all subsequent calls. + * Required. + */ + volumeHandle?: string | undefined; + /** + * readOnly value to pass to ControllerPublishVolumeRequest. + * Defaults to false (read/write). + * +optional + */ + readOnly?: boolean | undefined; + /** + * fsType to mount. Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs", "ntfs". + * +optional + */ + fsType?: string | undefined; + /** + * volumeAttributes of the volume to publish. + * +optional + */ + volumeAttributes: { [key: string]: string }; + /** + * controllerPublishSecretRef is a reference to the secret object containing + * sensitive information to pass to the CSI driver to complete the CSI + * ControllerPublishVolume and ControllerUnpublishVolume calls. + * This field is optional, and may be empty if no secret is required. If the + * secret object contains more than one secret, all secrets are passed. + * +optional + */ + controllerPublishSecretRef?: SecretReference | undefined; + /** + * nodeStageSecretRef is a reference to the secret object containing sensitive + * information to pass to the CSI driver to complete the CSI NodeStageVolume + * and NodeStageVolume and NodeUnstageVolume calls. + * This field is optional, and may be empty if no secret is required. If the + * secret object contains more than one secret, all secrets are passed. + * +optional + */ + nodeStageSecretRef?: SecretReference | undefined; + /** + * nodePublishSecretRef is a reference to the secret object containing + * sensitive information to pass to the CSI driver to complete the CSI + * NodePublishVolume and NodeUnpublishVolume calls. + * This field is optional, and may be empty if no secret is required. If the + * secret object contains more than one secret, all secrets are passed. + * +optional + */ + nodePublishSecretRef?: SecretReference | undefined; + /** + * controllerExpandSecretRef is a reference to the secret object containing + * sensitive information to pass to the CSI driver to complete the CSI + * ControllerExpandVolume call. + * This field is optional, and may be empty if no secret is required. If the + * secret object contains more than one secret, all secrets are passed. + * +optional + */ + controllerExpandSecretRef?: SecretReference | undefined; + /** + * nodeExpandSecretRef is a reference to the secret object containing + * sensitive information to pass to the CSI driver to complete the CSI + * NodeExpandVolume call. + * This field is optional, may be omitted if no secret is required. If the + * secret object contains more than one secret, all secrets are passed. + * +optional + */ + nodeExpandSecretRef?: SecretReference | undefined; +} + +export interface CSIPersistentVolumeSource_VolumeAttributesEntry { + key: string; + value: string; +} + +/** Represents a source location of a volume to mount, managed by an external CSI driver */ +export interface CSIVolumeSource { + /** + * driver is the name of the CSI driver that handles this volume. + * Consult with your admin for the correct name as registered in the cluster. + */ + driver?: string | undefined; + /** + * readOnly specifies a read-only configuration for the volume. + * Defaults to false (read/write). + * +optional + */ + readOnly?: boolean | undefined; + /** + * fsType to mount. Ex. "ext4", "xfs", "ntfs". + * If not provided, the empty value is passed to the associated CSI driver + * which will determine the default filesystem to apply. + * +optional + */ + fsType?: string | undefined; + /** + * volumeAttributes stores driver-specific properties that are passed to the CSI + * driver. Consult your driver's documentation for supported values. + * +optional + */ + volumeAttributes: { [key: string]: string }; + /** + * nodePublishSecretRef is a reference to the secret object containing + * sensitive information to pass to the CSI driver to complete the CSI + * NodePublishVolume and NodeUnpublishVolume calls. + * This field is optional, and may be empty if no secret is required. If the + * secret object contains more than one secret, all secret references are passed. + * +optional + */ + nodePublishSecretRef?: LocalObjectReference | undefined; +} + +export interface CSIVolumeSource_VolumeAttributesEntry { + key: string; + value: string; +} + +/** Adds and removes POSIX capabilities from running containers. */ +export interface Capabilities { + /** + * Added capabilities + * +optional + * +listType=atomic + */ + add: string[]; + /** + * Removed capabilities + * +optional + * +listType=atomic + */ + drop: string[]; +} + +/** + * Represents a Ceph Filesystem mount that lasts the lifetime of a pod + * Cephfs volumes do not support ownership management or SELinux relabeling. + */ +export interface CephFSPersistentVolumeSource { + /** + * monitors is Required: Monitors is a collection of Ceph monitors + * More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + * +listType=atomic + */ + monitors: string[]; + /** + * path is Optional: Used as the mounted root, rather than the full Ceph tree, default is / + * +optional + */ + path?: string | undefined; + /** + * user is Optional: User is the rados user name, default is admin + * More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + * +optional + */ + user?: string | undefined; + /** + * secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret + * More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + * +optional + */ + secretFile?: string | undefined; + /** + * secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + * More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + * +optional + */ + secretRef?: SecretReference | undefined; + /** + * readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + * +optional + */ + readOnly?: boolean | undefined; +} + +/** + * Represents a Ceph Filesystem mount that lasts the lifetime of a pod + * Cephfs volumes do not support ownership management or SELinux relabeling. + */ +export interface CephFSVolumeSource { + /** + * monitors is Required: Monitors is a collection of Ceph monitors + * More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + * +listType=atomic + */ + monitors: string[]; + /** + * path is Optional: Used as the mounted root, rather than the full Ceph tree, default is / + * +optional + */ + path?: string | undefined; + /** + * user is optional: User is the rados user name, default is admin + * More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + * +optional + */ + user?: string | undefined; + /** + * secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret + * More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + * +optional + */ + secretFile?: string | undefined; + /** + * secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + * More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + * +optional + */ + secretRef?: LocalObjectReference | undefined; + /** + * readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + * +optional + */ + readOnly?: boolean | undefined; +} + +/** + * Represents a cinder volume resource in Openstack. + * A Cinder volume must exist before mounting to a container. + * The volume must also be in the same region as the kubelet. + * Cinder volumes support ownership management and SELinux relabeling. + */ +export interface CinderPersistentVolumeSource { + /** + * volumeID used to identify the volume in cinder. + * More info: https://examples.k8s.io/mysql-cinder-pd/README.md + */ + volumeID?: string | undefined; + /** + * fsType Filesystem type to mount. + * Must be a filesystem type supported by the host operating system. + * Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * More info: https://examples.k8s.io/mysql-cinder-pd/README.md + * +optional + */ + fsType?: string | undefined; + /** + * readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * More info: https://examples.k8s.io/mysql-cinder-pd/README.md + * +optional + */ + readOnly?: boolean | undefined; + /** + * secretRef is Optional: points to a secret object containing parameters used to connect + * to OpenStack. + * +optional + */ + secretRef?: SecretReference | undefined; +} + +/** + * Represents a cinder volume resource in Openstack. + * A Cinder volume must exist before mounting to a container. + * The volume must also be in the same region as the kubelet. + * Cinder volumes support ownership management and SELinux relabeling. + */ +export interface CinderVolumeSource { + /** + * volumeID used to identify the volume in cinder. + * More info: https://examples.k8s.io/mysql-cinder-pd/README.md + */ + volumeID?: string | undefined; + /** + * fsType is the filesystem type to mount. + * Must be a filesystem type supported by the host operating system. + * Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * More info: https://examples.k8s.io/mysql-cinder-pd/README.md + * +optional + */ + fsType?: string | undefined; + /** + * readOnly defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * More info: https://examples.k8s.io/mysql-cinder-pd/README.md + * +optional + */ + readOnly?: boolean | undefined; + /** + * secretRef is optional: points to a secret object containing parameters used to connect + * to OpenStack. + * +optional + */ + secretRef?: LocalObjectReference | undefined; +} + +/** ClientIPConfig represents the configurations of Client IP based session affinity. */ +export interface ClientIPConfig { + /** + * timeoutSeconds specifies the seconds of ClientIP type session sticky time. + * The value must be >0 && <=86400(for 1 day) if ServiceAffinity == "ClientIP". + * Default value is 10800(for 3 hours). + * +optional + */ + timeoutSeconds?: number | undefined; +} + +/** + * ClusterTrustBundleProjection describes how to select a set of + * ClusterTrustBundle objects and project their contents into the pod + * filesystem. + */ +export interface ClusterTrustBundleProjection { + /** + * Select a single ClusterTrustBundle by object name. Mutually-exclusive + * with signerName and labelSelector. + * +optional + */ + name?: string | undefined; + /** + * Select all ClusterTrustBundles that match this signer name. + * Mutually-exclusive with name. The contents of all selected + * ClusterTrustBundles will be unified and deduplicated. + * +optional + */ + signerName?: string | undefined; + /** + * Select all ClusterTrustBundles that match this label selector. Only has + * effect if signerName is set. Mutually-exclusive with name. If unset, + * interpreted as "match nothing". If set but empty, interpreted as "match + * everything". + * +optional + */ + labelSelector?: LabelSelector | undefined; + /** + * If true, don't block pod startup if the referenced ClusterTrustBundle(s) + * aren't available. If using name, then the named ClusterTrustBundle is + * allowed not to exist. If using signerName, then the combination of + * signerName and labelSelector is allowed to match zero + * ClusterTrustBundles. + * +optional + */ + optional?: boolean | undefined; + /** Relative path from the volume root to write the bundle. */ + path?: string | undefined; + /** + * user is Optional: The owner UID of the created file. + * If specified, the item-level user field takes precedence over defaultUser. + * (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + * +featureGate=AtomicWriteVolumeUserFields + * +optional + */ + user?: number | undefined; +} + +/** Information about the condition of a component. */ +export interface ComponentCondition { + /** + * Type of condition for a component. + * Valid value: "Healthy" + */ + type?: string | undefined; + /** + * Status of the condition for a component. + * Valid values for "Healthy": "True", "False", or "Unknown". + */ + status?: string | undefined; + /** + * Message about the condition for a component. + * For example, information about a health check. + * +optional + */ + message?: string | undefined; + /** + * Condition error code for a component. + * For example, a health check error code. + * +optional + */ + error?: string | undefined; +} + +/** + * ComponentStatus (and ComponentStatusList) holds the cluster validation info. + * Deprecated: This API is deprecated in v1.19+ + */ +export interface ComponentStatus { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * List of component conditions observed + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: ComponentCondition[]; +} + +/** + * Status of all the conditions for the component as a list of ComponentStatus objects. + * Deprecated: This API is deprecated in v1.19+ + */ +export interface ComponentStatusList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of ComponentStatus objects. */ + items: ComponentStatus[]; +} + +/** ConfigMap holds configuration data for pods to consume. */ +export interface ConfigMap { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Immutable, if set to true, ensures that data stored in the ConfigMap cannot + * be updated (only object metadata can be modified). + * If not set to true, the field can be modified at any time. + * Defaulted to nil. + * +optional + */ + immutable?: boolean | undefined; + /** + * Data contains the configuration data. + * Each key must consist of alphanumeric characters, '-', '_' or '.'. + * Values with non-UTF-8 byte sequences must use the BinaryData field. + * The keys stored in Data must not overlap with the keys in + * the BinaryData field, this is enforced during validation process. + * +optional + */ + data: { [key: string]: string }; + /** + * BinaryData contains the binary data. + * Each key must consist of alphanumeric characters, '-', '_' or '.'. + * BinaryData can contain byte sequences that are not in the UTF-8 range. + * The keys stored in BinaryData must not overlap with the ones in + * the Data field, this is enforced during validation process. + * Using this field will require 1.10+ apiserver and + * kubelet. + * Note: BinaryData keys are not currently propagated to container env vars + * via ConfigMapKeyRef or ConfigMapRef env sources; only Data keys are used. + * +optional + */ + binaryData: { [key: string]: Uint8Array }; +} + +export interface ConfigMap_DataEntry { + key: string; + value: string; +} + +export interface ConfigMap_BinaryDataEntry { + key: string; + value: Uint8Array; +} + +/** + * ConfigMapEnvSource selects a ConfigMap to populate the environment + * variables with. + * + * The contents of the target ConfigMap's Data field will represent the + * key-value pairs as environment variables. + * Keys in the BinaryData field are not currently propagated to container env vars. + */ +export interface ConfigMapEnvSource { + /** The ConfigMap to select from. */ + localObjectReference?: LocalObjectReference | undefined; + /** + * Specify whether the ConfigMap must be defined + * +optional + */ + optional?: boolean | undefined; +} + +/** + * Selects a key from a ConfigMap. + * +structType=atomic + */ +export interface ConfigMapKeySelector { + /** The ConfigMap to select from. */ + localObjectReference?: LocalObjectReference | undefined; + /** + * The key to select from the ConfigMap's Data field. + * Keys in the BinaryData field are not currently propagated to container env vars. + */ + key?: string | undefined; + /** + * Specify whether the ConfigMap or its key must be defined + * +optional + */ + optional?: boolean | undefined; +} + +/** ConfigMapList is a resource containing a list of ConfigMap objects. */ +export interface ConfigMapList { + /** + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is the list of ConfigMaps. */ + items: ConfigMap[]; +} + +/** + * ConfigMapNodeConfigSource contains the information to reference a ConfigMap as a config source for the Node. + * This API is deprecated since 1.22: https://git.k8s.io/enhancements/keps/sig-node/281-dynamic-kubelet-configuration + */ +export interface ConfigMapNodeConfigSource { + /** + * Namespace is the metadata.namespace of the referenced ConfigMap. + * This field is required in all cases. + */ + namespace?: string | undefined; + /** + * Name is the metadata.name of the referenced ConfigMap. + * This field is required in all cases. + */ + name?: string | undefined; + /** + * UID is the metadata.UID of the referenced ConfigMap. + * This field is forbidden in Node.Spec, and required in Node.Status. + * +optional + */ + uid?: string | undefined; + /** + * ResourceVersion is the metadata.ResourceVersion of the referenced ConfigMap. + * This field is forbidden in Node.Spec, and required in Node.Status. + * +optional + */ + resourceVersion?: string | undefined; + /** + * KubeletConfigKey declares which key of the referenced ConfigMap corresponds to the KubeletConfiguration structure + * This field is required in all cases. + */ + kubeletConfigKey?: string | undefined; +} + +/** + * Adapts a ConfigMap into a projected volume. + * + * The contents of the target ConfigMap's Data field will be presented in a + * projected volume as files using the keys in the Data field as the file names, + * unless the items element is populated with specific mappings of keys to paths. + * Note that this is identical to a configmap volume source without the default + * mode. + */ +export interface ConfigMapProjection { + localObjectReference?: LocalObjectReference | undefined; + /** + * items if unspecified, each key-value pair in the Data field of the referenced + * ConfigMap will be projected into the volume as a file whose name is the + * key and content is the value. If specified, the listed keys will be + * projected into the specified paths, and unlisted keys will not be + * present. If a key is specified which is not present in the ConfigMap, + * the volume setup will error unless it is marked optional. Paths must be + * relative and may not contain the '..' path or start with '..'. + * +optional + * +listType=atomic + */ + items: KeyToPath[]; + /** + * optional specify whether the ConfigMap or its keys must be defined + * +optional + */ + optional?: boolean | undefined; +} + +/** + * Adapts a ConfigMap into a volume. + * + * The contents of the target ConfigMap's Data field will be presented in a + * volume as files using the keys in the Data field as the file names, unless + * the items element is populated with specific mappings of keys to paths. + * ConfigMap volumes support ownership management and SELinux relabeling. + */ +export interface ConfigMapVolumeSource { + localObjectReference?: LocalObjectReference | undefined; + /** + * items if unspecified, each key-value pair in the Data field of the referenced + * ConfigMap will be projected into the volume as a file whose name is the + * key and content is the value. If specified, the listed keys will be + * projected into the specified paths, and unlisted keys will not be + * present. If a key is specified which is not present in the ConfigMap, + * the volume setup will error unless it is marked optional. Paths must be + * relative and may not contain the '..' path or start with '..'. + * +optional + * +listType=atomic + */ + items: KeyToPath[]; + /** + * defaultMode is optional: mode bits used to set permissions on created files by default. + * Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + * YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + * Defaults to 0644. + * Directories within the path are not affected by this setting. + * This might be in conflict with other options that affect the file + * mode, like fsGroup, and the result can be other mode bits set. + * +optional + */ + defaultMode?: number | undefined; + /** + * optional specify whether the ConfigMap or its keys must be defined + * +optional + */ + optional?: boolean | undefined; + /** + * defaultUser is Optional: The owner UID of the created files by default. + * The defaultUser field is only used as a fallback when the item-level user field is unset. + * (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + * +featureGate=AtomicWriteVolumeUserFields + * +optional + */ + defaultUser?: number | undefined; +} + +/** A single application container that you want to run within a pod. */ +export interface Container { + /** + * Name of the container specified as a DNS_LABEL. + * Each container in a pod must have a unique name (DNS_LABEL). + * Cannot be updated. + */ + name?: string | undefined; + /** + * Container image name. + * More info: https://kubernetes.io/docs/concepts/containers/images + * This field is optional to allow higher level config management to default or override + * container images in workload controllers like Deployments and StatefulSets. + * +optional + */ + image?: string | undefined; + /** + * Entrypoint array. Not executed within a shell. + * The container image's ENTRYPOINT is used if this is not provided. + * Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + * cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + * to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + * produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + * of whether the variable exists or not. Cannot be updated. + * More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + * +optional + * +listType=atomic + */ + command: string[]; + /** + * Arguments to the entrypoint. + * The container image's CMD is used if this is not provided. + * Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + * cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + * to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + * produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + * of whether the variable exists or not. Cannot be updated. + * More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + * +optional + * +listType=atomic + */ + args: string[]; + /** + * Container's working directory. + * If not specified, the container runtime's default will be used, which + * might be configured in the container image. + * Cannot be updated. + * +optional + */ + workingDir?: string | undefined; + /** + * List of ports to expose from the container. Not specifying a port here + * DOES NOT prevent that port from being exposed. Any port which is + * listening on the default "0.0.0.0" address inside a container will be + * accessible from the network. + * Modifying this array with strategic merge patch may corrupt the data. + * For more information See https://github.com/kubernetes/kubernetes/issues/108255. + * Cannot be updated. + * +optional + * +patchMergeKey=containerPort + * +patchStrategy=merge + * +listType=map + * +listMapKey=containerPort + * +listMapKey=protocol + */ + ports: ContainerPort[]; + /** + * List of sources to populate environment variables in the container. + * The keys defined within a source may consist of any printable ASCII characters except '='. + * When a key exists in multiple + * sources, the value associated with the last source will take precedence. + * Values defined by an Env with a duplicate key will take precedence. + * Cannot be updated. + * +optional + * +listType=atomic + */ + envFrom: EnvFromSource[]; + /** + * List of environment variables to set in the container. + * Cannot be updated. + * +optional + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + */ + env: EnvVar[]; + /** + * Compute Resources required by this container. + * Cannot be updated. + * More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + * +optional + */ + resources?: ResourceRequirements | undefined; + /** + * Resources resize policy for the container. + * This field cannot be set on ephemeral containers. + * +featureGate=InPlacePodVerticalScaling + * +optional + * +listType=atomic + */ + resizePolicy: ContainerResizePolicy[]; + /** + * RestartPolicy defines the restart behavior of individual containers in a pod. + * This overrides the pod-level restart policy. When this field is not specified, + * the restart behavior is defined by the Pod's restart policy and the container type. + * Additionally, setting the RestartPolicy as "Always" for the init container will + * have the following effect: + * this init container will be continually restarted on + * exit until all regular containers have terminated. Once all regular + * containers have completed, all init containers with restartPolicy "Always" + * will be shut down. This lifecycle differs from normal init containers and + * is often referred to as a "sidecar" container. Although this init + * container still starts in the init container sequence, it does not wait + * for the container to complete before proceeding to the next init + * container. Instead, the next init container starts immediately after this + * init container is started, or after any startupProbe has successfully + * completed. + * +optional + */ + restartPolicy?: string | undefined; + /** + * Represents a list of rules to be checked to determine if the + * container should be restarted on exit. The rules are evaluated in + * order. Once a rule matches a container exit condition, the remaining + * rules are ignored. If no rule matches the container exit condition, + * the Container-level restart policy determines the whether the container + * is restarted or not. Constraints on the rules: + * - At most 20 rules are allowed. + * - Rules can have the same action. + * - Identical rules are not forbidden in validations. + * When rules are specified, container MUST set RestartPolicy explicitly + * even it if matches the Pod's RestartPolicy. + * +featureGate=ContainerRestartRules + * +optional + * +listType=atomic + */ + restartPolicyRules: ContainerRestartRule[]; + /** + * Pod volumes to mount into the container's filesystem. + * Cannot be updated. + * +optional + * +patchMergeKey=mountPath + * +patchStrategy=merge + * +listType=map + * +listMapKey=mountPath + */ + volumeMounts: VolumeMount[]; + /** + * volumeDevices is the list of block devices to be used by the container. + * +patchMergeKey=devicePath + * +patchStrategy=merge + * +listType=map + * +listMapKey=devicePath + * +optional + */ + volumeDevices: VolumeDevice[]; + /** + * Periodic probe of container liveness. + * Container will be restarted if the probe fails. + * Cannot be updated. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + * +optional + */ + livenessProbe?: Probe | undefined; + /** + * Periodic probe of container service readiness. + * Container will be removed from service endpoints if the probe fails. + * Cannot be updated. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + * +optional + */ + readinessProbe?: Probe | undefined; + /** + * StartupProbe indicates that the Pod has successfully initialized. + * If specified, no other probes are executed until this completes successfully. + * If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. + * This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, + * when it might take a long time to load data or warm a cache, than during steady-state operation. + * This cannot be updated. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + * +optional + */ + startupProbe?: Probe | undefined; + /** + * Actions that the management system should take in response to container lifecycle events. + * Cannot be updated. + * +optional + */ + lifecycle?: Lifecycle | undefined; + /** + * Optional: Path at which the file to which the container's termination message + * will be written is mounted into the container's filesystem. + * Message written is intended to be brief final status, such as an assertion failure message. + * Will be truncated by the node if greater than 4096 bytes. The total message length across + * all containers will be limited to 12kb. + * Defaults to /dev/termination-log. + * Cannot be updated. + * +optional + */ + terminationMessagePath?: string | undefined; + /** + * Indicate how the termination message should be populated. File will use the contents of + * terminationMessagePath to populate the container status message on both success and failure. + * FallbackToLogsOnError will use the last chunk of container log output if the termination + * message file is empty and the container exited with an error. + * The log output is limited to 2048 bytes or 80 lines, whichever is smaller. + * Defaults to File. + * Cannot be updated. + * +optional + */ + terminationMessagePolicy?: string | undefined; + /** + * Image pull policy. + * One of Always, Never, IfNotPresent. + * Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + * Cannot be updated. + * More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + * +optional + */ + imagePullPolicy?: string | undefined; + /** + * SecurityContext defines the security options the container should be run with. + * If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. + * More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ + * +optional + */ + securityContext?: SecurityContext | undefined; + /** + * Whether this container should allocate a buffer for stdin in the container runtime. If this + * is not set, reads from stdin in the container will always result in EOF. + * Default is false. + * +optional + */ + stdin?: boolean | undefined; + /** + * Whether the container runtime should close the stdin channel after it has been opened by + * a single attach. When stdin is true the stdin stream will remain open across multiple attach + * sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the + * first client attaches to stdin, and then remains open and accepts data until the client disconnects, + * at which time stdin is closed and remains closed until the container is restarted. If this + * flag is false, a container processes that reads from stdin will never receive an EOF. + * Default is false + * +optional + */ + stdinOnce?: boolean | undefined; + /** + * Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. + * Default is false. + * +optional + */ + tty?: boolean | undefined; +} + +/** + * ContainerExtendedResourceRequest has the mapping of container name, + * extended resource name to the device request name. + */ +export interface ContainerExtendedResourceRequest { + /** The name of the container requesting resources. */ + containerName?: string | undefined; + /** The name of the extended resource in that container which gets backed by DRA. */ + resourceName?: string | undefined; + /** The name of the request in the special ResourceClaim which corresponds to the extended resource. */ + requestName?: string | undefined; +} + +/** Describe a container image */ +export interface ContainerImage { + /** + * Names by which this image is known. + * e.g. ["kubernetes.example/hyperkube:v1.0.7", "cloud-vendor.registry.example/cloud-vendor/hyperkube:v1.0.7"] + * +optional + * +listType=atomic + */ + names: string[]; + /** + * The size of the image in bytes. + * +optional + */ + sizeBytes?: number | undefined; +} + +/** ContainerPort represents a network port in a single container. */ +export interface ContainerPort { + /** + * If specified, this must be an IANA_SVC_NAME and unique within the pod. Each + * named port in a pod must have a unique name. Name for the port that can be + * referred to by services. + * +optional + */ + name?: string | undefined; + /** + * Number of port to expose on the host. + * If specified, this must be a valid port number, 0 < x < 65536. + * If HostNetwork is specified, this must match ContainerPort. + * Most containers do not need this. + * +optional + */ + hostPort?: number | undefined; + /** + * Number of port to expose on the pod's IP address. + * This must be a valid port number, 0 < x < 65536. + */ + containerPort?: number | undefined; + /** + * Protocol for port. Must be UDP, TCP, or SCTP. + * Defaults to "TCP". + * +optional + * +default="TCP" + */ + protocol?: string | undefined; + /** + * What host IP to bind the external port to. + * +optional + */ + hostIP?: string | undefined; +} + +/** ContainerResizePolicy represents resource resize policy for the container. */ +export interface ContainerResizePolicy { + /** + * Name of the resource to which this resource resize policy applies. + * Supported values: cpu, memory. + */ + resourceName?: string | undefined; + /** + * Restart policy to apply when specified resource is resized. + * If not specified, it defaults to NotRequired. + */ + restartPolicy?: string | undefined; +} + +/** ContainerRestartRule describes how a container exit is handled. */ +export interface ContainerRestartRule { + /** + * Specifies the action taken on a container exit if the requirements + * are satisfied. The only possible value is "Restart" to restart the + * container. + * +required + */ + action?: string | undefined; + /** + * Represents the exit codes to check on container exits. + * +optional + * +oneOf=when + */ + exitCodes?: ContainerRestartRuleOnExitCodes | undefined; +} + +/** + * ContainerRestartRuleOnExitCodes describes the condition + * for handling an exited container based on its exit codes. + */ +export interface ContainerRestartRuleOnExitCodes { + /** + * Represents the relationship between the container exit code(s) and the + * specified values. Possible values are: + * - In: the requirement is satisfied if the container exit code is in the + * set of specified values. + * - NotIn: the requirement is satisfied if the container exit code is + * not in the set of specified values. + * +required + */ + operator?: string | undefined; + /** + * Specifies the set of values to check for container exit codes. + * At most 255 elements are allowed. + * +optional + * +listType=set + */ + values: number[]; +} + +/** + * ContainerState holds a possible state of container. + * Only one of its members may be specified. + * If none of them is specified, the default one is ContainerStateWaiting. + */ +export interface ContainerState { + /** + * Details about a waiting container + * +optional + */ + waiting?: ContainerStateWaiting | undefined; + /** + * Details about a running container + * +optional + */ + running?: ContainerStateRunning | undefined; + /** + * Details about a terminated container + * +optional + */ + terminated?: ContainerStateTerminated | undefined; +} + +/** ContainerStateRunning is a running state of a container. */ +export interface ContainerStateRunning { + /** + * Time at which the container was last (re-)started + * +optional + */ + startedAt?: Time | undefined; +} + +/** ContainerStateTerminated is a terminated state of a container. */ +export interface ContainerStateTerminated { + /** Exit status from the last termination of the container */ + exitCode?: number | undefined; + /** + * Signal from the last termination of the container + * +optional + */ + signal?: number | undefined; + /** + * (brief) reason from the last termination of the container + * +optional + */ + reason?: string | undefined; + /** + * Message regarding the last termination of the container + * +optional + */ + message?: string | undefined; + /** + * Time at which previous execution of the container started + * +optional + */ + startedAt?: Time | undefined; + /** + * Time at which the container last terminated + * +optional + */ + finishedAt?: Time | undefined; + /** + * Container's ID in the format '://' + * +optional + */ + containerID?: string | undefined; +} + +/** ContainerStateWaiting is a waiting state of a container. */ +export interface ContainerStateWaiting { + /** + * (brief) reason the container is not yet running. + * +optional + */ + reason?: string | undefined; + /** + * Message regarding why the container is not yet running. + * +optional + */ + message?: string | undefined; +} + +/** ContainerStatus contains details for the current status of this container. */ +export interface ContainerStatus { + /** + * Name is a DNS_LABEL representing the unique name of the container. + * Each container in a pod must have a unique name across all container types. + * Cannot be updated. + */ + name?: string | undefined; + /** + * State holds details about the container's current condition. + * +optional + */ + state?: ContainerState | undefined; + /** + * LastTerminationState holds the last termination state of the container to + * help debug container crashes and restarts. This field is not + * populated if the container is still running and RestartCount is 0. + * +optional + */ + lastState?: ContainerState | undefined; + /** + * Ready specifies whether the container is currently passing its readiness check. + * The value will change as readiness probes keep executing. If no readiness + * probes are specified, this field defaults to true once the container is + * fully started (see Started field). + * + * The value is typically used to determine whether a container is ready to + * accept traffic. + */ + ready?: boolean | undefined; + /** + * RestartCount holds the number of times the container has been restarted. + * Kubelet makes an effort to always increment the value, but there + * are cases when the state may be lost due to node restarts and then the value + * may be reset to 0. The value is never negative. + */ + restartCount?: number | undefined; + /** + * Image is the name of container image that the container is running. + * The container image may not match the image used in the PodSpec, + * as it may have been resolved by the runtime. + * More info: https://kubernetes.io/docs/concepts/containers/images. + */ + image?: string | undefined; + /** + * ImageID is the image ID of the container's image. The image ID may not + * match the image ID of the image used in the PodSpec, as it may have been + * resolved by the runtime. + */ + imageID?: string | undefined; + /** + * ContainerID is the ID of the container in the format '://'. + * Where type is a container runtime identifier, returned from Version call of CRI API + * (for example "containerd"). + * +optional + */ + containerID?: string | undefined; + /** + * Started indicates whether the container has finished its postStart lifecycle hook + * and passed its startup probe. + * Initialized as false, becomes true after startupProbe is considered + * successful. Resets to false when the container is restarted, or if kubelet + * loses state temporarily. In both cases, startup probes will run again. + * Is always true when no startupProbe is defined and container is running and + * has passed the postStart lifecycle hook. The null value must be treated the + * same as false. + * +optional + */ + started?: boolean | undefined; + /** + * AllocatedResources represents the compute resources allocated for this container by the + * node. Kubelet sets this value to Container.Resources.Requests upon successful pod admission + * and after successfully admitting desired pod resize. + * +optional + */ + allocatedResources: { [key: string]: Quantity }; + /** + * Resources represents the compute resource requests and limits that have been successfully + * enacted on the running container after it has been started or has been successfully resized. + * +featureGate=InPlacePodVerticalScaling + * +optional + */ + resources?: ResourceRequirements | undefined; + /** + * Status of volume mounts. + * +optional + * +patchMergeKey=mountPath + * +patchStrategy=merge + * +listType=map + * +listMapKey=mountPath + */ + volumeMounts: VolumeMountStatus[]; + /** + * User represents user identity information initially attached to the first process of the container + * +featureGate=SupplementalGroupsPolicy + * +optional + */ + user?: ContainerUser | undefined; + /** + * AllocatedResourcesStatus represents the status of various resources + * allocated for this Pod. + * +featureGate=ResourceHealthStatus + * +optional + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + */ + allocatedResourcesStatus: ResourceStatus[]; + /** + * StopSignal reports the effective stop signal for this container + * +featureGate=ContainerStopSignals + * +optional + */ + stopSignal?: string | undefined; +} + +export interface ContainerStatus_AllocatedResourcesEntry { + key: string; + value: Quantity | undefined; +} + +/** ContainerUser represents user identity information */ +export interface ContainerUser { + /** + * Linux holds user identity information initially attached to the first process of the containers in Linux. + * Note that the actual running identity can be changed if the process has enough privilege to do so. + * +optional + */ + linux?: LinuxContainerUser | undefined; +} + +/** DaemonEndpoint contains information about a single Daemon endpoint. */ +export interface DaemonEndpoint { + /** Port number of the given endpoint. */ + Port?: number | undefined; +} + +/** + * Represents downward API info for projecting into a projected volume. + * Note that this is identical to a downwardAPI volume source without the default + * mode. + */ +export interface DownwardAPIProjection { + /** + * Items is a list of DownwardAPIVolume file + * +optional + * +listType=atomic + */ + items: DownwardAPIVolumeFile[]; +} + +/** DownwardAPIVolumeFile represents information to create the file containing the pod field */ +export interface DownwardAPIVolumeFile { + /** Required: Path is the relative path name of the file to be created. Must not be absolute or contain the '..' path. Must be utf-8 encoded. The first item of the relative path must not start with '..' */ + path?: string | undefined; + /** + * Required: Selects a field of the pod: only annotations, labels, name, namespace and uid are supported. + * +optional + */ + fieldRef?: ObjectFieldSelector | undefined; + /** + * Selects a resource of the container: only resources limits and requests + * (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + * +optional + */ + resourceFieldRef?: ResourceFieldSelector | undefined; + /** + * Optional: mode bits used to set permissions on this file, must be an octal value + * between 0000 and 0777 or a decimal value between 0 and 511. + * YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + * If not specified, the volume defaultMode will be used. + * This might be in conflict with other options that affect the file + * mode, like fsGroup, and the result can be other mode bits set. + * +optional + */ + mode?: number | undefined; + /** + * user is Optional: The owner UID of the created file. + * If specified, the item-level user field takes precedence over defaultUser. + * (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + * +featureGate=AtomicWriteVolumeUserFields + * +optional + */ + user?: number | undefined; +} + +/** + * DownwardAPIVolumeSource represents a volume containing downward API info. + * Downward API volumes support ownership management and SELinux relabeling. + */ +export interface DownwardAPIVolumeSource { + /** + * Items is a list of downward API volume file + * +optional + * +listType=atomic + */ + items: DownwardAPIVolumeFile[]; + /** + * Optional: mode bits to use on created files by default. Must be a + * Optional: mode bits used to set permissions on created files by default. + * Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + * YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + * Defaults to 0644. + * Directories within the path are not affected by this setting. + * This might be in conflict with other options that affect the file + * mode, like fsGroup, and the result can be other mode bits set. + * +optional + */ + defaultMode?: number | undefined; + /** + * defaultUser is Optional: The owner UID of the created files by default. + * The defaultUser field is only used as a fallback when the item-level user field is unset. + * (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + * +featureGate=AtomicWriteVolumeUserFields + * +optional + */ + defaultUser?: number | undefined; +} + +/** + * Represents an empty directory for a pod. + * Empty directory volumes support ownership management and SELinux relabeling. + */ +export interface EmptyDirVolumeSource { + /** + * medium represents what type of storage medium should back this directory. + * The default is "" which means to use the node's default medium. + * Must be an empty string (default) or Memory. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + * +optional + */ + medium?: string | undefined; + /** + * sizeLimit is the total amount of local storage required for this EmptyDir volume. + * The size limit is also applicable for memory medium. + * The maximum usage on memory medium EmptyDir would be the minimum value between + * the SizeLimit specified here and the sum of memory limits of all containers in a pod. + * The default is nil which means that the limit is undefined. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + * +optional + */ + sizeLimit?: Quantity | undefined; + /** + * mode specifies the permission bits for the emptyDir directory, in numeric + * notation (e.g., 0755, 01777). Must be a value between 0000 and 01777. + * If not specified, defaults to 0777. + * This might be in conflict with other options that affect the file + * mode, like fsGroup. If fsGroup is specified, the fsGroup permissions + * will override the mode specified here. + * This field has no effect on Windows. + * This field is alpha and requires EmptyDirVolumeMode featuregate to be enabled. + * +featureGate=EmptyDirVolumeMode + * +optional + */ + mode?: number | undefined; +} + +/** + * EndpointAddress is a tuple that describes single IP address. + * Deprecated: This API is deprecated in v1.33+. + * +structType=atomic + */ +export interface EndpointAddress { + /** + * The IP of this endpoint. + * May not be loopback (127.0.0.0/8 or ::1), link-local (169.254.0.0/16 or fe80::/10), + * or link-local multicast (224.0.0.0/24 or ff02::/16). + */ + ip?: string | undefined; + /** + * The Hostname of this endpoint + * +optional + */ + hostname?: string | undefined; + /** + * Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node. + * +optional + */ + nodeName?: string | undefined; + /** + * Reference to object providing the endpoint. + * +optional + */ + targetRef?: ObjectReference | undefined; +} + +/** + * EndpointPort is a tuple that describes a single port. + * Deprecated: This API is deprecated in v1.33+. + * +structType=atomic + */ +export interface EndpointPort { + /** + * The name of this port. This must match the 'name' field in the + * corresponding ServicePort. + * Must be a DNS_LABEL. + * Optional only if one port is defined. + * +optional + */ + name?: string | undefined; + /** The port number of the endpoint. */ + port?: number | undefined; + /** + * The IP protocol for this port. + * Must be UDP, TCP, or SCTP. + * Default is TCP. + * +optional + */ + protocol?: string | undefined; + /** + * The application protocol for this port. + * This is used as a hint for implementations to offer richer behavior for protocols that they understand. + * This field follows standard Kubernetes label syntax. + * Valid values are either: + * + * * Un-prefixed protocol names - reserved for IANA standard service names (as per + * RFC-6335 and https://www.iana.org/assignments/service-names). + * + * * Kubernetes-defined prefixed names: + * * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- + * * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 + * * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 + * + * * Other protocols should use implementation-defined prefixed names such as + * mycompany.com/my-custom-protocol. + * +optional + */ + appProtocol?: string | undefined; +} + +/** + * EndpointSubset is a group of addresses with a common set of ports. The + * expanded set of endpoints is the Cartesian product of Addresses x Ports. + * For example, given: + * + * { + * Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], + * Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] + * } + * + * The resulting set of endpoints can be viewed as: + * + * a: [ 10.10.1.1:8675, 10.10.2.2:8675 ], + * b: [ 10.10.1.1:309, 10.10.2.2:309 ] + * + * Deprecated: This API is deprecated in v1.33+. + */ +export interface EndpointSubset { + /** + * IP addresses which offer the related ports that are marked as ready. These endpoints + * should be considered safe for load balancers and clients to utilize. + * +optional + * +listType=atomic + */ + addresses: EndpointAddress[]; + /** + * IP addresses which offer the related ports but are not currently marked as ready + * because they have not yet finished starting, have recently failed a readiness check, + * or have recently failed a liveness check. + * +optional + * +listType=atomic + */ + notReadyAddresses: EndpointAddress[]; + /** + * Port numbers available on the related IP addresses. + * +optional + * +listType=atomic + */ + ports: EndpointPort[]; +} + +/** + * Endpoints is a collection of endpoints that implement the actual service. Example: + * + * Name: "mysvc", + * Subsets: [ + * { + * Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], + * Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] + * }, + * { + * Addresses: [{"ip": "10.10.3.3"}], + * Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}] + * }, + * ] + * + * Endpoints is a legacy API and does not contain information about all Service features. + * Use discoveryv1.EndpointSlice for complete information about Service endpoints. + * + * Deprecated: This API is deprecated in v1.33+. Use discoveryv1.EndpointSlice. + */ +export interface Endpoints { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * The set of all endpoints is the union of all subsets. Addresses are placed into + * subsets according to the IPs they share. A single address with multiple ports, + * some of which are ready and some of which are not (because they come from + * different containers) will result in the address being displayed in different + * subsets for the different ports. No address will appear in both Addresses and + * NotReadyAddresses in the same subset. + * Sets of addresses and ports that comprise a service. + * +optional + * +listType=atomic + */ + subsets: EndpointSubset[]; +} + +/** + * EndpointsList is a list of endpoints. + * Deprecated: This API is deprecated in v1.33+. + */ +export interface EndpointsList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of endpoints. */ + items: Endpoints[]; +} + +/** EnvFromSource represents the source of a set of ConfigMaps or Secrets */ +export interface EnvFromSource { + /** + * Optional text to prepend to the name of each environment variable. + * May consist of any printable ASCII characters except '='. + * +optional + */ + prefix?: string | undefined; + /** + * The ConfigMap to select from + * +optional + */ + configMapRef?: ConfigMapEnvSource | undefined; + /** + * The Secret to select from + * +optional + */ + secretRef?: SecretEnvSource | undefined; +} + +/** EnvVar represents an environment variable present in a Container. */ +export interface EnvVar { + /** + * Name of the environment variable. + * May consist of any printable ASCII characters except '='. + */ + name?: string | undefined; + /** + * Variable references $(VAR_NAME) are expanded + * using the previously defined environment variables in the container and + * any service environment variables. If a variable cannot be resolved, + * the reference in the input string will be unchanged. Double $$ are reduced + * to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. + * "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + * Escaped references will never be expanded, regardless of whether the variable + * exists or not. + * Defaults to "". + * +optional + */ + value?: string | undefined; + /** + * Source for the environment variable's value. Cannot be used if value is not empty. + * +optional + */ + valueFrom?: EnvVarSource | undefined; +} + +/** EnvVarSource represents a source for the value of an EnvVar. */ +export interface EnvVarSource { + /** + * Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, + * spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. + * +optional + */ + fieldRef?: ObjectFieldSelector | undefined; + /** + * Selects a resource of the container: only resources limits and requests + * (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. + * +optional + */ + resourceFieldRef?: ResourceFieldSelector | undefined; + /** + * Selects a key of a ConfigMap. + * +optional + */ + configMapKeyRef?: ConfigMapKeySelector | undefined; + /** + * Selects a key of a secret in the pod's namespace + * +optional + */ + secretKeyRef?: SecretKeySelector | undefined; + /** + * FileKeyRef selects a key of the env file. + * Requires the EnvFiles feature gate to be enabled. + * + * +featureGate=EnvFiles + * +optional + */ + fileKeyRef?: FileKeySelector | undefined; +} + +/** + * An EphemeralContainer is a temporary container that you may add to an existing Pod for + * user-initiated activities such as debugging. Ephemeral containers have no resource or + * scheduling guarantees, and they will not be restarted when they exit or when a Pod is + * removed or restarted. The kubelet may evict a Pod if an ephemeral container causes the + * Pod to exceed its resource allocation. + * + * To add an ephemeral container, use the ephemeralcontainers subresource of an existing + * Pod. Ephemeral containers may not be removed or restarted. + */ +export interface EphemeralContainer { + /** + * Ephemeral containers have all of the fields of Container, plus additional fields + * specific to ephemeral containers. Fields in common with Container are in the + * following inlined struct so than an EphemeralContainer may easily be converted + * to a Container. + */ + ephemeralContainerCommon?: EphemeralContainerCommon | undefined; + /** + * If set, the name of the container from PodSpec that this ephemeral container targets. + * The ephemeral container will be run in the namespaces (IPC, PID, etc) of this container. + * If not set then the ephemeral container uses the namespaces configured in the Pod spec. + * + * The container runtime must implement support for this feature. If the runtime does not + * support namespace targeting then the result of setting this field is undefined. + * +optional + */ + targetContainerName?: string | undefined; +} + +/** + * EphemeralContainerCommon is a copy of all fields in Container to be inlined in + * EphemeralContainer. This separate type allows easy conversion from EphemeralContainer + * to Container and allows separate documentation for the fields of EphemeralContainer. + * When a new field is added to Container it must be added here as well. + */ +export interface EphemeralContainerCommon { + /** + * Name of the ephemeral container specified as a DNS_LABEL. + * This name must be unique among all containers, init containers and ephemeral containers. + */ + name?: string | undefined; + /** + * Container image name. + * More info: https://kubernetes.io/docs/concepts/containers/images + */ + image?: string | undefined; + /** + * Entrypoint array. Not executed within a shell. + * The image's ENTRYPOINT is used if this is not provided. + * Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + * cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + * to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + * produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + * of whether the variable exists or not. Cannot be updated. + * More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + * +optional + * +listType=atomic + */ + command: string[]; + /** + * Arguments to the entrypoint. + * The image's CMD is used if this is not provided. + * Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + * cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + * to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + * produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + * of whether the variable exists or not. Cannot be updated. + * More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + * +optional + * +listType=atomic + */ + args: string[]; + /** + * Container's working directory. + * If not specified, the container runtime's default will be used, which + * might be configured in the container image. + * Cannot be updated. + * +optional + */ + workingDir?: string | undefined; + /** + * Ports are not allowed for ephemeral containers. + * +optional + * +patchMergeKey=containerPort + * +patchStrategy=merge + * +listType=map + * +listMapKey=containerPort + * +listMapKey=protocol + */ + ports: ContainerPort[]; + /** + * List of sources to populate environment variables in the container. + * The keys defined within a source may consist of any printable ASCII characters except '='. + * When a key exists in multiple + * sources, the value associated with the last source will take precedence. + * Values defined by an Env with a duplicate key will take precedence. + * Cannot be updated. + * +optional + * +listType=atomic + */ + envFrom: EnvFromSource[]; + /** + * List of environment variables to set in the container. + * Cannot be updated. + * +optional + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + */ + env: EnvVar[]; + /** + * Resources are not allowed for ephemeral containers. Ephemeral containers use spare resources + * already allocated to the pod. + * +optional + */ + resources?: ResourceRequirements | undefined; + /** + * Resources resize policy for the container. + * +featureGate=InPlacePodVerticalScaling + * +optional + * +listType=atomic + */ + resizePolicy: ContainerResizePolicy[]; + /** + * Restart policy for the container to manage the restart behavior of each + * container within a pod. + * You cannot set this field on ephemeral containers. + * +optional + */ + restartPolicy?: string | undefined; + /** + * Represents a list of rules to be checked to determine if the + * container should be restarted on exit. You cannot set this field on + * ephemeral containers. + * +featureGate=ContainerRestartRules + * +optional + * +listType=atomic + */ + restartPolicyRules: ContainerRestartRule[]; + /** + * Pod volumes to mount into the container's filesystem. Subpath mounts are not allowed for ephemeral containers. + * Cannot be updated. + * +optional + * +patchMergeKey=mountPath + * +patchStrategy=merge + * +listType=map + * +listMapKey=mountPath + */ + volumeMounts: VolumeMount[]; + /** + * volumeDevices is the list of block devices to be used by the container. + * +patchMergeKey=devicePath + * +patchStrategy=merge + * +listType=map + * +listMapKey=devicePath + * +optional + */ + volumeDevices: VolumeDevice[]; + /** + * Probes are not allowed for ephemeral containers. + * +optional + */ + livenessProbe?: Probe | undefined; + /** + * Probes are not allowed for ephemeral containers. + * +optional + */ + readinessProbe?: Probe | undefined; + /** + * Probes are not allowed for ephemeral containers. + * +optional + */ + startupProbe?: Probe | undefined; + /** + * Lifecycle is not allowed for ephemeral containers. + * +optional + */ + lifecycle?: Lifecycle | undefined; + /** + * Optional: Path at which the file to which the container's termination message + * will be written is mounted into the container's filesystem. + * Message written is intended to be brief final status, such as an assertion failure message. + * Will be truncated by the node if greater than 4096 bytes. The total message length across + * all containers will be limited to 12kb. + * Defaults to /dev/termination-log. + * Cannot be updated. + * +optional + */ + terminationMessagePath?: string | undefined; + /** + * Indicate how the termination message should be populated. File will use the contents of + * terminationMessagePath to populate the container status message on both success and failure. + * FallbackToLogsOnError will use the last chunk of container log output if the termination + * message file is empty and the container exited with an error. + * The log output is limited to 2048 bytes or 80 lines, whichever is smaller. + * Defaults to File. + * Cannot be updated. + * +optional + */ + terminationMessagePolicy?: string | undefined; + /** + * Image pull policy. + * One of Always, Never, IfNotPresent. + * Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + * Cannot be updated. + * More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + * +optional + */ + imagePullPolicy?: string | undefined; + /** + * Optional: SecurityContext defines the security options the ephemeral container should be run with. + * If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. + * +optional + */ + securityContext?: SecurityContext | undefined; + /** + * Whether this container should allocate a buffer for stdin in the container runtime. If this + * is not set, reads from stdin in the container will always result in EOF. + * Default is false. + * +optional + */ + stdin?: boolean | undefined; + /** + * Whether the container runtime should close the stdin channel after it has been opened by + * a single attach. When stdin is true the stdin stream will remain open across multiple attach + * sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the + * first client attaches to stdin, and then remains open and accepts data until the client disconnects, + * at which time stdin is closed and remains closed until the container is restarted. If this + * flag is false, a container processes that reads from stdin will never receive an EOF. + * Default is false + * +optional + */ + stdinOnce?: boolean | undefined; + /** + * Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. + * Default is false. + * +optional + */ + tty?: boolean | undefined; +} + +/** Represents an ephemeral volume that is handled by a normal storage driver. */ +export interface EphemeralVolumeSource { + /** + * Will be used to create a stand-alone PVC to provision the volume. + * The pod in which this EphemeralVolumeSource is embedded will be the + * owner of the PVC, i.e. the PVC will be deleted together with the + * pod. The name of the PVC will be `-` where + * `` is the name from the `PodSpec.Volumes` array + * entry. Pod validation will reject the pod if the concatenated name + * is not valid for a PVC (for example, too long). + * + * An existing PVC with that name that is not owned by the pod + * will *not* be used for the pod to avoid using an unrelated + * volume by mistake. Starting the pod is then blocked until + * the unrelated PVC is removed. If such a pre-created PVC is + * meant to be used by the pod, the PVC has to updated with an + * owner reference to the pod once the pod exists. Normally + * this should not be necessary, but it may be useful when + * manually reconstructing a broken cluster. + * + * This field is read-only and no changes will be made by Kubernetes + * to the PVC after it has been created. + * + * Required, must not be nil. + */ + volumeClaimTemplate?: PersistentVolumeClaimTemplate | undefined; +} + +/** + * 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 { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + */ + metadata?: ObjectMeta | undefined; + /** The object that this event is about. */ + involvedObject?: ObjectReference | undefined; + /** + * This should be a short, machine understandable string that gives the reason + * for the transition into the object's current status. + * TODO: provide exact specification for format. + * +optional + */ + reason?: string | undefined; + /** + * A human-readable description of the status of this operation. + * TODO: decide on maximum length. + * +optional + */ + message?: string | undefined; + /** + * The component reporting this event. Should be a short machine understandable string. + * +optional + */ + source?: EventSource | undefined; + /** + * The time at which the event was first recorded. (Time of server receipt is in TypeMeta.) + * +optional + */ + firstTimestamp?: Time | undefined; + /** + * The time at which the most recent occurrence of this event was recorded. + * +optional + */ + lastTimestamp?: Time | undefined; + /** + * The number of times this event has occurred. + * +optional + */ + count?: number | undefined; + /** + * Type of this event (Normal, Warning), new types could be added in the future + * +optional + */ + type?: string | undefined; + /** + * Time when this Event was first observed. + * +optional + */ + eventTime?: MicroTime | undefined; + /** + * Data about the Event series this event represents or nil if it's a singleton Event. + * +optional + */ + series?: EventSeries | undefined; + /** + * What action was taken/failed regarding to the Regarding object. + * +optional + */ + action?: string | undefined; + /** + * Optional secondary object for more complex actions. + * +optional + */ + related?: ObjectReference | undefined; + /** + * Name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`. + * +optional + */ + reportingComponent?: string | undefined; + /** + * ID of the controller instance, e.g. `kubelet-xyzf`. + * +optional + */ + reportingInstance?: string | undefined; +} + +/** EventList is a list of events. */ +export interface EventList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of events */ + items: Event[]; +} + +/** + * EventSeries contain information on series of events, i.e. thing that was/is happening + * continuously for some time. + */ +export interface EventSeries { + /** Number of occurrences in this series up to the last heartbeat time */ + count?: number | undefined; + /** Time of the last occurrence observed */ + lastObservedTime?: MicroTime | undefined; +} + +/** EventSource contains information for an event. */ +export interface EventSource { + /** + * Component from which the event is generated. + * +optional + */ + component?: string | undefined; + /** + * Node name on which the event is generated. + * +optional + */ + host?: string | undefined; +} + +/** + * EvictionResponder allows you to specify the responder reacting to an Eviction. + * Responders should observe and communicate through the Eviction Resource API to help with + * the graceful eviction of a target (e.g. termination of a pod). + * +structType=atomic + */ +export interface EvictionResponder { + /** + * name allows you to identify the responder responding to the Eviction. + * + * It must be a valid domain-prefixed key (such as "acme.io/foo"). + * Domain names *.k8s.io and *.kubernetes.io are reserved. + * This field must be unique for each responder. + * This field is required. + * +required + * +k8s:required + * +k8s:format=k8s-prefixed-label-key + * +k8s:customValidation + */ + name?: string | undefined; + /** + * priority for this responder. Higher priorities are selected first by the evictionrequest-controller. + * If there are responders with the same priority, the responder whose domain name comes first in the + * alphabetical higher domain order, will be picked. This means that the top domain labels are compared + * alphabetically first, followed by the lower domain labels. The key is compared last. + * + * The responder that is the managing controller of the pod should set the value of + * this field to 10000 to allow both for preemption or fallback registration by other + * responders. + * + * The minimum value is 0 and the maximum value is 100000. + * The interval 0-999 is reserved for responders with *.k8s.io suffix. + * This field is required. + * +required + * +k8s:required + * +k8s:minimum=0 + * +k8s:maximum=100000 + * +k8s:customValidation + */ + priority?: number | undefined; +} + +/** ExecAction describes a "run in container" action. */ +export interface ExecAction { + /** + * Command is the command line to execute inside the container, the working directory for the + * command is root ('/') in the container's filesystem. The command is simply exec'd, it is + * not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + * a shell, you need to explicitly call out to that shell. + * Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + * +optional + * +listType=atomic + */ + command: string[]; +} + +/** + * Represents a Fibre Channel volume. + * Fibre Channel volumes can only be mounted as read/write once. + * Fibre Channel volumes support ownership management and SELinux relabeling. + */ +export interface FCVolumeSource { + /** + * targetWWNs is Optional: FC target worldwide names (WWNs) + * +optional + * +listType=atomic + */ + targetWWNs: string[]; + /** + * lun is Optional: FC target lun number + * +optional + */ + lun?: number | undefined; + /** + * fsType is the filesystem type to mount. + * Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * TODO: how do we prevent errors in the filesystem from compromising the machine + * +optional + */ + fsType?: string | undefined; + /** + * readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * +optional + */ + readOnly?: boolean | undefined; + /** + * wwids Optional: FC volume world wide identifiers (wwids) + * Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. + * +optional + * +listType=atomic + */ + wwids: string[]; +} + +/** + * FileKeySelector selects a key of the env file. + * +structType=atomic + */ +export interface FileKeySelector { + /** + * The name of the volume mount containing the env file. + * +required + */ + volumeName?: string | undefined; + /** + * The path within the volume from which to select the file. + * Must be relative and may not contain the '..' path or start with '..'. + * +required + */ + path?: string | undefined; + /** + * The key within the env file. An invalid key will prevent the pod from starting. + * The keys defined within a source may consist of any printable ASCII characters except '='. + * During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters. + * +required + */ + key?: string | undefined; + /** + * Specify whether the file or its key must be defined. If the file or key + * does not exist, then the env var is not published. + * If optional is set to true and the specified key does not exist, + * the environment variable will not be set in the Pod's containers. + * + * If optional is set to false and the specified key does not exist, + * an error will be returned during Pod creation. + * +optional + * +default=false + */ + optional?: boolean | undefined; +} + +/** + * FlexPersistentVolumeSource represents a generic persistent volume resource that is + * provisioned/attached using an exec based plugin. + */ +export interface FlexPersistentVolumeSource { + /** driver is the name of the driver to use for this volume. */ + driver?: string | undefined; + /** + * fsType is the Filesystem type to mount. + * Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + * +optional + */ + fsType?: string | undefined; + /** + * secretRef is Optional: SecretRef is reference to the secret object containing + * sensitive information to pass to the plugin scripts. This may be + * empty if no secret object is specified. If the secret object + * contains more than one secret, all secrets are passed to the plugin + * scripts. + * +optional + */ + secretRef?: SecretReference | undefined; + /** + * readOnly is Optional: defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * +optional + */ + readOnly?: boolean | undefined; + /** + * options is Optional: this field holds extra command options if any. + * +optional + */ + options: { [key: string]: string }; +} + +export interface FlexPersistentVolumeSource_OptionsEntry { + key: string; + value: string; +} + +/** + * FlexVolume represents a generic volume resource that is + * provisioned/attached using an exec based plugin. + */ +export interface FlexVolumeSource { + /** driver is the name of the driver to use for this volume. */ + driver?: string | undefined; + /** + * fsType is the filesystem type to mount. + * Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + * +optional + */ + fsType?: string | undefined; + /** + * secretRef is Optional: secretRef is reference to the secret object containing + * sensitive information to pass to the plugin scripts. This may be + * empty if no secret object is specified. If the secret object + * contains more than one secret, all secrets are passed to the plugin + * scripts. + * +optional + */ + secretRef?: LocalObjectReference | undefined; + /** + * readOnly is Optional: defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * +optional + */ + readOnly?: boolean | undefined; + /** + * options is Optional: this field holds extra command options if any. + * +optional + */ + options: { [key: string]: string }; +} + +export interface FlexVolumeSource_OptionsEntry { + key: string; + value: string; +} + +/** + * Represents a Flocker volume mounted by the Flocker agent. + * One and only one of datasetName and datasetUUID should be set. + * Flocker volumes do not support ownership management or SELinux relabeling. + */ +export interface FlockerVolumeSource { + /** + * datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker + * should be considered as deprecated + * +optional + */ + datasetName?: string | undefined; + /** + * datasetUUID is the UUID of the dataset. This is unique identifier of a Flocker dataset + * +optional + */ + datasetUUID?: string | undefined; +} + +/** + * Represents a Persistent Disk resource in Google Compute Engine. + * + * A GCE PD must exist before mounting to a container. The disk must + * also be in the same GCE project and zone as the kubelet. A GCE PD + * can only be mounted as read/write once or read-only many times. GCE + * PDs support ownership management and SELinux relabeling. + */ +export interface GCEPersistentDiskVolumeSource { + /** + * pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + */ + pdName?: string | undefined; + /** + * fsType is filesystem type of the volume that you want to mount. + * Tip: Ensure that the filesystem type is supported by the host operating system. + * Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + * TODO: how do we prevent errors in the filesystem from compromising the machine + * +optional + */ + fsType?: string | undefined; + /** + * partition is the partition in the volume that you want to mount. + * If omitted, the default is to mount by volume name. + * Examples: For volume /dev/sda1, you specify the partition as "1". + * Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + * More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + * +optional + */ + partition?: number | undefined; + /** + * readOnly here will force the ReadOnly setting in VolumeMounts. + * Defaults to false. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + * +optional + */ + readOnly?: boolean | undefined; +} + +/** GRPCAction specifies an action involving a GRPC service. */ +export interface GRPCAction { + /** Port number of the gRPC service. Number must be in the range 1 to 65535. */ + port?: number | undefined; + /** + * Service is the name of the service to place in the gRPC HealthCheckRequest + * (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + * + * If this is not specified, the default behavior is defined by gRPC. + * +optional + * +default="" + */ + service?: string | undefined; + /** + * mode specifies the connection mode for the gRPC health probe. + * Set to "TLS" to use TLS without certificate verification. + * Set to "Plaintext" to use a plaintext (insecure) connection explicitly. + * If not specified, the probe uses a plaintext (insecure) connection. + * +featureGate=GRPCContainerProbeTLS + * +optional + */ + mode?: string | undefined; +} + +/** + * Represents a volume that is populated with the contents of a git repository. + * Git repo volumes do not support ownership management. + * Git repo volumes support SELinux relabeling. + * + * DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an + * EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir + * into the Pod's container. + */ +export interface GitRepoVolumeSource { + /** repository is the URL */ + repository?: string | undefined; + /** + * revision is the commit hash for the specified revision. + * +optional + */ + revision?: string | undefined; + /** + * directory is the target directory name. + * Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + * git repository. Otherwise, if specified, the volume will contain the git repository in + * the subdirectory with the given name. + * +optional + */ + directory?: string | undefined; +} + +/** + * Represents a Glusterfs mount that lasts the lifetime of a pod. + * Glusterfs volumes do not support ownership management or SELinux relabeling. + */ +export interface GlusterfsPersistentVolumeSource { + /** + * endpoints is the endpoint name that details Glusterfs topology. + * More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + */ + endpoints?: string | undefined; + /** + * path is the Glusterfs volume path. + * More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + */ + path?: string | undefined; + /** + * readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + * Defaults to false. + * More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + * +optional + */ + readOnly?: boolean | undefined; + /** + * endpointsNamespace is the namespace that contains Glusterfs endpoint. + * If this field is empty, the EndpointNamespace defaults to the same namespace as the bound PVC. + * More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + * +optional + */ + endpointsNamespace?: string | undefined; +} + +/** + * Represents a Glusterfs mount that lasts the lifetime of a pod. + * Glusterfs volumes do not support ownership management or SELinux relabeling. + */ +export interface GlusterfsVolumeSource { + /** endpoints is the endpoint name that details Glusterfs topology. */ + endpoints?: string | undefined; + /** + * path is the Glusterfs volume path. + * More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + */ + path?: string | undefined; + /** + * readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + * Defaults to false. + * More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + * +optional + */ + readOnly?: boolean | undefined; +} + +/** HTTPGetAction describes an action based on HTTP Get requests. */ +export interface HTTPGetAction { + /** + * Path to access on the HTTP server. + * +optional + */ + path?: string | undefined; + /** + * Name or number of the port to access on the container. + * Number must be in the range 1 to 65535. + * Name must be an IANA_SVC_NAME. + */ + port?: IntOrString | undefined; + /** + * Host name to connect to, defaults to the pod IP. You probably want to set + * "Host" in httpHeaders instead. + * +optional + */ + host?: string | undefined; + /** + * Scheme to use for connecting to the host. + * Defaults to HTTP. + * +optional + */ + scheme?: string | undefined; + /** + * Custom headers to set in the request. HTTP allows repeated headers. + * +optional + * +listType=atomic + */ + httpHeaders: HTTPHeader[]; + /** + * Protocol selects the wire protocol for the probe connection. + * Nil defaults to HTTP/1.1. + * +optional + * +featureGate=H2CContainerProbe + */ + protocol?: string | undefined; +} + +/** HTTPHeader describes a custom header to be used in HTTP probes */ +export interface HTTPHeader { + /** + * The header field name. + * This will be canonicalized upon output, so case-variant names will be understood as the same header. + */ + name?: string | undefined; + /** The header field value */ + value?: string | undefined; +} + +/** + * HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the + * pod's hosts file. + */ +export interface HostAlias { + /** + * IP address of the host file entry. + * +required + */ + ip?: string | undefined; + /** + * Hostnames for the above IP address. + * +listType=atomic + */ + hostnames: string[]; +} + +/** HostIP represents a single IP address allocated to the host. */ +export interface HostIP { + /** + * IP is the IP address assigned to the host + * +required + */ + ip?: string | undefined; +} + +/** + * Represents a host path mapped into a pod. + * Host path volumes do not support ownership management or SELinux relabeling. + */ +export interface HostPathVolumeSource { + /** + * path of the directory on the host. + * If the path is a symlink, it will follow the link to the real path. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + */ + path?: string | undefined; + /** + * type for HostPath Volume + * Defaults to "" + * More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + * +optional + */ + type?: string | undefined; +} + +/** + * ISCSIPersistentVolumeSource represents an ISCSI disk. + * ISCSI volumes can only be mounted as read/write once. + * ISCSI volumes support ownership management and SELinux relabeling. + */ +export interface ISCSIPersistentVolumeSource { + /** + * targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port + * is other than default (typically TCP ports 860 and 3260). + */ + targetPortal?: string | undefined; + /** iqn is Target iSCSI Qualified Name. */ + iqn?: string | undefined; + /** lun is iSCSI Target Lun number. */ + lun?: number | undefined; + /** + * iscsiInterface is the interface Name that uses an iSCSI transport. + * Defaults to 'default' (tcp). + * +optional + * +default="default" + */ + iscsiInterface?: string | undefined; + /** + * fsType is the filesystem type of the volume that you want to mount. + * Tip: Ensure that the filesystem type is supported by the host operating system. + * Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi + * TODO: how do we prevent errors in the filesystem from compromising the machine + * +optional + */ + fsType?: string | undefined; + /** + * readOnly here will force the ReadOnly setting in VolumeMounts. + * Defaults to false. + * +optional + */ + readOnly?: boolean | undefined; + /** + * portals is the iSCSI Target Portal List. The Portal is either an IP or ip_addr:port if the port + * is other than default (typically TCP ports 860 and 3260). + * +optional + * +listType=atomic + */ + portals: string[]; + /** + * chapAuthDiscovery defines whether support iSCSI Discovery CHAP authentication + * +optional + */ + chapAuthDiscovery?: boolean | undefined; + /** + * chapAuthSession defines whether support iSCSI Session CHAP authentication + * +optional + */ + chapAuthSession?: boolean | undefined; + /** + * secretRef is the CHAP Secret for iSCSI target and initiator authentication + * +optional + */ + secretRef?: SecretReference | undefined; + /** + * initiatorName is the custom iSCSI Initiator Name. + * If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface + * : will be created for the connection. + * +optional + */ + initiatorName?: string | undefined; +} + +/** + * Represents an ISCSI disk. + * ISCSI volumes can only be mounted as read/write once. + * ISCSI volumes support ownership management and SELinux relabeling. + */ +export interface ISCSIVolumeSource { + /** + * targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port + * is other than default (typically TCP ports 860 and 3260). + */ + targetPortal?: string | undefined; + /** iqn is the target iSCSI Qualified Name. */ + iqn?: string | undefined; + /** lun represents iSCSI Target Lun number. */ + lun?: number | undefined; + /** + * iscsiInterface is the interface Name that uses an iSCSI transport. + * Defaults to 'default' (tcp). + * +optional + * +default="default" + */ + iscsiInterface?: string | undefined; + /** + * fsType is the filesystem type of the volume that you want to mount. + * Tip: Ensure that the filesystem type is supported by the host operating system. + * Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi + * TODO: how do we prevent errors in the filesystem from compromising the machine + * +optional + */ + fsType?: string | undefined; + /** + * readOnly here will force the ReadOnly setting in VolumeMounts. + * Defaults to false. + * +optional + */ + readOnly?: boolean | undefined; + /** + * portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port + * is other than default (typically TCP ports 860 and 3260). + * +optional + * +listType=atomic + */ + portals: string[]; + /** + * chapAuthDiscovery defines whether support iSCSI Discovery CHAP authentication + * +optional + */ + chapAuthDiscovery?: boolean | undefined; + /** + * chapAuthSession defines whether support iSCSI Session CHAP authentication + * +optional + */ + chapAuthSession?: boolean | undefined; + /** + * secretRef is the CHAP Secret for iSCSI target and initiator authentication + * +optional + */ + secretRef?: LocalObjectReference | undefined; + /** + * initiatorName is the custom iSCSI Initiator Name. + * If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface + * : will be created for the connection. + * +optional + */ + initiatorName?: string | undefined; +} + +/** ImageVolumeSource represents a image volume resource. */ +export interface ImageVolumeSource { + /** + * Required: Image or artifact reference to be used. + * Behaves in the same way as pod.spec.containers[*].image. + * Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. + * More info: https://kubernetes.io/docs/concepts/containers/images + * This field is optional to allow higher level config management to default or override + * container images in workload controllers like Deployments and StatefulSets. + * +optional + */ + reference?: string | undefined; + /** + * Policy for pulling OCI objects. Possible values are: + * Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. + * Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. + * IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + * Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + * +optional + */ + pullPolicy?: string | undefined; +} + +/** ImageVolumeStatus represents the image-based volume status. */ +export interface ImageVolumeStatus { + /** + * ImageRef is the digest of the image used for this volume. + * It should have a value that's similar to the pod's status.containerStatuses[i].imageID. + * The ImageRef length should not exceed 256 characters. + * +kubebuilder:validation:MaxLength=256 + * +required + */ + imageRef?: string | undefined; +} + +/** Maps a string key to a path within a volume. */ +export interface KeyToPath { + /** key is the key to project. */ + key?: string | undefined; + /** + * path is the relative path of the file to map the key to. + * May not be an absolute path. + * May not contain the path element '..'. + * May not start with the string '..'. + */ + path?: string | undefined; + /** + * mode is Optional: mode bits used to set permissions on this file. + * Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + * YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + * If not specified, the volume defaultMode will be used. + * This might be in conflict with other options that affect the file + * mode, like fsGroup, and the result can be other mode bits set. + * +optional + */ + mode?: number | undefined; + /** + * user is Optional: The owner UID of the created file. + * If specified, the item-level user field takes precedence over defaultUser. + * (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + * +featureGate=AtomicWriteVolumeUserFields + * +optional + */ + user?: number | undefined; +} + +/** + * Lifecycle describes actions that the management system should take in response to container lifecycle + * events. For the PostStart and PreStop lifecycle handlers, management of the container blocks + * until the action is complete, unless the container process fails, in which case the handler is aborted. + */ +export interface Lifecycle { + /** + * PostStart is called immediately after a container is created. If the handler fails, + * the container is terminated and restarted according to its restart policy. + * Other management of the container blocks until the hook completes. + * More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks + * +optional + */ + postStart?: LifecycleHandler | undefined; + /** + * PreStop is called immediately before a container is terminated due to an + * API request or management event such as liveness/startup probe failure, + * preemption, resource contention, etc. The handler is not called if the + * container crashes or exits. The Pod's termination grace period countdown begins before the + * PreStop hook is executed. Regardless of the outcome of the handler, the + * container will eventually terminate within the Pod's termination grace + * period (unless delayed by finalizers). Other management of the container blocks until the hook completes + * or until the termination grace period is reached. + * More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks + * +optional + */ + preStop?: LifecycleHandler | undefined; + /** + * StopSignal defines which signal will be sent to a container when it is being stopped. + * If not specified, the default is defined by the container runtime in use. + * StopSignal can only be set for Pods with a non-empty .spec.os.name + * +optional + */ + stopSignal?: string | undefined; +} + +/** + * LifecycleHandler defines a specific action that should be taken in a lifecycle + * hook. One and only one of the fields, except TCPSocket must be specified. + */ +export interface LifecycleHandler { + /** + * Exec specifies a command to execute in the container. + * +optional + */ + exec?: ExecAction | undefined; + /** + * HTTPGet specifies an HTTP GET request to perform. + * +optional + */ + httpGet?: HTTPGetAction | undefined; + /** + * Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + * for backward compatibility. There is no validation of this field and + * lifecycle hooks will fail at runtime when it is specified. + * +optional + */ + tcpSocket?: TCPSocketAction | undefined; + /** + * Sleep represents a duration that the container should sleep. + * +optional + */ + sleep?: SleepAction | undefined; +} + +/** LimitRange sets resource usage limits for each kind of resource in a Namespace. */ +export interface LimitRange { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Spec defines the limits enforced. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: LimitRangeSpec | undefined; +} + +/** LimitRangeItem defines a min/max usage limit for any resource that matches on kind. */ +export interface LimitRangeItem { + /** Type of resource that this limit applies to. */ + type?: string | undefined; + /** + * Max usage constraints on this kind by resource name. + * +optional + */ + max: { [key: string]: Quantity }; + /** + * Min usage constraints on this kind by resource name. + * +optional + */ + min: { [key: string]: Quantity }; + /** + * Default resource requirement limit value by resource name if resource limit is omitted. + * +optional + */ + default: { [key: string]: Quantity }; + /** + * DefaultRequest is the default resource requirement request value by resource name if resource request is omitted. + * +optional + */ + defaultRequest: { [key: string]: Quantity }; + /** + * MaxLimitRequestRatio if specified, the named resource must have a request and limit that are both non-zero where limit divided by request is less than or equal to the enumerated value; this represents the max burst for the named resource. + * +optional + */ + maxLimitRequestRatio: { [key: string]: Quantity }; +} + +export interface LimitRangeItem_MaxEntry { + key: string; + value: Quantity | undefined; +} + +export interface LimitRangeItem_MinEntry { + key: string; + value: Quantity | undefined; +} + +export interface LimitRangeItem_DefaultEntry { + key: string; + value: Quantity | undefined; +} + +export interface LimitRangeItem_DefaultRequestEntry { + key: string; + value: Quantity | undefined; +} + +export interface LimitRangeItem_MaxLimitRequestRatioEntry { + key: string; + value: Quantity | undefined; +} + +/** LimitRangeList is a list of LimitRange items. */ +export interface LimitRangeList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** + * Items is a list of LimitRange objects. + * More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + */ + items: LimitRange[]; +} + +/** LimitRangeSpec defines a min/max usage limit for resources that match on kind. */ +export interface LimitRangeSpec { + /** + * Limits is the list of LimitRangeItem objects that are enforced. + * +listType=atomic + */ + limits: LimitRangeItem[]; +} + +/** LinuxContainerUser represents user identity information in Linux containers */ +export interface LinuxContainerUser { + /** UID is the primary uid initially attached to the first process in the container */ + uid?: number | undefined; + /** GID is the primary gid initially attached to the first process in the container */ + gid?: number | undefined; + /** + * SupplementalGroups are the supplemental groups initially attached to the first process in the container + * +optional + * +listType=atomic + */ + supplementalGroups: number[]; +} + +/** List holds a list of objects, which may not be known by the server. */ +export interface List { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of objects */ + items: RawExtension[]; +} + +/** + * LoadBalancerIngress represents the status of a load-balancer ingress point: + * traffic intended for the service should be sent to an ingress point. + */ +export interface LoadBalancerIngress { + /** + * IP is set for load-balancer ingress points that are IP based + * (typically GCE or OpenStack load-balancers) + * +optional + */ + ip?: string | undefined; + /** + * Hostname is set for load-balancer ingress points that are DNS based + * (typically AWS load-balancers) + * +optional + */ + hostname?: string | undefined; + /** + * IPMode specifies how the load-balancer IP behaves, and may only be specified when the ip field is specified. + * Setting this to "VIP" indicates that traffic is delivered to the node with + * the destination set to the load-balancer's IP and port. + * Setting this to "Proxy" indicates that traffic is delivered to the node or pod with + * the destination set to the node's IP and node port or the pod's IP and port. + * Service implementations may use this information to adjust traffic routing. + * +optional + */ + ipMode?: string | undefined; + /** + * Ports is a list of records of service ports + * If used, every port defined in the service should have an entry in it + * +listType=atomic + * +optional + */ + ports: PortStatus[]; +} + +/** LoadBalancerStatus represents the status of a load-balancer. */ +export interface LoadBalancerStatus { + /** + * Ingress is a list containing ingress points for the load-balancer. + * Traffic intended for the service should be sent to these ingress points. + * +optional + * +listType=atomic + */ + ingress: LoadBalancerIngress[]; +} + +/** + * LocalObjectReference contains enough information to let you locate the + * referenced object inside the same namespace. + * --- + * New uses of this type are discouraged because of difficulty describing its usage when embedded in APIs. + * 1. Invalid usage help. It is impossible to add specific help for individual usage. In most embedded usages, there are particular + * restrictions like, "must refer only to types A and B" or "UID not honored" or "name must be restricted". + * Those cannot be well described when embedded. + * 2. Inconsistent validation. Because the usages are different, the validation rules are different by usage, which makes it hard for users to predict what will happen. + * 3. We cannot easily change it. Because this type is embedded in many locations, updates to this type + * will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control. + * + * Instead of using this type, create a locally provided and used type that is well-focused on your reference. + * For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 . + * +structType=atomic + */ +export interface LocalObjectReference { + /** + * Name of the referent. + * This field is effectively required, but due to backwards compatibility is + * allowed to be empty. Instances of this type with an empty value here are + * almost certainly wrong. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + * +optional + * +default="" + * +kubebuilder:default="" + * TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. + */ + name?: string | undefined; +} + +/** Local represents directly-attached storage with node affinity */ +export interface LocalVolumeSource { + /** + * path of the full path to the volume on the node. + * It can be either a directory or block device (disk, partition, ...). + */ + path?: string | undefined; + /** + * fsType is the filesystem type to mount. + * It applies only when the Path is a block device. + * Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs", "ntfs". The default value is to auto-select a filesystem if unspecified. + * +optional + */ + fsType?: string | undefined; +} + +/** ModifyVolumeStatus represents the status object of ControllerModifyVolume operation */ +export interface ModifyVolumeStatus { + /** targetVolumeAttributesClassName is the name of the VolumeAttributesClass the PVC currently being reconciled */ + targetVolumeAttributesClassName?: string | undefined; + /** + * status is the status of the ControllerModifyVolume operation. It can be in any of following states: + * - Pending + * Pending indicates that the PersistentVolumeClaim cannot be modified due to unmet requirements, such as + * the specified VolumeAttributesClass not existing. + * - InProgress + * InProgress indicates that the volume is being modified. + * - Infeasible + * Infeasible indicates that the request has been rejected as invalid by the CSI driver. To + * resolve the error, a valid VolumeAttributesClass needs to be specified. + * Note: New statuses can be added in the future. Consumers should check for unknown statuses and fail appropriately. + */ + status?: string | undefined; +} + +/** + * Represents an NFS mount that lasts the lifetime of a pod. + * NFS volumes do not support ownership management or SELinux relabeling. + */ +export interface NFSVolumeSource { + /** + * server is the hostname or IP address of the NFS server. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + */ + server?: string | undefined; + /** + * path that is exported by the NFS server. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + */ + path?: string | undefined; + /** + * readOnly here will force the NFS export to be mounted with read-only permissions. + * Defaults to false. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + * +optional + */ + readOnly?: boolean | undefined; +} + +/** + * Namespace provides a scope for Names. + * Use of multiple namespaces is optional. + * +k8s:supportsSubresource="/status" + * +k8s:supportsSubresource="/finalize" + */ +export interface Namespace { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Spec defines the behavior of the Namespace. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: NamespaceSpec | undefined; + /** + * Status describes the current status of a Namespace. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: NamespaceStatus | undefined; +} + +/** NamespaceCondition contains details about state of namespace. */ +export interface NamespaceCondition { + /** Type of namespace controller condition. */ + type?: string | undefined; + /** Status of the condition, one of True, False, Unknown. */ + status?: string | undefined; + /** + * Last time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * Unique, one-word, CamelCase reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * Human-readable message indicating details about last transition. + * +optional + */ + message?: string | undefined; +} + +/** NamespaceList is a list of Namespaces. */ +export interface NamespaceList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** + * Items is the list of Namespace objects in the list. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + */ + items: Namespace[]; +} + +/** NamespaceSpec describes the attributes on a Namespace. */ +export interface NamespaceSpec { + /** + * Finalizers is an opaque list of values that must be empty to permanently remove object from storage. + * More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/ + * +optional + * +listType=atomic + */ + finalizers: string[]; +} + +/** NamespaceStatus is information about the current status of a Namespace. */ +export interface NamespaceStatus { + /** + * Phase is the current lifecycle phase of the namespace. + * More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/ + * +optional + */ + phase?: string | undefined; + /** + * Represents the latest available observations of a namespace's current state. + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: NamespaceCondition[]; +} + +/** + * Node is a worker node in Kubernetes. + * Each node will have a unique identifier in the cache (i.e. in etcd). + * +k8s:supportsSubresource="/status" + * +k8s:supportsSubresource="/proxy" + */ +export interface Node { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Spec defines the behavior of a node. + * https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: NodeSpec | undefined; + /** + * Most recently observed status of the node. + * Populated by the system. + * Read-only. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: NodeStatus | undefined; +} + +/** NodeAddress contains information for the node's address. */ +export interface NodeAddress { + /** Node address type, one of Hostname, ExternalIP or InternalIP. */ + type?: string | undefined; + /** The node address. */ + address?: string | undefined; +} + +/** Node affinity is a group of node affinity scheduling rules. */ +export interface NodeAffinity { + /** + * If the affinity requirements specified by this field are not met at + * scheduling time, the pod will not be scheduled onto the node. + * If the affinity requirements specified by this field cease to be met + * at some point during pod execution (e.g. due to an update), the system + * may or may not try to eventually evict the pod from its node. + * +optional + */ + requiredDuringSchedulingIgnoredDuringExecution?: NodeSelector | undefined; + /** + * The scheduler will prefer to schedule pods to nodes that satisfy + * the affinity expressions specified by this field, but it may choose + * a node that violates one or more of the expressions. The node that is + * most preferred is the one with the greatest sum of weights, i.e. + * for each node that meets all of the scheduling requirements (resource + * request, requiredDuringScheduling affinity expressions, etc.), + * compute a sum by iterating through the elements of this field and adding + * "weight" to the sum if the node matches the corresponding matchExpressions; the + * node(s) with the highest sum are the most preferred. + * +optional + * +listType=atomic + */ + preferredDuringSchedulingIgnoredDuringExecution: PreferredSchedulingTerm[]; +} + +/** NodeAllocatableMappedResources describes mapped node allocatable resource allocations. */ +export interface NodeAllocatableMappedResources { + /** + * Name is the name of the resource (e.g., cpu, memory). + * +required + * +k8s:required + */ + name?: string | undefined; + /** + * Quantity is the total node allocatable resource capacity allocated for the claim. + * This claim's allocated devices is shared by all the containers referencing the claim. + * Kubelet adds this value to both requests and limits at the pod-level cgroup, and to limits at the container-level cgroup for each container referencing the claim. + * +required + * +k8s:required + */ + quantity?: Quantity | undefined; +} + +/** NodeAllocatableOverheadResources describes auxiliary overhead resource allocations. */ +export interface NodeAllocatableOverheadResources { + /** + * Name is the name of the resource (e.g., cpu, memory). + * +required + * +k8s:required + */ + name?: string | undefined; + /** + * PerPod is the flat overhead quantity allocated per pod. + * Adding to each container limit allows individual containers to utilize the overhead, while the parent pod-level cgroup limit caps the total usage at the pod boundary where the overhead is accounted for exactly once. + * At least one of PerPod or PerContainer must be specified. Specifying neither is an invalid configuration. + * +optional + * +k8s:optional + */ + perPod?: Quantity | undefined; + /** + * PerContainer is the variable overhead quantity applied for each container referencing the claim. + * The container references are recorded in `nodeAllocatableResourceClaimStatuses.containers`. + * The total overhead quantity allocated for the claim is computed as: + * Quantity = PerPod + (PerContainer * NumReferences) + * Kubelet accounts for this overhead in cgroups: + * - Pod-level cgroup (requests and limits): Kubelet adds PerPod + (PerContainer * NumReferences). + * - Container-level cgroup (limits only): Kubelet adds PerPod + PerContainer for each referencing container. + * This allows any single container to access the pod-level overhead, while the parent cgroup caps the total usage to account for PerPod exactly once. + * At least one of PerPod or PerContainer must be specified. Specifying neither is an invalid configuration. + * +optional + * +k8s:optional + */ + perContainer?: Quantity | undefined; +} + +/** NodeAllocatableResourceClaimStatus describes the status of node allocatable resources allocated via DRA. */ +export interface NodeAllocatableResourceClaimStatus { + /** + * ResourceClaimName is the resource claim referenced by the pod that resulted in this node allocatable resource allocation. + * +required + * +k8s:required + */ + resourceClaimName?: string | undefined; + /** + * Containers lists the names of all containers in this pod that reference the claim. + * +optional + * +listType=set + * +k8s:optional + * +k8s:listType=set + */ + containers: string[]; + /** + * Mapping contains allocations through devices mapped in the device spec's `nodeAllocatableResources[...].mapping` field. + * This is used by kubelet for pod level and container-level cgroup enforcement. + * +optional + * +patchStrategy=merge + * +patchMergeKey=name + * +listType=map + * +listMapKey=name + * +k8s:optional + * +k8s:listType=map + * +k8s:listMapKey=name + */ + mapping: NodeAllocatableMappedResources[]; + /** + * Overhead contains allocations through devices mapped in the device spec's `nodeAllocatableResources[...].overhead` field. + * This is used by kubelet for pod level and container-level cgroup enforcement. + * +optional + * +patchStrategy=merge + * +patchMergeKey=name + * +listType=map + * +listMapKey=name + * +k8s:optional + * +k8s:listType=map + * +k8s:listMapKey=name + */ + overhead: NodeAllocatableOverheadResources[]; +} + +/** NodeCondition contains condition information for a node. */ +export interface NodeCondition { + /** Type of node condition. */ + type?: string | undefined; + /** Status of the condition, one of True, False, Unknown. */ + status?: string | undefined; + /** + * Last time we got an update on a given condition. + * +optional + */ + lastHeartbeatTime?: Time | undefined; + /** + * Last time the condition transit from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * (brief) reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * Human readable message indicating details about last transition. + * +optional + */ + message?: string | undefined; +} + +/** + * NodeConfigSource specifies a source of node configuration. Exactly one subfield (excluding metadata) must be non-nil. + * This API is deprecated since 1.22 + */ +export interface NodeConfigSource { + /** ConfigMap is a reference to a Node's ConfigMap */ + configMap?: ConfigMapNodeConfigSource | undefined; +} + +/** NodeConfigStatus describes the status of the config assigned by Node.Spec.ConfigSource. */ +export interface NodeConfigStatus { + /** + * Assigned reports the checkpointed config the node will try to use. + * When Node.Spec.ConfigSource is updated, the node checkpoints the associated + * config payload to local disk, along with a record indicating intended + * config. The node refers to this record to choose its config checkpoint, and + * reports this record in Assigned. Assigned only updates in the status after + * the record has been checkpointed to disk. When the Kubelet is restarted, + * it tries to make the Assigned config the Active config by loading and + * validating the checkpointed payload identified by Assigned. + * +optional + */ + assigned?: NodeConfigSource | undefined; + /** + * Active reports the checkpointed config the node is actively using. + * Active will represent either the current version of the Assigned config, + * or the current LastKnownGood config, depending on whether attempting to use the + * Assigned config results in an error. + * +optional + */ + active?: NodeConfigSource | undefined; + /** + * LastKnownGood reports the checkpointed config the node will fall back to + * when it encounters an error attempting to use the Assigned config. + * The Assigned config becomes the LastKnownGood config when the node determines + * that the Assigned config is stable and correct. + * This is currently implemented as a 10-minute soak period starting when the local + * record of Assigned config is updated. If the Assigned config is Active at the end + * of this period, it becomes the LastKnownGood. Note that if Spec.ConfigSource is + * reset to nil (use local defaults), the LastKnownGood is also immediately reset to nil, + * because the local default config is always assumed good. + * You should not make assumptions about the node's method of determining config stability + * and correctness, as this may change or become configurable in the future. + * +optional + */ + lastKnownGood?: NodeConfigSource | undefined; + /** + * Error describes any problems reconciling the Spec.ConfigSource to the Active config. + * Errors may occur, for example, attempting to checkpoint Spec.ConfigSource to the local Assigned + * record, attempting to checkpoint the payload associated with Spec.ConfigSource, attempting + * to load or validate the Assigned config, etc. + * Errors may occur at different points while syncing config. Earlier errors (e.g. download or + * checkpointing errors) will not result in a rollback to LastKnownGood, and may resolve across + * Kubelet retries. Later errors (e.g. loading or validating a checkpointed config) will result in + * a rollback to LastKnownGood. In the latter case, it is usually possible to resolve the error + * by fixing the config assigned in Spec.ConfigSource. + * You can find additional information for debugging by searching the error message in the Kubelet log. + * Error is a human-readable description of the error state; machines can check whether or not Error + * is empty, but should not rely on the stability of the Error text across Kubelet versions. + * +optional + */ + error?: string | undefined; +} + +/** NodeDaemonEndpoints lists ports opened by daemons running on the Node. */ +export interface NodeDaemonEndpoints { + /** + * Endpoint on which Kubelet is listening. + * +optional + */ + kubeletEndpoint?: DaemonEndpoint | undefined; +} + +/** + * NodeFeatures describes the set of features implemented by the CRI implementation. + * The features contained in the NodeFeatures should depend only on the cri implementation + * independent of runtime handlers. + */ +export interface NodeFeatures { + /** + * SupplementalGroupsPolicy is set to true if the runtime supports SupplementalGroupsPolicy and ContainerUser. + * +optional + */ + supplementalGroupsPolicy?: boolean | undefined; +} + +/** NodeList is the whole list of all Nodes which have been registered with master. */ +export interface NodeList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of nodes */ + items: Node[]; +} + +/** NodePodPreemptionPolicy defines the node-level policies governing preemption for pods on this node. */ +export interface NodePodPreemptionPolicy { + /** + * DisableResizePreemption lists the owners (e.g., autoscalers, operators, administrators) + * that have requested to disable scheduler and Kubelet preemption for in-place pod resize on this node. + * If this list is non-empty, resize-induced preemption is disabled on this node. + * This is an alpha field and requires enabling the InPlacePodVerticalScalingSchedulerPreemption feature gate. + * +listType=set + * +k8s:listType=set + * +optional + * +k8s:maxItems=20 + * +k8s:optional + * +k8s:eachVal=+k8s:format=k8s-label-key + */ + disableResizePreemption: string[]; +} + +/** NodeProxyOptions is the query options to a Node's proxy call. */ +export interface NodeProxyOptions { + /** + * Path is the URL path to use for the current proxy request to node. + * +optional + */ + path?: string | undefined; +} + +/** NodeRuntimeHandler is a set of runtime handler information. */ +export interface NodeRuntimeHandler { + /** + * Runtime handler name. + * Empty for the default runtime handler. + * +optional + */ + name?: string | undefined; + /** + * Supported features. + * +optional + */ + features?: NodeRuntimeHandlerFeatures | undefined; +} + +/** NodeRuntimeHandlerFeatures is a set of features implemented by the runtime handler. */ +export interface NodeRuntimeHandlerFeatures { + /** + * RecursiveReadOnlyMounts is set to true if the runtime handler supports RecursiveReadOnlyMounts. + * +optional + */ + recursiveReadOnlyMounts?: boolean | undefined; + /** + * UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes. + * +optional + */ + userNamespaces?: boolean | undefined; +} + +/** + * A node selector represents the union of the results of one or more label queries + * over a set of nodes; that is, it represents the OR of the selectors represented + * by the node selector terms. + * +structType=atomic + */ +export interface NodeSelector { + /** + * Required. A list of node selector terms. The terms are ORed. + * +listType=atomic + */ + nodeSelectorTerms: NodeSelectorTerm[]; +} + +/** + * A node selector requirement is a selector that contains values, a key, and an operator + * that relates the key and values. + */ +export interface NodeSelectorRequirement { + /** The label key that the selector applies to. */ + key?: string | undefined; + /** + * Represents a key's relationship to a set of values. + * Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + */ + operator?: string | undefined; + /** + * An array of string values. If the operator is In or NotIn, + * the values array must be non-empty. If the operator is Exists or DoesNotExist, + * the values array must be empty. If the operator is Gt or Lt, the values + * array must have a single element, which will be interpreted as an integer. + * This array is replaced during a strategic merge patch. + * +optional + * +listType=atomic + */ + values: string[]; +} + +/** + * A null or empty node selector term matches no objects. The requirements of + * them are ANDed. + * The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. + * +structType=atomic + */ +export interface NodeSelectorTerm { + /** + * A list of node selector requirements by node's labels. + * +optional + * +listType=atomic + */ + matchExpressions: NodeSelectorRequirement[]; + /** + * A list of node selector requirements by node's fields. + * +optional + * +listType=atomic + */ + matchFields: NodeSelectorRequirement[]; +} + +/** NodeSpec describes the attributes that a node is created with. */ +export interface NodeSpec { + /** + * PodCIDR represents the pod IP range assigned to the node. + * +optional + */ + podCIDR?: string | undefined; + /** + * podCIDRs represents the IP ranges assigned to the node for usage by Pods on that node. If this + * field is specified, the 0th entry must match the podCIDR field. It may contain at most 1 value for + * each of IPv4 and IPv6. + * +optional + * +patchStrategy=merge + * +listType=set + */ + podCIDRs: string[]; + /** + * ID of the node assigned by the cloud provider in the format: :// + * +optional + * +k8s:alpha(since: "1.36")=+k8s:optional + * +k8s:alpha(since: "1.36")=+k8s:update=NoModify + * +k8s:alpha(since: "1.36")=+k8s:update=NoUnset + */ + providerID?: string | undefined; + /** + * Unschedulable controls node schedulability of new pods. By default, node is schedulable. + * More info: https://kubernetes.io/docs/concepts/nodes/node/#manual-node-administration + * +optional + */ + unschedulable?: boolean | undefined; + /** + * If specified, the node's taints. + * +optional + * +listType=atomic + */ + taints: Taint[]; + /** + * Deprecated: Previously used to specify the source of the node's configuration for the DynamicKubeletConfig feature. This feature is removed. + * +optional + */ + configSource?: NodeConfigSource | undefined; + /** + * Deprecated. Not all kubelets will set this field. Remove field after 1.13. + * see: https://issues.k8s.io/61966 + * +optional + */ + externalID?: string | undefined; + /** + * PodPreemptionPolicy controls the node-level preemption behaviors for pods on this node. + * This is an alpha field and requires enabling the InPlacePodVerticalScalingSchedulerPreemption feature gate. + * +featureGate=InPlacePodVerticalScalingSchedulerPreemption + * +optional + * +k8s:optional + * +k8s:ifDisabled(InPlacePodVerticalScalingSchedulerPreemption)=+k8s:forbidden + */ + podPreemptionPolicy?: NodePodPreemptionPolicy | undefined; +} + +/** NodeStatus is information about the current status of a node. */ +export interface NodeStatus { + /** + * Capacity represents the total resources of a node. + * More info: https://kubernetes.io/docs/reference/node/node-status/#capacity + * +optional + */ + capacity: { [key: string]: Quantity }; + /** + * Allocatable represents the resources of a node that are available for scheduling. + * Defaults to Capacity. + * +optional + */ + allocatable: { [key: string]: Quantity }; + /** + * NodePhase is the recently observed lifecycle phase of the node. + * More info: https://kubernetes.io/docs/concepts/nodes/node/#phase + * The field is never populated, and now is deprecated. + * +optional + */ + phase?: string | undefined; + /** + * Conditions is an array of current observed node conditions. + * More info: https://kubernetes.io/docs/reference/node/node-status/#condition + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: NodeCondition[]; + /** + * List of addresses reachable to the node. + * Queried from cloud provider, if available. + * More info: https://kubernetes.io/docs/reference/node/node-status/#addresses + * Note: This field is declared as mergeable, but the merge key is not sufficiently + * unique, which can cause data corruption when it is merged. Callers should instead + * use a full-replacement patch. See https://pr.k8s.io/79391 for an example. + * Consumers should assume that addresses can change during the + * lifetime of a Node. However, there are some exceptions where this may not + * be possible, such as Pods that inherit a Node's address in its own status or + * consumers of the downward API (status.hostIP). + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + addresses: NodeAddress[]; + /** + * Endpoints of daemons running on the Node. + * +optional + */ + daemonEndpoints?: NodeDaemonEndpoints | undefined; + /** + * Set of ids/uuids to uniquely identify the node. + * More info: https://kubernetes.io/docs/reference/node/node-status/#info + * +optional + */ + nodeInfo?: NodeSystemInfo | undefined; + /** + * List of container images on this node + * +optional + * +listType=atomic + */ + images: ContainerImage[]; + /** + * List of attachable volumes in use (mounted) by the node. + * +optional + * +listType=atomic + */ + volumesInUse: string[]; + /** + * List of volumes that are attached to the node. + * +optional + * +listType=atomic + */ + volumesAttached: AttachedVolume[]; + /** + * Status of the config assigned to the node via the dynamic Kubelet config feature. + * +optional + */ + config?: NodeConfigStatus | undefined; + /** + * The available runtime handlers. + * +optional + * +listType=atomic + */ + runtimeHandlers: NodeRuntimeHandler[]; + /** + * Features describes the set of features implemented by the CRI implementation. + * +featureGate=SupplementalGroupsPolicy + * +optional + */ + features?: NodeFeatures | undefined; + /** + * DeclaredFeatures represents the features related to feature gates that are declared by the node. + * +featureGate=NodeDeclaredFeatures + * +optional + * +listType=atomic + */ + declaredFeatures: string[]; +} + +export interface NodeStatus_CapacityEntry { + key: string; + value: Quantity | undefined; +} + +export interface NodeStatus_AllocatableEntry { + key: string; + value: Quantity | undefined; +} + +/** NodeSwapStatus represents swap memory information. */ +export interface NodeSwapStatus { + /** + * Total amount of swap memory in bytes. + * +optional + */ + capacity?: number | undefined; +} + +/** NodeSystemInfo is a set of ids/uuids to uniquely identify the node. */ +export interface NodeSystemInfo { + /** + * MachineID reported by the node. For unique machine identification + * in the cluster this field is preferred. Learn more from man(5) + * machine-id: http://man7.org/linux/man-pages/man5/machine-id.5.html + */ + machineID?: string | undefined; + /** + * SystemUUID reported by the node. For unique machine identification + * MachineID is preferred. This field is specific to Red Hat hosts + * https://access.redhat.com/documentation/en-us/red_hat_subscription_management/1/html/rhsm/uuid + */ + systemUUID?: string | undefined; + /** Boot ID reported by the node. */ + bootID?: string | undefined; + /** Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64). */ + kernelVersion?: string | undefined; + /** OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)). */ + osImage?: string | undefined; + /** ContainerRuntime Version reported by the node through runtime remote API (e.g. containerd://1.4.2). */ + containerRuntimeVersion?: string | undefined; + /** Kubelet Version reported by the node. */ + kubeletVersion?: string | undefined; + /** Deprecated: KubeProxy Version reported by the node. */ + kubeProxyVersion?: string | undefined; + /** The Operating System reported by the node */ + operatingSystem?: string | undefined; + /** The Architecture reported by the node */ + architecture?: string | undefined; + /** Swap Info reported by the node. */ + swap?: NodeSwapStatus | undefined; + /** + * Whether the node is running in a user namespace. + * +featureGate=KubeletInUserNamespace + * +optional + */ + runningInUserNamespace?: boolean | undefined; +} + +/** + * ObjectFieldSelector selects an APIVersioned field of an object. + * +structType=atomic + */ +export interface ObjectFieldSelector { + /** + * Version of the schema the FieldPath is written in terms of, defaults to "v1". + * +optional + */ + apiVersion?: string | undefined; + /** Path of the field to select in the specified API version. */ + fieldPath?: string | undefined; +} + +/** + * ObjectReference contains enough information to let you inspect or modify the referred object. + * --- + * New uses of this type are discouraged because of difficulty describing its usage when embedded in APIs. + * 1. Ignored fields. It includes many fields which are not generally honored. For instance, ResourceVersion and FieldPath are both very rarely valid in actual usage. + * 2. Invalid usage help. It is impossible to add specific help for individual usage. In most embedded usages, there are particular + * restrictions like, "must refer only to types A and B" or "UID not honored" or "name must be restricted". + * Those cannot be well described when embedded. + * 3. Inconsistent validation. Because the usages are different, the validation rules are different by usage, which makes it hard for users to predict what will happen. + * 4. The fields are both imprecise and overly precise. Kind is not a precise mapping to a URL. This can produce ambiguity + * during interpretation and require a REST mapping. In most cases, the dependency is on the group,resource tuple + * and the version of the actual struct is irrelevant. + * 5. We cannot easily change it. Because this type is embedded in many locations, updates to this type + * will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control. + * + * Instead of using this type, create a locally provided and used type that is well-focused on your reference. + * For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 . + * +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + * +structType=atomic + */ +export interface ObjectReference { + /** + * Kind of the referent. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + kind?: string | undefined; + /** + * Namespace of the referent. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + * +optional + */ + namespace?: string | undefined; + /** + * Name of the referent. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + * +optional + */ + name?: string | undefined; + /** + * UID of the referent. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids + * +optional + */ + uid?: string | undefined; + /** + * API version of the referent. + * +optional + */ + apiVersion?: string | undefined; + /** + * Specific resourceVersion to which this reference is made, if any. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * +optional + */ + resourceVersion?: string | undefined; + /** + * If referring to a piece of an object instead of an entire object, this string + * should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + * For example, if the object reference is to a container within a pod, this would take on a value like: + * "spec.containers{name}" (where "name" refers to the name of the container that triggered + * the event) or if no container name is specified "spec.containers[2]" (container with + * index 2 in this pod). This syntax is chosen only to have some well-defined way of + * referencing a part of an object. + * TODO: this design is not final and this field is subject to change in the future. + * +optional + */ + fieldPath?: string | undefined; +} + +/** + * PersistentVolume (PV) is a storage resource provisioned by an administrator. + * It is analogous to a node. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes + * +k8s:supportsSubresource="/status" + */ +export interface PersistentVolume { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec defines a specification of a persistent volume owned by the cluster. + * Provisioned by an administrator. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes + * +optional + */ + spec?: PersistentVolumeSpec | undefined; + /** + * status represents the current information/status for the persistent volume. + * Populated by the system. + * Read-only. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes + * +optional + */ + status?: PersistentVolumeStatus | undefined; +} + +/** + * PersistentVolumeClaim is a user's request for and claim to a persistent volume + * +k8s:supportsSubresource="/status" + */ +export interface PersistentVolumeClaim { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec defines the desired characteristics of a volume requested by a pod author. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + * +optional + */ + spec?: PersistentVolumeClaimSpec | undefined; + /** + * status represents the current information/status of a persistent volume claim. + * Read-only. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + * +optional + */ + status?: PersistentVolumeClaimStatus | undefined; +} + +/** PersistentVolumeClaimCondition contains details about state of pvc */ +export interface PersistentVolumeClaimCondition { + /** + * Type is the type of the condition. + * More info: https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/persistent-volume-claim-v1/#:~:text=set%20to%20%27ResizeStarted%27.-,PersistentVolumeClaimCondition,-contains%20details%20about + */ + type?: string | undefined; + /** + * Status is the status of the condition. + * Can be True, False, Unknown. + * More info: https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/persistent-volume-claim-v1/#:~:text=state%20of%20pvc-,conditions.status,-(string)%2C%20required + */ + status?: string | undefined; + /** + * lastProbeTime is the time we probed the condition. + * +optional + */ + lastProbeTime?: Time | undefined; + /** + * lastTransitionTime is the time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * reason is a unique, this should be a short, machine understandable string that gives the reason + * for condition's last transition. If it reports "Resizing" that means the underlying + * persistent volume is being resized. + * +optional + */ + reason?: string | undefined; + /** + * message is the human-readable message indicating details about last transition. + * +optional + */ + message?: string | undefined; +} + +/** PersistentVolumeClaimList is a list of PersistentVolumeClaim items. */ +export interface PersistentVolumeClaimList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** + * items is a list of persistent volume claims. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + */ + items: PersistentVolumeClaim[]; +} + +/** + * PersistentVolumeClaimSpec describes the common attributes of storage devices + * and allows a Source for provider-specific attributes + */ +export interface PersistentVolumeClaimSpec { + /** + * accessModes contains the desired access modes the volume should have. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 + * +optional + * +listType=atomic + */ + accessModes: string[]; + /** + * selector is a label query over volumes to consider for binding. + * +optional + */ + selector?: LabelSelector | undefined; + /** + * resources represents the minimum resources the volume should have. + * Users are allowed to specify resource requirements + * that are lower than previous value but must still be higher than capacity recorded in the + * status field of the claim. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources + * +optional + */ + resources?: VolumeResourceRequirements | undefined; + /** + * volumeName is the binding reference to the PersistentVolume backing this claim. + * +optional + */ + volumeName?: string | undefined; + /** + * storageClassName is the name of the StorageClass required by the claim. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 + * +optional + */ + storageClassName?: string | undefined; + /** + * volumeMode defines what type of volume is required by the claim. + * Value of Filesystem is implied when not included in claim spec. + * +optional + */ + volumeMode?: string | undefined; + /** + * dataSource field can be used to specify either: + * * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * * An existing PVC (PersistentVolumeClaim) + * If the provisioner or an external controller can support the specified data source, + * it will create a new volume based on the contents of the specified data source. + * dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be + * copied to dataSource when dataSourceRef.namespace is not specified. + * If the namespace is specified, then dataSourceRef will not be copied to dataSource. + * +optional + */ + dataSource?: TypedLocalObjectReference | undefined; + /** + * dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + * volume is desired. This may be any object from a non-empty API group (non + * core object) or a PersistentVolumeClaim object. + * When this field is specified, volume binding will only succeed if the type of + * the specified object matches some installed volume populator or dynamic + * provisioner. + * This field will replace the functionality of the dataSource field and as such + * if both fields are non-empty, they must have the same value. For backwards + * compatibility, when namespace isn't specified in dataSourceRef, + * both fields (dataSource and dataSourceRef) will be set to the same + * value automatically if one of them is empty and the other is non-empty. + * When namespace is specified in dataSourceRef, + * dataSource isn't set to the same value and must be empty. + * There are three important differences between dataSource and dataSourceRef: + * * While dataSource only allows two specific types of objects, dataSourceRef + * allows any non-core object, as well as PersistentVolumeClaim objects. + * * While dataSource ignores disallowed values (dropping them), dataSourceRef + * preserves all values, and generates an error if a disallowed value is + * specified. + * * While dataSource only allows local objects, dataSourceRef allows objects + * in any namespaces. + * (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + * +optional + */ + dataSourceRef?: TypedObjectReference | undefined; + /** + * volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. + * If specified, the CSI driver will create or update the volume with the attributes defined + * in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, + * it can be changed after the claim is created. An empty string or nil value indicates that no + * VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state, + * this field can be reset to its previous value (including nil) to cancel the modification. + * If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be + * set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource + * exists. + * More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ + * +featureGate=VolumeAttributesClass + * +optional + */ + volumeAttributesClassName?: string | undefined; +} + +/** PersistentVolumeClaimStatus is the current status of a persistent volume claim. */ +export interface PersistentVolumeClaimStatus { + /** + * phase represents the current phase of PersistentVolumeClaim. + * +optional + */ + phase?: string | undefined; + /** + * accessModes contains the actual access modes the volume backing the PVC has. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 + * +optional + * +listType=atomic + */ + accessModes: string[]; + /** + * capacity represents the actual resources of the underlying volume. + * +optional + */ + capacity: { [key: string]: Quantity }; + /** + * conditions is the current Condition of persistent volume claim. If underlying persistent volume is being + * resized then the Condition will be set to 'Resizing'. + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: PersistentVolumeClaimCondition[]; + /** + * allocatedResources tracks the resources allocated to a PVC including its capacity. + * Key names follow standard Kubernetes label syntax. Valid values are either: + * * Un-prefixed keys: + * - storage - the capacity of the volume. + * * Custom resources must use implementation-defined prefixed names such as "example.com/my-custom-resource" + * Apart from above values - keys that are unprefixed or have kubernetes.io prefix are considered + * reserved and hence may not be used. + * + * Capacity reported here may be larger than the actual capacity when a volume expansion operation + * is requested. + * For storage quota, the larger value from allocatedResources and PVC.spec.resources is used. + * If allocatedResources is not set, PVC.spec.resources alone is used for quota calculation. + * If a volume expansion capacity request is lowered, allocatedResources is only + * lowered if there are no expansion operations in progress and if the actual volume capacity + * is equal or lower than the requested capacity. + * + * A controller that receives PVC update with previously unknown resourceName + * should ignore the update for the purpose it was designed. For example - a controller that + * only is responsible for resizing capacity of the volume, should ignore PVC updates that change other valid + * resources associated with PVC. + * +optional + */ + allocatedResources: { [key: string]: Quantity }; + /** + * allocatedResourceStatuses stores status of resource being resized for the given PVC. + * Key names follow standard Kubernetes label syntax. Valid values are either: + * * Un-prefixed keys: + * - storage - the capacity of the volume. + * * Custom resources must use implementation-defined prefixed names such as "example.com/my-custom-resource" + * Apart from above values - keys that are unprefixed or have kubernetes.io prefix are considered + * reserved and hence may not be used. + * + * ClaimResourceStatus can be in any of following states: + * - ControllerResizeInProgress: + * State set when resize controller starts resizing the volume in control-plane. + * - ControllerResizeFailed: + * State set when resize has failed in resize controller with a terminal error. + * - NodeResizePending: + * State set when resize controller has finished resizing the volume but further resizing of + * volume is needed on the node. + * - NodeResizeInProgress: + * State set when kubelet starts resizing the volume. + * - NodeResizeFailed: + * State set when resizing has failed in kubelet with a terminal error. Transient errors don't set + * NodeResizeFailed. + * For example: if expanding a PVC for more capacity - this field can be one of the following states: + * - pvc.status.allocatedResourceStatus['storage'] = "ControllerResizeInProgress" + * - pvc.status.allocatedResourceStatus['storage'] = "ControllerResizeFailed" + * - pvc.status.allocatedResourceStatus['storage'] = "NodeResizePending" + * - pvc.status.allocatedResourceStatus['storage'] = "NodeResizeInProgress" + * - pvc.status.allocatedResourceStatus['storage'] = "NodeResizeFailed" + * When this field is not set, it means that no resize operation is in progress for the given PVC. + * + * A controller that receives PVC update with previously unknown resourceName or ClaimResourceStatus + * should ignore the update for the purpose it was designed. For example - a controller that + * only is responsible for resizing capacity of the volume, should ignore PVC updates that change other valid + * resources associated with PVC. + * +mapType=granular + * +optional + */ + allocatedResourceStatuses: { [key: string]: string }; + /** + * currentVolumeAttributesClassName is the current name of the VolumeAttributesClass the PVC is using. + * When unset, there is no VolumeAttributeClass applied to this PersistentVolumeClaim + * +featureGate=VolumeAttributesClass + * +optional + */ + currentVolumeAttributesClassName?: string | undefined; + /** + * ModifyVolumeStatus represents the status object of ControllerModifyVolume operation. + * When this is unset, there is no ModifyVolume operation being attempted. + * +featureGate=VolumeAttributesClass + * +optional + */ + modifyVolumeStatus?: ModifyVolumeStatus | undefined; + /** + * healthStatus contains the latest controller-reported health information + * for the volume bound to this claim. + * +featureGate=CSIVolumeHealth + * +optional + * +k8s:optional + */ + healthStatus?: VolumeHealthStatus | undefined; +} + +export interface PersistentVolumeClaimStatus_CapacityEntry { + key: string; + value: Quantity | undefined; +} + +export interface PersistentVolumeClaimStatus_AllocatedResourcesEntry { + key: string; + value: Quantity | undefined; +} + +export interface PersistentVolumeClaimStatus_AllocatedResourceStatusesEntry { + key: string; + value: string; +} + +/** + * PersistentVolumeClaimTemplate is used to produce + * PersistentVolumeClaim objects as part of an EphemeralVolumeSource. + */ +export interface PersistentVolumeClaimTemplate { + /** + * May contain labels and annotations that will be copied into the PVC + * when creating it. No other fields are allowed and will be rejected during + * validation. + * + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * The specification for the PersistentVolumeClaim. The entire content is + * copied unchanged into the PVC that gets created from this + * template. The same fields as in a PersistentVolumeClaim + * are also valid here. + */ + spec?: PersistentVolumeClaimSpec | undefined; +} + +/** + * PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace. + * This volume finds the bound PV and mounts that volume for the pod. A + * PersistentVolumeClaimVolumeSource is, essentially, a wrapper around another + * type of volume that is owned by someone else (the system). + */ +export interface PersistentVolumeClaimVolumeSource { + /** + * claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + */ + claimName?: string | undefined; + /** + * readOnly Will force the ReadOnly setting in VolumeMounts. + * Default false. + * +optional + */ + readOnly?: boolean | undefined; +} + +/** PersistentVolumeList is a list of PersistentVolume items. */ +export interface PersistentVolumeList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** + * items is a list of persistent volumes. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes + */ + items: PersistentVolume[]; +} + +/** + * PersistentVolumeSource is similar to VolumeSource but meant for the + * administrator who creates PVs. Exactly one of its members must be set. + */ +export interface PersistentVolumeSource { + /** + * gcePersistentDisk represents a GCE Disk resource that is attached to a + * kubelet's host machine and then exposed to the pod. Provisioned by an admin. + * Deprecated: GCEPersistentDisk is deprecated. All operations for the in-tree + * gcePersistentDisk type are redirected to the pd.csi.storage.gke.io CSI driver. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + * +optional + */ + gcePersistentDisk?: GCEPersistentDiskVolumeSource | undefined; + /** + * awsElasticBlockStore represents an AWS Disk resource that is attached to a + * kubelet's host machine and then exposed to the pod. + * Deprecated: AWSElasticBlockStore is deprecated. All operations for the in-tree + * awsElasticBlockStore type are redirected to the ebs.csi.aws.com CSI driver. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + * +optional + */ + awsElasticBlockStore?: AWSElasticBlockStoreVolumeSource | undefined; + /** + * hostPath represents a directory on the host. + * Provisioned by a developer or tester. + * This is useful for single-node development and testing only! + * On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + * +optional + */ + hostPath?: HostPathVolumeSource | undefined; + /** + * glusterfs represents a Glusterfs volume that is attached to a host and + * exposed to the pod. Provisioned by an admin. + * Deprecated: Glusterfs is deprecated and the in-tree glusterfs type is no longer supported. + * More info: https://examples.k8s.io/volumes/glusterfs/README.md + * +optional + */ + glusterfs?: GlusterfsPersistentVolumeSource | undefined; + /** + * nfs represents an NFS mount on the host. Provisioned by an admin. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + * +optional + */ + nfs?: NFSVolumeSource | undefined; + /** + * rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + * Deprecated: RBD is deprecated and the in-tree rbd type is no longer supported. + * More info: https://examples.k8s.io/volumes/rbd/README.md + * +optional + */ + rbd?: RBDPersistentVolumeSource | undefined; + /** + * iscsi represents an ISCSI Disk resource that is attached to a + * kubelet's host machine and then exposed to the pod. Provisioned by an admin. + * +optional + */ + iscsi?: ISCSIPersistentVolumeSource | undefined; + /** + * cinder represents a cinder volume attached and mounted on kubelets host machine. + * Deprecated: Cinder is deprecated. All operations for the in-tree cinder type + * are redirected to the cinder.csi.openstack.org CSI driver. + * More info: https://examples.k8s.io/mysql-cinder-pd/README.md + * +optional + */ + cinder?: CinderPersistentVolumeSource | undefined; + /** + * cephFS represents a Ceph FS mount on the host that shares a pod's lifetime. + * Deprecated: CephFS is deprecated and the in-tree cephfs type is no longer supported. + * +optional + */ + cephfs?: CephFSPersistentVolumeSource | undefined; + /** + * fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod. + * +optional + */ + fc?: FCVolumeSource | undefined; + /** + * flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running. + * Deprecated: Flocker is deprecated and the in-tree flocker type is no longer supported. + * +optional + */ + flocker?: FlockerVolumeSource | undefined; + /** + * flexVolume represents a generic volume resource that is + * provisioned/attached using an exec based plugin. + * Deprecated: FlexVolume is deprecated. Consider using a CSIDriver instead. + * +optional + */ + flexVolume?: FlexPersistentVolumeSource | undefined; + /** + * azureFile represents an Azure File Service mount on the host and bind mount to the pod. + * Deprecated: AzureFile is deprecated. All operations for the in-tree azureFile type + * are redirected to the file.csi.azure.com CSI driver. + * +optional + */ + azureFile?: AzureFilePersistentVolumeSource | undefined; + /** + * vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine. + * Deprecated: VsphereVolume is deprecated. All operations for the in-tree vsphereVolume type + * are redirected to the csi.vsphere.vmware.com CSI driver. + * +optional + */ + vsphereVolume?: VsphereVirtualDiskVolumeSource | undefined; + /** + * quobyte represents a Quobyte mount on the host that shares a pod's lifetime. + * Deprecated: Quobyte is deprecated and the in-tree quobyte type is no longer supported. + * +optional + */ + quobyte?: QuobyteVolumeSource | undefined; + /** + * azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. + * Deprecated: AzureDisk is deprecated. All operations for the in-tree azureDisk type + * are redirected to the disk.csi.azure.com CSI driver. + * +optional + */ + azureDisk?: AzureDiskVolumeSource | undefined; + /** + * photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine. + * Deprecated: PhotonPersistentDisk is deprecated and the in-tree photonPersistentDisk type is no longer supported. + */ + photonPersistentDisk?: PhotonPersistentDiskVolumeSource | undefined; + /** + * portworxVolume represents a portworx volume attached and mounted on kubelets host machine. + * Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type + * are redirected to the pxd.portworx.com CSI driver. + * +optional + */ + portworxVolume?: PortworxVolumeSource | undefined; + /** + * scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. + * Deprecated: ScaleIO is deprecated and the in-tree scaleIO type is no longer supported. + * +optional + */ + scaleIO?: ScaleIOPersistentVolumeSource | undefined; + /** + * local represents directly-attached storage with node affinity + * +optional + */ + local?: LocalVolumeSource | undefined; + /** + * storageOS represents a StorageOS volume that is attached to the kubelet's host machine and mounted into the pod. + * Deprecated: StorageOS is deprecated and the in-tree storageos type is no longer supported. + * More info: https://examples.k8s.io/volumes/storageos/README.md + * +optional + */ + storageos?: StorageOSPersistentVolumeSource | undefined; + /** + * csi represents storage that is handled by an external CSI driver. + * +optional + */ + csi?: CSIPersistentVolumeSource | undefined; +} + +/** PersistentVolumeSpec is the specification of a persistent volume. */ +export interface PersistentVolumeSpec { + /** + * capacity is the description of the persistent volume's resources and capacity. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity + * +optional + */ + capacity: { [key: string]: Quantity }; + /** persistentVolumeSource is the actual volume backing the persistent volume. */ + persistentVolumeSource?: PersistentVolumeSource | undefined; + /** + * accessModes contains all ways the volume can be mounted. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes + * +optional + * +listType=atomic + */ + accessModes: string[]; + /** + * claimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. + * Expected to be non-nil when bound. + * claim.VolumeName is the authoritative bind between PV and PVC. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding + * +optional + * +structType=granular + */ + claimRef?: ObjectReference | undefined; + /** + * persistentVolumeReclaimPolicy defines what happens to a persistent volume when released from its claim. + * Valid options are Retain (default for manually created PersistentVolumes), Delete (default + * for dynamically provisioned PersistentVolumes), and Recycle (deprecated). + * Recycle must be supported by the volume plugin underlying this PersistentVolume. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming + * +optional + */ + persistentVolumeReclaimPolicy?: string | undefined; + /** + * storageClassName is the name of StorageClass to which this persistent volume belongs. Empty value + * means that this volume does not belong to any StorageClass. + * +optional + */ + storageClassName?: string | undefined; + /** + * mountOptions is the list of mount options, e.g. ["ro", "soft"]. Not validated - mount will + * simply fail if one is invalid. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options + * +optional + * +listType=atomic + */ + mountOptions: string[]; + /** + * volumeMode defines if a volume is intended to be used with a formatted filesystem + * or to remain in raw block state. Value of Filesystem is implied when not included in spec. + * +optional + */ + volumeMode?: string | undefined; + /** + * nodeAffinity defines constraints that limit what nodes this volume can be accessed from. + * This field influences the scheduling of pods that use this volume. + * This field is mutable if MutablePVNodeAffinity feature gate is enabled. + * +optional + */ + nodeAffinity?: VolumeNodeAffinity | undefined; + /** + * Name of VolumeAttributesClass to which this persistent volume belongs. Empty value + * is not allowed. When this field is not set, it indicates that this volume does not belong to any + * VolumeAttributesClass. This field is mutable and can be changed by the CSI driver + * after a volume has been updated successfully to a new class. + * For an unbound PersistentVolume, the volumeAttributesClassName will be matched with unbound + * PersistentVolumeClaims during the binding process. + * +featureGate=VolumeAttributesClass + * +optional + */ + volumeAttributesClassName?: string | undefined; +} + +export interface PersistentVolumeSpec_CapacityEntry { + key: string; + value: Quantity | undefined; +} + +/** PersistentVolumeStatus is the current status of a persistent volume. */ +export interface PersistentVolumeStatus { + /** + * phase indicates if a volume is available, bound to a claim, or released by a claim. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#phase + * +optional + */ + phase?: string | undefined; + /** + * message is a human-readable message indicating details about why the volume is in this state. + * +optional + */ + message?: string | undefined; + /** + * reason is a brief CamelCase string that describes any failure and is meant + * for machine parsing and tidy display in the CLI. + * +optional + */ + reason?: string | undefined; + /** + * lastPhaseTransitionTime is the time the phase transitioned from one to another + * and automatically resets to current time everytime a volume phase transitions. + * +optional + */ + lastPhaseTransitionTime?: Time | undefined; +} + +/** Represents a Photon Controller persistent disk resource. */ +export interface PhotonPersistentDiskVolumeSource { + /** pdID is the ID that identifies Photon Controller persistent disk */ + pdID?: string | undefined; + /** + * fsType is the filesystem type to mount. + * Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + */ + fsType?: string | undefined; +} + +/** + * Pod is a collection of containers that can run on a host. This resource is created + * by clients and scheduled onto hosts. + * +k8s:supportsSubresource="/status" + * +k8s:supportsSubresource="/ephemeralcontainers" + * +k8s:supportsSubresource="/resize" + * +k8s:supportsSubresource="/eviction" + */ +export interface Pod { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Specification of the desired behavior of the pod. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: PodSpec | undefined; + /** + * Most recently observed status of the pod. + * This data may not be up to date. + * Populated by the system. + * Read-only. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: PodStatus | undefined; +} + +/** Pod affinity is a group of inter pod affinity scheduling rules. */ +export interface PodAffinity { + /** + * If the affinity requirements specified by this field are not met at + * scheduling time, the pod will not be scheduled onto the node. + * If the affinity requirements specified by this field cease to be met + * at some point during pod execution (e.g. due to a pod label update), the + * system may or may not try to eventually evict the pod from its node. + * When there are multiple elements, the lists of nodes corresponding to each + * podAffinityTerm are intersected, i.e. all terms must be satisfied. + * +optional + * +listType=atomic + */ + requiredDuringSchedulingIgnoredDuringExecution: PodAffinityTerm[]; + /** + * The scheduler will prefer to schedule pods to nodes that satisfy + * the affinity expressions specified by this field, but it may choose + * a node that violates one or more of the expressions. The node that is + * most preferred is the one with the greatest sum of weights, i.e. + * for each node that meets all of the scheduling requirements (resource + * request, requiredDuringScheduling affinity expressions, etc.), + * compute a sum by iterating through the elements of this field and adding + * "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + * node(s) with the highest sum are the most preferred. + * +optional + * +listType=atomic + */ + preferredDuringSchedulingIgnoredDuringExecution: WeightedPodAffinityTerm[]; +} + +/** + * 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 { + /** + * A label query over a set of resources, in this case pods. + * If it's null, this PodAffinityTerm matches with no Pods. + * +optional + */ + labelSelector?: LabelSelector | undefined; + /** + * namespaces specifies a static list of namespace names that the term applies to. + * The term is applied to the union of the namespaces listed in this field + * and the ones selected by namespaceSelector. + * null or empty namespaces list and null namespaceSelector means "this pod's namespace". + * +optional + * +listType=atomic + */ + namespaces: string[]; + /** + * This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + * the labelSelector in the specified namespaces, where co-located is defined as running on a node + * whose value of the label with key topologyKey matches that of any node on which any of the + * selected pods is running. + * Empty topologyKey is not allowed. + */ + topologyKey?: string | undefined; + /** + * A label query over the set of namespaces that the term applies to. + * The term is applied to the union of the namespaces selected by this field + * and the ones listed in the namespaces field. + * null selector and null or empty namespaces list means "this pod's namespace". + * An empty selector ({}) matches all namespaces. + * +optional + */ + namespaceSelector?: LabelSelector | undefined; + /** + * MatchLabelKeys is a set of pod label keys to select which pods will + * be taken into consideration. The keys are used to lookup values from the + * incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + * to select the group of existing pods which pods will be taken into consideration + * for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + * pod labels will be ignored. The default value is empty. + * The same key is forbidden to exist in both matchLabelKeys and labelSelector. + * Also, matchLabelKeys cannot be set when labelSelector isn't set. + * + * +listType=atomic + * +optional + */ + matchLabelKeys: string[]; + /** + * MismatchLabelKeys is a set of pod label keys to select which pods will + * be taken into consideration. The keys are used to lookup values from the + * incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + * to select the group of existing pods which pods will be taken into consideration + * for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + * pod labels will be ignored. The default value is empty. + * The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + * Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + * + * +listType=atomic + * +optional + */ + mismatchLabelKeys: string[]; +} + +/** Pod anti affinity is a group of inter pod anti affinity scheduling rules. */ +export interface PodAntiAffinity { + /** + * If the anti-affinity requirements specified by this field are not met at + * scheduling time, the pod will not be scheduled onto the node. + * If the anti-affinity requirements specified by this field cease to be met + * at some point during pod execution (e.g. due to a pod label update), the + * system may or may not try to eventually evict the pod from its node. + * When there are multiple elements, the lists of nodes corresponding to each + * podAffinityTerm are intersected, i.e. all terms must be satisfied. + * +optional + * +listType=atomic + */ + requiredDuringSchedulingIgnoredDuringExecution: PodAffinityTerm[]; + /** + * The scheduler will prefer to schedule pods to nodes that satisfy + * the anti-affinity expressions specified by this field, but it may choose + * a node that violates one or more of the expressions. The node that is + * most preferred is the one with the greatest sum of weights, i.e. + * for each node that meets all of the scheduling requirements (resource + * request, requiredDuringScheduling anti-affinity expressions, etc.), + * compute a sum by iterating through the elements of this field and subtracting + * "weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the + * node(s) with the highest sum are the most preferred. + * +optional + * +listType=atomic + */ + preferredDuringSchedulingIgnoredDuringExecution: WeightedPodAffinityTerm[]; +} + +/** + * PodAttachOptions is the query options to a Pod's remote attach call. + * --- + * TODO: merge w/ PodExecOptions below for stdin, stdout, etc + * and also when we cut V2, we should export a "StreamOptions" or somesuch that contains Stdin, Stdout, Stder and TTY + */ +export interface PodAttachOptions { + /** + * Stdin if true, redirects the standard input stream of the pod for this call. + * Defaults to false. + * +optional + */ + stdin?: boolean | undefined; + /** + * Stdout if true indicates that stdout is to be redirected for the attach call. + * Defaults to true. + * +optional + */ + stdout?: boolean | undefined; + /** + * Stderr if true indicates that stderr is to be redirected for the attach call. + * Defaults to true. + * +optional + */ + stderr?: boolean | undefined; + /** + * TTY if true indicates that a tty will be allocated for the attach call. + * This is passed through the container runtime so the tty + * is allocated on the worker node by the container runtime. + * Defaults to false. + * +optional + */ + tty?: boolean | undefined; + /** + * The container in which to execute the command. + * Defaults to only container if there is only one container in the pod. + * +optional + */ + container?: string | undefined; +} + +/** + * PodCertificateProjection provides a private key and X.509 certificate in the + * pod filesystem. + */ +export interface PodCertificateProjection { + /** + * Kubelet's generated CSRs will be addressed to this signer. + * + * +required + */ + signerName?: string | undefined; + /** + * The type of keypair Kubelet will generate for the pod. + * + * Valid values are "RSA3072", "RSA4096", "ECDSAP256", "ECDSAP384", + * "ECDSAP521", and "ED25519". + * + * +required + */ + keyType?: string | undefined; + /** + * maxExpirationSeconds is the maximum lifetime permitted for the + * certificate. + * + * Kubelet copies this value verbatim into the PodCertificateRequests it + * generates for this projection. + * + * If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver + * will reject values shorter than 3600 (1 hour). The maximum allowable + * value is 7862400 (91 days). + * + * The signer implementation is then free to issue a certificate with any + * lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 + * seconds (1 hour). This constraint is enforced by kube-apiserver. + * `kubernetes.io` signers will never issue certificates with a lifetime + * longer than 24 hours. + * + * +optional + */ + maxExpirationSeconds?: number | undefined; + /** + * Write the credential bundle at this path in the projected volume. + * + * The credential bundle is a single file that contains multiple PEM blocks. + * The first PEM block is a PRIVATE KEY block, containing a PKCS#8 private + * key. + * + * The remaining blocks are CERTIFICATE blocks, containing the issued + * certificate chain from the signer (leaf and any intermediates). + * + * Using credentialBundlePath lets your Pod's application code make a single + * atomic read that retrieves a consistent key and certificate chain. If you + * project them to separate files, your application code will need to + * additionally check that the leaf certificate was issued to the key. + * + * +optional + */ + credentialBundlePath?: string | undefined; + /** + * Write the key at this path in the projected volume. + * + * Most applications should use credentialBundlePath. When using keyPath + * and certificateChainPath, your application needs to check that the key + * and leaf certificate are consistent, because it is possible to read the + * files mid-rotation. + * + * +optional + */ + keyPath?: string | undefined; + /** + * Write the certificate chain at this path in the projected volume. + * + * Most applications should use credentialBundlePath. When using keyPath + * and certificateChainPath, your application needs to check that the key + * and leaf certificate are consistent, because it is possible to read the + * files mid-rotation. + * + * +optional + */ + certificateChainPath?: string | undefined; + /** + * userAnnotations allow pod authors to pass additional information to + * the signer implementation. Kubernetes does not restrict or validate this + * metadata in any way. + * + * These values are copied verbatim into the `spec.unverifiedUserAnnotations` field of + * the PodCertificateRequest objects that Kubelet creates. + * + * Entries are subject to the same validation as object metadata annotations, + * with the addition that all keys must be domain-prefixed. No restrictions + * are placed on values, except an overall size limitation on the entire field. + * + * Signers should document the keys and values they support. Signers should + * deny requests that contain keys they do not recognize. + */ + userAnnotations: { [key: string]: string }; + /** + * user is Optional: The owner UID of the created file. + * If specified, the item-level user field takes precedence over defaultUser. + * (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + * +featureGate=AtomicWriteVolumeUserFields + * +optional + */ + user?: number | undefined; +} + +export interface PodCertificateProjection_UserAnnotationsEntry { + key: string; + value: string; +} + +/** PodCondition contains details for the current condition of this pod. */ +export interface PodCondition { + /** + * Type is the type of the condition. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions + */ + type?: string | undefined; + /** + * If set, this represents the .metadata.generation that the pod condition was set based upon. + * +optional + */ + observedGeneration?: number | undefined; + /** + * Status is the status of the condition. + * Can be True, False, Unknown. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions + */ + status?: string | undefined; + /** + * Last time we probed the condition. + * +optional + */ + lastProbeTime?: Time | undefined; + /** + * Last time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * Unique, one-word, CamelCase reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * Human-readable message indicating details about last transition. + * +optional + */ + message?: string | undefined; +} + +/** + * PodDNSConfig defines the DNS parameters of a pod in addition to + * those generated from DNSPolicy. + */ +export interface PodDNSConfig { + /** + * A list of DNS name server IP addresses. + * This will be appended to the base nameservers generated from DNSPolicy. + * Duplicated nameservers will be removed. + * +optional + * +listType=atomic + */ + nameservers: string[]; + /** + * A list of DNS search domains for host-name lookup. + * This will be appended to the base search paths generated from DNSPolicy. + * Duplicated search paths will be removed. + * +optional + * +listType=atomic + */ + searches: string[]; + /** + * A list of DNS resolver options. + * This will be merged with the base options generated from DNSPolicy. + * Duplicated entries will be removed. Resolution options given in Options + * will override those that appear in the base DNSPolicy. + * +optional + * +listType=atomic + */ + options: PodDNSConfigOption[]; +} + +/** PodDNSConfigOption defines DNS resolver options of a pod. */ +export interface PodDNSConfigOption { + /** + * Name is this DNS resolver option's name. + * Required. + */ + name?: string | undefined; + /** + * Value is this DNS resolver option's value. + * +optional + */ + value?: string | undefined; +} + +/** + * PodExecOptions is the query options to a Pod's remote exec call. + * --- + * TODO: This is largely identical to PodAttachOptions above, make sure they stay in sync and see about merging + * and also when we cut V2, we should export a "StreamOptions" or somesuch that contains Stdin, Stdout, Stder and TTY + */ +export interface PodExecOptions { + /** + * Redirect the standard input stream of the pod for this call. + * Defaults to false. + * +optional + */ + stdin?: boolean | undefined; + /** + * Redirect the standard output stream of the pod for this call. + * +optional + */ + stdout?: boolean | undefined; + /** + * Redirect the standard error stream of the pod for this call. + * +optional + */ + stderr?: boolean | undefined; + /** + * TTY if true indicates that a tty will be allocated for the exec call. + * Defaults to false. + * +optional + */ + tty?: boolean | undefined; + /** + * Container in which to execute the command. + * Defaults to only container if there is only one container in the pod. + * +optional + */ + container?: string | undefined; + /** + * Command is the remote command to execute. argv array. Not executed within a shell. + * +listType=atomic + */ + command: string[]; +} + +/** + * PodExtendedResourceClaimStatus is stored in the PodStatus for the extended + * resource requests backed by DRA. It stores the generated name for + * the corresponding special ResourceClaim created by the scheduler. + */ +export interface PodExtendedResourceClaimStatus { + /** + * RequestMappings identifies the mapping of to device request + * in the generated ResourceClaim. + * +listType=atomic + */ + requestMappings: ContainerExtendedResourceRequest[]; + /** + * ResourceClaimName is the name of the ResourceClaim that was + * generated for the Pod in the namespace of the Pod. + */ + resourceClaimName?: string | undefined; +} + +/** PodIP represents a single IP address allocated to the pod. */ +export interface PodIP { + /** + * IP is the IP address assigned to the pod + * +required + */ + ip?: string | undefined; +} + +/** PodList is a list of Pods. */ +export interface PodList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** + * List of pods. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md + */ + items: Pod[]; +} + +/** PodLogOptions is the query options for a Pod's logs REST call. */ +export interface PodLogOptions { + /** + * The container for which to stream logs. Defaults to only container if there is one container in the pod. + * +optional + */ + container?: string | undefined; + /** + * Follow the log stream of the pod. Defaults to false. + * +optional + */ + follow?: boolean | undefined; + /** + * Return previous terminated container logs. Defaults to false. + * +optional + */ + previous?: boolean | undefined; + /** + * A relative time in seconds before the current time from which to show logs. If this value + * precedes the time a pod was started, only logs since the pod start will be returned. + * If this value is in the future, no logs will be returned. + * Only one of sinceSeconds or sinceTime may be specified. + * +optional + */ + sinceSeconds?: number | undefined; + /** + * An RFC3339 timestamp from which to show logs. If this value + * precedes the time a pod was started, only logs since the pod start will be returned. + * If this value is in the future, no logs will be returned. + * Only one of sinceSeconds or sinceTime may be specified. + * +optional + */ + sinceTime?: Time | undefined; + /** + * If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line + * of log output. Defaults to false. + * +optional + */ + timestamps?: boolean | undefined; + /** + * If set, the number of lines from the end of the logs to show. If not specified, + * logs are shown from the creation of the container or sinceSeconds or sinceTime. + * Note that when "TailLines" is specified, "Stream" can only be set to nil or "All". + * +optional + */ + tailLines?: number | undefined; + /** + * If set, the number of bytes to read from the server before terminating the + * log output. This may not display a complete final line of logging, and may return + * slightly more or slightly less than the specified limit. + * +optional + */ + limitBytes?: number | undefined; + /** + * insecureSkipTLSVerifyBackend indicates that the apiserver should not confirm the validity of the + * serving certificate of the backend it is connecting to. This will make the HTTPS connection between the apiserver + * and the backend insecure. This means the apiserver cannot verify the log data it is receiving came from the real + * kubelet. If the kubelet is configured to verify the apiserver's TLS credentials, it does not mean the + * connection to the real kubelet is vulnerable to a man in the middle attack (e.g. an attacker could not intercept + * the actual log data coming from the real kubelet). + * +optional + */ + insecureSkipTLSVerifyBackend?: boolean | undefined; + /** + * Specify which container log stream to return to the client. + * Acceptable values are "All", "Stdout" and "Stderr". If not specified, "All" is used, and both stdout and stderr + * are returned interleaved. + * Note that when "TailLines" is specified, "Stream" can only be set to nil or "All". + * +featureGate=PodLogsQuerySplitStreams + * +optional + */ + stream?: string | undefined; +} + +/** PodOS defines the OS parameters of a pod. */ +export interface PodOS { + /** + * Name is the name of the operating system. The currently supported values are linux and windows. + * Additional value may be defined in future and can be one of: + * https://github.com/opencontainers/runtime-spec/blob/master/config.md#platform-specific-configuration + * Clients should expect to handle additional values and treat unrecognized values in this field as os: null + */ + name?: string | undefined; +} + +/** + * PodPortForwardOptions is the query options to a Pod's port forward call + * when using WebSockets. + * The `port` query parameter must specify the port or + * ports (comma separated) to forward over. + * Port forwarding over SPDY does not use these options. It requires the port + * to be passed in the `port` header as part of request. + */ +export interface PodPortForwardOptions { + /** + * List of ports to forward + * Required when using WebSockets + * +optional + * +listType=atomic + */ + ports: number[]; +} + +/** PodProxyOptions is the query options to a Pod's proxy call. */ +export interface PodProxyOptions { + /** + * Path is the URL path to use for the current proxy request to pod. + * +optional + */ + path?: string | undefined; +} + +/** PodReadinessGate contains the reference to a pod condition */ +export interface PodReadinessGate { + /** ConditionType refers to a condition in the pod's condition list with matching type. */ + conditionType?: string | undefined; +} + +/** + * PodResourceClaim references exactly one ResourceClaim, either directly + * or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim + * for the pod. + * + * It adds a name to it that uniquely identifies the ResourceClaim inside the Pod. + * Containers that need access to the ResourceClaim reference it with this name. + * + * When the DRAWorkloadResourceClaims feature gate is enabled and this Pod + * belongs to a PodGroup, a PodResourceClaim is matched to a + * PodGroupResourceClaim if all of their fields are equal (Name, + * ResourceClaimName, and ResourceClaimTemplateName). A matched claim references + * a single ResourceClaim shared across all Pods in the PodGroup, reserved for + * the PodGroup in ResourceClaimStatus.ReservedFor rather than for individual + * Pods. + */ +export interface PodResourceClaim { + /** + * Name uniquely identifies this resource claim inside the pod. + * This must be a DNS_LABEL. + */ + name?: string | undefined; + /** + * ResourceClaimName is the name of a ResourceClaim object in the same + * namespace as this pod. + * + * Exactly one of ResourceClaimName and ResourceClaimTemplateName must + * be set. + */ + resourceClaimName?: string | undefined; + /** + * ResourceClaimTemplateName is the name of a ResourceClaimTemplate + * object in the same namespace as this pod. + * + * The template will be used to create a new ResourceClaim, which will + * be bound to this pod. When this pod is deleted, the ResourceClaim + * will also be deleted. The pod name and resource name, along with a + * generated component, will be used to form a unique name for the + * ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses. + * + * When the DRAWorkloadResourceClaims feature gate is enabled and the pod + * belongs to a PodGroup that defines a PodGroupResourceClaim with the same + * Name and ResourceClaimTemplateName, this PodResourceClaim resolves to the + * ResourceClaim generated for the PodGroup. All pods in the group that + * define an equivalent PodResourceClaim matching the + * PodGroupResourceClaim's Name and ResourceClaimTemplateName share the same + * generated ResourceClaim. ResourceClaims generated for a PodGroup are + * owned by the PodGroup and their lifecycles are tied to the PodGroup + * instead of any individual pod. + * + * This field is immutable and no changes will be made to the + * corresponding ResourceClaim by the control plane after creating the + * ResourceClaim. + * + * Exactly one of ResourceClaimName and ResourceClaimTemplateName must + * be set. + */ + resourceClaimTemplateName?: string | undefined; +} + +/** + * PodResourceClaimStatus is stored in the PodStatus for each PodResourceClaim + * which references a ResourceClaimTemplate. It stores the generated name for + * the corresponding ResourceClaim. + */ +export interface PodResourceClaimStatus { + /** + * Name uniquely identifies this resource claim inside the pod. + * This must match the name of an entry in pod.spec.resourceClaims, + * which implies that the string must be a DNS_LABEL. + */ + name?: string | undefined; + /** + * ResourceClaimName is the name of the ResourceClaim that was + * generated for the Pod in the namespace of the Pod. + * + * When the DRAWorkloadResourceClaims feature is enabled and the + * corresponding PodResourceClaim matches a PodGroupResourceClaim + * made by the Pod's PodGroup, then this is the name of the + * ResourceClaim generated and reserved for the PodGroup. + * + * If this is unset, then generating a ResourceClaim was not + * necessary. The pod.spec.resourceClaims entry can be ignored in + * this case. + * + * +optional + */ + resourceClaimName?: string | undefined; +} + +/** PodSchedulingGate is associated to a Pod to guard its scheduling. */ +export interface PodSchedulingGate { + /** + * Name of the scheduling gate. + * Each scheduling gate must have a unique name field. + */ + name?: string | undefined; +} + +/** + * PodSchedulingGroup identifies the runtime scheduling group instance that a Pod belongs to. + * The scheduler uses this information to apply workload-aware scheduling semantics. + * Exactly one field must be specified. + * +union + */ +export interface PodSchedulingGroup { + /** + * PodGroupName specifies the name of the standalone PodGroup object + * that represents the runtime instance of this group. + * Must be a DNS subdomain. + * + * +optional + * +oneOf=GroupSelection + */ + podGroupName?: string | undefined; +} + +/** + * 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 { + /** + * The SELinux context to be applied to all containers. + * If unspecified, the container runtime will allocate a random SELinux context for each + * container. May also be set in SecurityContext. If set in + * both SecurityContext and PodSecurityContext, the value specified in SecurityContext + * takes precedence for that container. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + seLinuxOptions?: SELinuxOptions | undefined; + /** + * The Windows specific settings applied to all containers. + * If unspecified, the options within a container's SecurityContext will be used. + * If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + * Note that this field cannot be set when spec.os.name is linux. + * +optional + */ + windowsOptions?: WindowsSecurityContextOptions | undefined; + /** + * The UID to run the entrypoint of the container process. + * Defaults to user specified in image metadata if unspecified. + * May also be set in SecurityContext. If set in both SecurityContext and + * PodSecurityContext, the value specified in SecurityContext takes precedence + * for that container. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + runAsUser?: number | undefined; + /** + * The GID to run the entrypoint of the container process. + * Uses runtime default if unset. + * May also be set in SecurityContext. If set in both SecurityContext and + * PodSecurityContext, the value specified in SecurityContext takes precedence + * for that container. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + runAsGroup?: number | undefined; + /** + * Indicates that the container must run as a non-root user. + * If true, the Kubelet will validate the image at runtime to ensure that it + * does not run as UID 0 (root) and fail to start the container if it does. + * If unset or false, no such validation will be performed. + * May also be set in SecurityContext. If set in both SecurityContext and + * PodSecurityContext, the value specified in SecurityContext takes precedence. + * +optional + */ + runAsNonRoot?: boolean | undefined; + /** + * A list of groups applied to the first process run in each container, in + * addition to the container's primary GID and fsGroup (if specified). If + * the SupplementalGroupsPolicy feature is enabled, the + * supplementalGroupsPolicy field determines whether these are in addition + * to or instead of any group memberships defined in the container image. + * If unspecified, no additional groups are added, though group memberships + * defined in the container image may still be used, depending on the + * supplementalGroupsPolicy field. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + * +listType=atomic + */ + supplementalGroups: number[]; + /** + * Defines how supplemental groups of the first container processes are calculated. + * Valid values are "Merge" and "Strict". If not specified, "Merge" is used. + * (Alpha) Using the field requires the SupplementalGroupsPolicy feature gate to be enabled + * and the container runtime must implement support for this feature. + * Note that this field cannot be set when spec.os.name is windows. + * TODO: update the default value to "Merge" when spec.os.name is not windows in v1.34 + * +featureGate=SupplementalGroupsPolicy + * +optional + */ + supplementalGroupsPolicy?: string | undefined; + /** + * A special supplemental group that applies to all containers in a pod. + * Some volume types allow the Kubelet to change the ownership of that volume + * to be owned by the pod: + * + * 1. The owning GID will be the FSGroup + * 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) + * 3. The permission bits are OR'd with rw-rw---- + * + * If unset, the Kubelet will not modify the ownership and permissions of any volume. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + fsGroup?: number | undefined; + /** + * Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported + * sysctls (by the container runtime) might fail to launch. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + * +listType=atomic + */ + sysctls: Sysctl[]; + /** + * fsGroupChangePolicy defines behavior of changing ownership and permission of the volume + * before being exposed inside Pod. This field will only apply to + * volume types which support fsGroup based ownership(and permissions). + * It will have no effect on ephemeral volume types such as: secret, configmaps + * and emptydir. + * Valid values are "OnRootMismatch" and "Always". If not specified, "Always" is used. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + fsGroupChangePolicy?: string | undefined; + /** + * The seccomp options to use by the containers in this pod. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + seccompProfile?: SeccompProfile | undefined; + /** + * appArmorProfile is the AppArmor options to use by the containers in this pod. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + appArmorProfile?: AppArmorProfile | undefined; + /** + * seLinuxChangePolicy defines how the container's SELinux label is applied to all volumes used by the Pod. + * It has no effect on nodes that do not support SELinux or to volumes does not support SELinux. + * Valid values are "MountOption" and "Recursive". + * + * "Recursive" means relabeling of all files on all Pod volumes by the container runtime. + * This may be slow for large volumes, but allows mixing privileged and unprivileged Pods sharing the same volume on the same node. + * + * "MountOption" mounts all eligible Pod volumes with `-o context` mount option. + * This requires all Pods that share the same volume to use the same SELinux label. + * It is not possible to share the same volume among privileged and unprivileged Pods. + * Eligible volumes are in-tree FibreChannel and iSCSI volumes, and all CSI volumes + * whose CSI driver announces SELinux support by setting spec.seLinuxMount: true in their + * CSIDriver instance. Other volumes are always re-labelled recursively. + * + * If not specified, "MountOption" is used. + * + * This field affects only Pods that have SELinux label set, either in PodSecurityContext or in SecurityContext of all containers. + * + * All Pods that use the same volume should use the same seLinuxChangePolicy, otherwise some pods can get stuck in ContainerCreating state. + * Note that this field cannot be set when spec.os.name is windows. + * +featureGate=SELinuxChangePolicy + * +optional + */ + seLinuxChangePolicy?: string | undefined; +} + +/** + * Describes the class of pods that should avoid this node. + * Exactly one field should be set. + */ +export interface PodSignature { + /** + * Reference to controller whose pods should avoid this node. + * +optional + */ + podController?: OwnerReference | undefined; +} + +/** PodSpec is a description of a pod. */ +export interface PodSpec { + /** + * List of volumes that can be mounted by containers belonging to the pod. + * More info: https://kubernetes.io/docs/concepts/storage/volumes + * +optional + * +patchMergeKey=name + * +patchStrategy=merge,retainKeys + * +listType=map + * +listMapKey=name + */ + volumes: Volume[]; + /** + * List of initialization containers belonging to the pod. + * Init containers are executed in order prior to containers being started. If any + * init container fails, the pod is considered to have failed and is handled according + * to its restartPolicy. The name for an init container or normal container must be + * unique among all containers. + * Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. + * The resourceRequirements of an init container are taken into account during scheduling + * by finding the highest request/limit for each resource type, and then using the max of + * that value or the sum of the normal containers. Limits are applied to init containers + * in a similar fashion. + * Init containers cannot currently be added or removed. + * Cannot be updated. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + */ + initContainers: Container[]; + /** + * List of containers belonging to the pod. + * Containers cannot currently be added or removed. + * There must be at least one container in a Pod. + * Cannot be updated. + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + */ + containers: Container[]; + /** + * List of ephemeral containers run in this pod. Ephemeral containers may be run in an existing + * pod to perform user-initiated actions such as debugging. This list cannot be specified when + * creating a pod, and it cannot be modified by updating the pod spec. In order to add an + * ephemeral container to an existing pod, use the pod's ephemeralcontainers subresource. + * +optional + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + */ + ephemeralContainers: EphemeralContainer[]; + /** + * Restart policy for all containers within the pod. + * One of Always, OnFailure, Never. In some contexts, only a subset of those values may be permitted. + * Default to Always. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy + * +optional + */ + restartPolicy?: string | undefined; + /** + * Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. + * Value must be non-negative integer. The value zero indicates stop immediately via + * the kill signal (no opportunity to shut down). + * If this value is nil, the default grace period will be used instead. + * The grace period is the duration in seconds after the processes running in the pod are sent + * a termination signal and the time when the processes are forcibly halted with a kill signal. + * Set this value longer than the expected cleanup time for your process. + * Defaults to 30 seconds. + * +optional + */ + terminationGracePeriodSeconds?: number | undefined; + /** + * Optional duration in seconds the pod may be active on the node relative to + * StartTime before the system will actively try to mark it failed and kill associated containers. + * Value must be a positive integer. + * +optional + */ + activeDeadlineSeconds?: number | undefined; + /** + * Set DNS policy for the pod. + * Defaults to "ClusterFirst". + * Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. + * DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. + * To have DNS options set along with hostNetwork, you have to specify DNS policy + * explicitly to 'ClusterFirstWithHostNet'. + * +optional + */ + dnsPolicy?: string | undefined; + /** + * NodeSelector is a selector which must be true for the pod to fit on a node. + * Selector which must match a node's labels for the pod to be scheduled on that node. + * More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + * +optional + * +mapType=atomic + */ + nodeSelector: { [key: string]: string }; + /** + * ServiceAccountName is the name of the ServiceAccount to use to run this pod. + * More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ + * +optional + */ + serviceAccountName?: string | undefined; + /** + * DeprecatedServiceAccount is a deprecated alias for ServiceAccountName. + * Deprecated: Use serviceAccountName instead. + * +optional + */ + serviceAccount?: string | undefined; + /** + * AutomountServiceAccountToken indicates whether a service account token should be automatically mounted. + * +optional + */ + automountServiceAccountToken?: boolean | undefined; + /** + * NodeName indicates in which node this pod is scheduled. + * If empty, this pod is a candidate for scheduling by the scheduler defined in schedulerName. + * Once this field is set, the kubelet for this node becomes responsible for the lifecycle of this pod. + * This field should not be used to express a desire for the pod to be scheduled on a specific node. + * https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodename + * +optional + */ + nodeName?: string | undefined; + /** + * Host networking requested for this pod. Use the host's network namespace. + * When using HostNetwork you should specify ports so the scheduler is aware. + * When `hostNetwork` is true, specified `hostPort` fields in port definitions must match `containerPort`, + * and unspecified `hostPort` fields in port definitions are defaulted to match `containerPort`. + * Default to false. + * +optional + */ + hostNetwork?: boolean | undefined; + /** + * Use the host's pid namespace. + * Optional: Default to false. + * +optional + */ + hostPID?: boolean | undefined; + /** + * Use the host's ipc namespace. + * Optional: Default to false. + * +optional + */ + hostIPC?: boolean | undefined; + /** + * Share a single process namespace between all of the containers in a pod. + * When this is set containers will be able to view and signal processes from other containers + * in the same pod, and the first process in each container will not be assigned PID 1. + * HostPID and ShareProcessNamespace cannot both be set. + * Optional: Default to false. + * +optional + */ + shareProcessNamespace?: boolean | undefined; + /** + * SecurityContext holds pod-level security attributes and common container settings. + * Optional: Defaults to empty. See type description for default values of each field. + * +optional + */ + securityContext?: PodSecurityContext | undefined; + /** + * ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. + * If specified, these secrets will be passed to individual puller implementations for them to use. + * More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod + * +optional + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + */ + imagePullSecrets: LocalObjectReference[]; + /** + * Specifies the hostname of the Pod + * If not specified, the pod's hostname will be set to a system-defined value. + * +optional + */ + hostname?: string | undefined; + /** + * If specified, the fully qualified Pod hostname will be "...svc.". + * If not specified, the pod will not have a domainname at all. + * +optional + */ + subdomain?: string | undefined; + /** + * If specified, the pod's scheduling constraints + * +optional + */ + affinity?: Affinity | undefined; + /** + * If specified, the pod will be dispatched by specified scheduler. + * If not specified, the pod will be dispatched by default scheduler. + * +optional + */ + schedulerName?: string | undefined; + /** + * If specified, the pod's tolerations. + * +optional + * +listType=atomic + * +k8s:alpha(since: "1.37")=+k8s:optional + */ + tolerations: Toleration[]; + /** + * HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts + * file if specified. + * +optional + * +patchMergeKey=ip + * +patchStrategy=merge + * +listType=map + * +listMapKey=ip + */ + hostAliases: HostAlias[]; + /** + * If specified, indicates the pod's priority. "system-node-critical" and + * "system-cluster-critical" are two special keywords which indicate the + * highest priorities with the former being the highest priority. Any other + * name must be defined by creating a PriorityClass object with that name. + * If not specified, the pod priority will be default or zero if there is no + * default. + * +optional + */ + priorityClassName?: string | undefined; + /** + * The priority value. Various system components use this field to find the + * priority of the pod. When Priority Admission Controller is enabled, it + * prevents users from setting this field. The admission controller populates + * this field from PriorityClassName. + * The higher the value, the higher the priority. + * +optional + */ + priority?: number | undefined; + /** + * Specifies the DNS parameters of a pod. + * Parameters specified here will be merged to the generated DNS + * configuration based on DNSPolicy. + * +optional + */ + dnsConfig?: PodDNSConfig | undefined; + /** + * If specified, all readiness gates will be evaluated for pod readiness. + * A pod is ready when all its containers are ready AND + * all conditions specified in the readiness gates have status equal to "True" + * More info: https://git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates + * +optional + * +listType=atomic + */ + readinessGates: PodReadinessGate[]; + /** + * RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used + * to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. + * If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an + * empty definition that uses the default runtime handler. + * More info: https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class + * +optional + */ + runtimeClassName?: string | undefined; + /** + * EnableServiceLinks indicates whether information about services should be injected into pod's + * environment variables, matching the syntax of Docker links. + * Optional: Defaults to true. + * +optional + */ + enableServiceLinks?: boolean | undefined; + /** + * PreemptionPolicy is the Policy for preempting pods with lower priority. + * One of Never, PreemptLowerPriority. + * When Priority Admission Controller is enabled, it prevents users from setting + * this field. The admission controller populates this field from PriorityClassName. + * Defaults to PreemptLowerPriority if unset. + * +optional + */ + preemptionPolicy?: string | undefined; + /** + * Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. + * This field will be autopopulated at admission time by the RuntimeClass admission controller. If + * the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. + * The RuntimeClass admission controller will reject Pod create requests which have the overhead already + * set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value + * defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. + * More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md + * +optional + */ + overhead: { [key: string]: Quantity }; + /** + * TopologySpreadConstraints describes how a group of pods ought to spread across topology + * domains. Scheduler will schedule pods in a way which abides by the constraints. + * All topologySpreadConstraints are ANDed. + * +optional + * +patchMergeKey=topologyKey + * +patchStrategy=merge + * +listType=map + * +listMapKey=topologyKey + * +listMapKey=whenUnsatisfiable + */ + topologySpreadConstraints: TopologySpreadConstraint[]; + /** + * If true the pod's hostname will be configured as the pod's FQDN, rather than the leaf name (the default). + * In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). + * In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters to FQDN. + * If a pod does not have FQDN, this has no effect. + * Default to false. + * +optional + */ + setHostnameAsFQDN?: boolean | undefined; + /** + * Specifies the OS of the containers in the pod. + * Some pod and container fields are restricted if this is set. + * + * If the OS field is set to linux, the following fields must be unset: + * -securityContext.windowsOptions + * + * If the OS field is set to windows, following fields must be unset: + * - spec.hostPID + * - spec.hostIPC + * - spec.hostUsers + * - spec.resources + * - spec.securityContext.appArmorProfile + * - spec.securityContext.seLinuxOptions + * - spec.securityContext.seccompProfile + * - spec.securityContext.fsGroup + * - spec.securityContext.fsGroupChangePolicy + * - spec.securityContext.sysctls + * - spec.shareProcessNamespace + * - spec.securityContext.runAsUser + * - spec.securityContext.runAsGroup + * - spec.securityContext.supplementalGroups + * - spec.securityContext.supplementalGroupsPolicy + * - spec.containers[*].securityContext.appArmorProfile + * - spec.containers[*].securityContext.seLinuxOptions + * - spec.containers[*].securityContext.seccompProfile + * - spec.containers[*].securityContext.capabilities + * - spec.containers[*].securityContext.readOnlyRootFilesystem + * - spec.containers[*].securityContext.privileged + * - spec.containers[*].securityContext.allowPrivilegeEscalation + * - spec.containers[*].securityContext.procMount + * - spec.containers[*].securityContext.runAsUser + * - spec.containers[*].securityContext.runAsGroup + * +optional + */ + os?: PodOS | undefined; + /** + * Use the host's user namespace. + * Optional: Default to true. + * If set to true or not present, the pod will be run in the host user namespace, useful + * for when the pod needs a feature only available to the host user namespace, such as + * loading a kernel module with CAP_SYS_MODULE. + * When set to false, a new userns is created for the pod. Setting false is useful for + * mitigating container breakout vulnerabilities even allowing users to run their + * containers as root without actually having root privileges on the host. + * +optional + */ + hostUsers?: boolean | undefined; + /** + * SchedulingGates is an opaque list of values that if specified will block scheduling the pod. + * If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the + * scheduler will not attempt to schedule the pod. + * + * SchedulingGates can only be set at pod creation time, and be removed only afterwards. + * + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + * +optional + */ + schedulingGates: PodSchedulingGate[]; + /** + * ResourceClaims defines which ResourceClaims must be allocated + * and reserved before the Pod is allowed to start. The resources + * will be made available to those containers which consume them + * by name. + * + * This is a stable field but requires that the + * DynamicResourceAllocation feature gate is enabled. + * + * This field is immutable. + * + * +patchMergeKey=name + * +patchStrategy=merge,retainKeys + * +listType=map + * +listMapKey=name + * +featureGate=DynamicResourceAllocation + * +optional + */ + resourceClaims: PodResourceClaim[]; + /** + * Resources is the total amount of CPU and Memory resources required by all + * containers in the pod. It supports specifying Requests and Limits for + * "cpu", "memory" and "hugepages-" resource names only. ResourceClaims are not supported. + * + * This field enables fine-grained control over resource allocation for the + * entire pod, allowing resource sharing among containers in a pod. + * TODO: For beta graduation, expand this comment with a detailed explanation. + * + * This is an alpha field and requires enabling the PodLevelResources feature + * gate. + * + * +featureGate=PodLevelResources + * +optional + */ + resources?: ResourceRequirements | undefined; + /** + * HostnameOverride specifies an explicit override for the pod's hostname as perceived by the pod. + * This field only specifies the pod's hostname and does not affect its DNS records. + * When this field is set to a non-empty string: + * - It takes precedence over the values set in `hostname` and `subdomain`. + * - The Pod's hostname will be set to this value. + * - `setHostnameAsFQDN` must be nil or set to false. + * - `hostNetwork` must be set to false. + * + * This field must be a valid DNS subdomain as defined in RFC 1123 and contain at most 64 characters. + * + * +featureGate=HostnameOverride + * +optional + */ + hostnameOverride?: string | undefined; + /** + * SchedulingGroup provides a reference to the immediate scheduling runtime + * grouping object that this Pod belongs to. + * This field is used by the scheduler to identify the group and apply the + * correct group scheduling policies. The association with a group also + * impacts other lifecycle aspects of a Pod that are relevant in a wider context + * of scheduling like preemption, resource attachment, etc. If not specified, + * the Pod is treated as a single unit in all of these aspects. + * The group object referenced by this field may not exist at the time the + * Pod is created. + * This field is immutable, but a group object with the same name may be + * recreated with different policies. Doing this during pod scheduling + * may result in the placement not conforming to the expected policies. + * + * +featureGate=GenericWorkload + * +optional + */ + schedulingGroup?: PodSchedulingGroup | undefined; + /** + * evictionResponders reference responders that react to Evictions based on EvictionRequests. + * Responders should observe and communicate through the Eviction Resource API to help with + * the graceful termination of a pod. The responders are selected sequentially, according to + * their specified priority. + * + * Responders should periodically report on an eviction progress by updating the + * .status.responders[].heartbeatTime field of the Eviction object. If this field is not updated + * within the heartbeat deadline defined by the Eviction API (currently 20 minutes), the eviction + * is passed over to the next responder with a lower priority. If there is no other responder, + * the last default imperative-eviction.k8s.io/evictor responder with a priority of 100 will + * evict the pod using the imperative Eviction API (pods//eviction subresource). + * + * The maximum length of the responders list is 10. + * Responders are not supported when the pod is part of a PodGroup (.spec.schedulingGroup is set). + * This field can only be set on creation and is immutable afterwards. + * +featureGate=EvictionRequestAPI + * +optional + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + * +k8s:optional + * +k8s:listType=map + * +k8s:listMapKey=name + * +k8s:maxItems=10 + * +k8s:alpha(since: "1.37")=+k8s:dependentForbidden("schedulingGroup") + */ + evictionResponders: EvictionResponder[]; +} + +export interface PodSpec_NodeSelectorEntry { + key: string; + value: string; +} + +export interface PodSpec_OverheadEntry { + key: string; + value: Quantity | undefined; +} + +/** + * PodStatus represents information about the status of a pod. Status may trail the actual + * state of a system, especially if the node that hosts the pod cannot contact the control + * plane. + */ +export interface PodStatus { + /** + * If set, this represents the .metadata.generation that the pod status was set based upon. + * The PodObservedGenerationTracking feature gate must be enabled to use this field. + * +optional + */ + observedGeneration?: number | undefined; + /** + * The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. + * The conditions array, the reason and message fields, and the individual container status + * arrays contain more detail about the pod's status. + * There are five possible phase values: + * + * Pending: The pod has been accepted by the Kubernetes system, but one or more of the + * container images has not been created. This includes time before being scheduled as + * well as time spent downloading images over the network, which could take a while. + * Running: The pod has been bound to a node, and all of the containers have been created. + * At least one container is still running, or is in the process of starting or restarting. + * Succeeded: All containers in the pod have terminated in success, and will not be restarted. + * Failed: All containers in the pod have terminated, and at least one container has + * terminated in failure. The container either exited with non-zero status or was terminated + * by the system. + * Unknown: For some reason the state of the pod could not be obtained, typically due to an + * error in communicating with the host of the pod. + * + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase + * +optional + */ + phase?: string | undefined; + /** + * Current service state of pod. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: PodCondition[]; + /** + * A human readable message indicating details about why the pod is in this condition. + * +optional + */ + message?: string | undefined; + /** + * A brief CamelCase message indicating details about why the pod is in this state. + * e.g. 'Evicted' + * +optional + */ + reason?: string | undefined; + /** + * nominatedNodeName is set only when this pod preempts other pods on the node, but it cannot be + * scheduled right away as preemption victims receive their graceful termination periods. + * This field does not guarantee that the pod will be scheduled on this node. Scheduler may decide + * to place the pod elsewhere if other nodes become available sooner. Scheduler may also decide to + * give the resources on this node to a higher priority pod that is created after preemption. + * As a result, this field may be different than PodSpec.nodeName when the pod is + * scheduled. + * +optional + */ + nominatedNodeName?: string | undefined; + /** + * hostIP holds the IP address of the host to which the pod is assigned. Empty if the pod has not started yet. + * A pod can be assigned to a node that has a problem in kubelet which in turns mean that HostIP will + * not be updated even if there is a node is assigned to pod + * +optional + */ + hostIP?: string | undefined; + /** + * hostIPs holds the IP addresses allocated to the host. If this field is specified, the first entry must + * match the hostIP field. This list is empty if the pod has not started yet. + * A pod can be assigned to a node that has a problem in kubelet which in turns means that HostIPs will + * not be updated even if there is a node is assigned to this pod. + * +optional + * +patchStrategy=merge + * +patchMergeKey=ip + * +listType=atomic + */ + hostIPs: HostIP[]; + /** + * podIP address allocated to the pod. Routable at least within the cluster. + * Empty if not yet allocated. + * +optional + */ + podIP?: string | undefined; + /** + * podIPs holds the IP addresses allocated to the pod. If this field is specified, the 0th entry must + * match the podIP field. Pods may be allocated at most 1 value for each of IPv4 and IPv6. This list + * is empty if no IPs have been allocated yet. + * +optional + * +patchStrategy=merge + * +patchMergeKey=ip + * +listType=map + * +listMapKey=ip + */ + podIPs: PodIP[]; + /** + * RFC 3339 date and time at which the object was acknowledged by the Kubelet. + * This is before the Kubelet pulled the container image(s) for the pod. + * +optional + */ + startTime?: Time | undefined; + /** + * Statuses of init containers in this pod. The most recent successful non-restartable + * init container will have ready = true, the most recently started container will have + * startTime set. + * Each init container in the pod should have at most one status in this list, + * and all statuses should be for containers in the pod. + * However this is not enforced. + * If a status for a non-existent container is present in the list, or the list has duplicate names, + * the behavior of various Kubernetes components is not defined and those statuses might be + * ignored. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-and-container-status + * +listType=atomic + */ + initContainerStatuses: ContainerStatus[]; + /** + * Statuses of containers in this pod. + * Each container in the pod should have at most one status in this list, + * and all statuses should be for containers in the pod. + * However this is not enforced. + * If a status for a non-existent container is present in the list, or the list has duplicate names, + * the behavior of various Kubernetes components is not defined and those statuses might be + * ignored. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status + * +optional + * +listType=atomic + */ + containerStatuses: ContainerStatus[]; + /** + * The Quality of Service (QOS) classification assigned to the pod based on resource requirements + * See PodQOSClass type for available QOS classes + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#quality-of-service-classes + * +optional + */ + qosClass?: string | undefined; + /** + * Statuses for any ephemeral containers that have run in this pod. + * Each ephemeral container in the pod should have at most one status in this list, + * and all statuses should be for containers in the pod. + * However this is not enforced. + * If a status for a non-existent container is present in the list, or the list has duplicate names, + * the behavior of various Kubernetes components is not defined and those statuses might be + * ignored. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status + * +optional + * +listType=atomic + */ + ephemeralContainerStatuses: ContainerStatus[]; + /** + * Status of resources resize desired for pod's containers. + * It is empty if no resources resize is pending. + * Any changes to container resources will automatically set this to "Proposed" + * Deprecated: Resize status is moved to two pod conditions PodResizePending and PodResizeInProgress. + * PodResizePending will track states where the spec has been resized, but the Kubelet has not yet allocated the resources. + * PodResizeInProgress will track in-progress resizes, and should be present whenever allocated resources != acknowledged resources. + * +featureGate=InPlacePodVerticalScaling + * +optional + */ + resize?: string | undefined; + /** + * Status of resource claims. + * +patchMergeKey=name + * +patchStrategy=merge,retainKeys + * +listType=map + * +listMapKey=name + * +featureGate=DynamicResourceAllocation + * +optional + */ + resourceClaimStatuses: PodResourceClaimStatus[]; + /** + * Status of extended resource claim backed by DRA. + * +featureGate=DRAExtendedResource + * +optional + */ + extendedResourceClaimStatus?: PodExtendedResourceClaimStatus | undefined; + /** + * AllocatedResources is the total requests allocated for this pod by the node. + * If pod-level requests are not set, this will be the total requests aggregated + * across containers in the pod. + * +featureGate=InPlacePodLevelResourcesVerticalScaling + * +optional + */ + allocatedResources: { [key: string]: Quantity }; + /** + * Resources represents the compute resource requests and limits that have been + * applied at the pod level if pod-level requests or limits are set in + * PodSpec.Resources + * +featureGate=InPlacePodLevelResourcesVerticalScaling + * +optional + */ + resources?: ResourceRequirements | undefined; + /** + * NodeAllocatableResourceClaimStatuses contains the status of node-allocatable resources + * that were allocated for this pod through DRA claims. This includes resources currently + * reported in v1.Node `status.allocatable` that are not extended resources + * (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + * Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + * +featureGate=DRANodeAllocatableResources + * +optional + * +patchStrategy=merge + * +patchMergeKey=resourceClaimName + * +listType=map + * +listMapKey=resourceClaimName + * +k8s:optional + * +k8s:listType=map + * +k8s:listMapKey=resourceClaimName + */ + nodeAllocatableResourceClaimStatuses: NodeAllocatableResourceClaimStatus[]; + /** + * volumeHealth contains node-reported health for each volume the pod is using. + * Populated by the kubelet on the pod's node. + * +featureGate=CSIVolumeHealth + * +optional + * +listType=map + * +listMapKey=name + * +k8s:optional + * +k8s:listType=map + * +k8s:listMapKey=name + */ + volumeHealth: PodVolumeHealth[]; +} + +export interface PodStatus_AllocatedResourcesEntry { + key: string; + value: Quantity | undefined; +} + +/** PodTemplate describes a template for creating copies of a predefined pod. */ +export interface PodTemplate { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Template defines the pods that will be created from this pod template. + * https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + template?: PodTemplateSpec | undefined; +} + +/** PodTemplateList is a list of PodTemplates. */ +export interface PodTemplateList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of pod templates */ + items: PodTemplate[]; +} + +/** PodTemplateSpec describes the data a pod should have when created from a template */ +export interface PodTemplateSpec { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * Specification of the desired behavior of the pod. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: PodSpec | undefined; +} + +/** + * PodVolumeHealth contains health information for a volume used by a pod, + * reported by the CSI node plugin via the kubelet. + */ +export interface PodVolumeHealth { + /** + * name matches an entry in pod.spec.volumes. + * +required + * +k8s:required + */ + name?: string | undefined; + /** + * conditions is the set of adverse conditions reported by + * the CSI node plugin for this volume on this node. + * At most 16 conditions may be reported. + * +optional + * +listType=map + * +listMapKey=status + * +patchMergeKey=status + * +patchStrategy=merge + * +listMapKey=reason + * +k8s:optional + * +k8s:listType=map + * +k8s:listMapKey=status + * +k8s:listMapKey=reason + * +k8s:maxItems=16 + */ + healthConditions: VolumeHealthCondition[]; + /** + * lastTransitionTime is when the current set of conditions first appeared. + * +optional + */ + lastTransitionTime?: Time | undefined; +} + +/** PortStatus represents the error condition of a service port */ +export interface PortStatus { + /** Port is the port number of the service port of which status is recorded here */ + port?: number | undefined; + /** + * Protocol is the protocol of the service port of which status is recorded here + * The supported values are: "TCP", "UDP", "SCTP" + */ + protocol?: string | undefined; + /** + * Error is to record the problem with the service port + * The format of the error shall comply with the following rules: + * - built-in error values shall be specified in this file and those shall use + * CamelCase names + * - cloud provider specific error values must have names that comply with the + * format foo.example.com/CamelCase. + * --- + * The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + * +optional + * +kubebuilder:validation:Required + * +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)* /)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` + * +kubebuilder:validation:MaxLength=316 + */ + error?: string | undefined; +} + +/** PortworxVolumeSource represents a Portworx volume resource. */ +export interface PortworxVolumeSource { + /** volumeID uniquely identifies a Portworx volume */ + volumeID?: string | undefined; + /** + * fSType represents the filesystem type to mount + * Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. + */ + fsType?: string | undefined; + /** + * readOnly defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * +optional + */ + readOnly?: boolean | undefined; +} + +/** + * Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out. + * +k8s:openapi-gen=false + */ +export interface Preconditions { + /** + * Specifies the target UID. + * +optional + */ + uid?: string | undefined; +} + +/** Describes a class of pods that should avoid this node. */ +export interface PreferAvoidPodsEntry { + /** The class of pods. */ + podSignature?: PodSignature | undefined; + /** + * Time at which this entry was added to the list. + * +optional + */ + evictionTime?: Time | undefined; + /** + * (brief) reason why this entry was added to the list. + * +optional + */ + reason?: string | undefined; + /** + * Human readable message indicating why this entry was added to the list. + * +optional + */ + message?: string | undefined; +} + +/** + * An empty preferred scheduling term matches all objects with implicit weight 0 + * (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). + */ +export interface PreferredSchedulingTerm { + /** Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. */ + weight?: number | undefined; + /** A node selector term, associated with the corresponding weight. */ + preference?: NodeSelectorTerm | undefined; +} + +/** + * Probe describes a health check to be performed against a container to determine whether it is + * alive or ready to receive traffic. + */ +export interface Probe { + /** The action taken to determine the health of a container */ + handler?: ProbeHandler | undefined; + /** + * Number of seconds after the container has started before liveness probes are initiated. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + * +optional + */ + initialDelaySeconds?: number | undefined; + /** + * Number of seconds after which the probe times out. + * Defaults to 1 second. Minimum value is 1. + * More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + * +optional + */ + timeoutSeconds?: number | undefined; + /** + * How often (in seconds) to perform the probe. + * Default to 10 seconds. Minimum value is 1. + * +optional + */ + periodSeconds?: number | undefined; + /** + * Minimum consecutive successes for the probe to be considered successful after having failed. + * Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. + * +optional + */ + successThreshold?: number | undefined; + /** + * Minimum consecutive failures for the probe to be considered failed after having succeeded. + * Defaults to 3. Minimum value is 1. + * +optional + */ + failureThreshold?: number | undefined; + /** + * Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + * The grace period is the duration in seconds after the processes running in the pod are sent + * a termination signal and the time when the processes are forcibly halted with a kill signal. + * Set this value longer than the expected cleanup time for your process. + * If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + * value overrides the value provided by the pod spec. + * Value must be non-negative integer. The value zero indicates stop immediately via + * the kill signal (no opportunity to shut down). + * This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + * Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. + * +optional + */ + terminationGracePeriodSeconds?: number | undefined; +} + +/** + * ProbeHandler defines a specific action that should be taken in a probe. + * One and only one of the fields must be specified. + */ +export interface ProbeHandler { + /** + * Exec specifies a command to execute in the container. + * +optional + */ + exec?: ExecAction | undefined; + /** + * HTTPGet specifies an HTTP GET request to perform. + * +optional + */ + httpGet?: HTTPGetAction | undefined; + /** + * TCPSocket specifies a connection to a TCP port. + * +optional + */ + tcpSocket?: TCPSocketAction | undefined; + /** + * GRPC specifies a GRPC HealthCheckRequest. + * +optional + */ + grpc?: GRPCAction | undefined; +} + +/** Represents a projected volume source */ +export interface ProjectedVolumeSource { + /** + * sources is the list of volume projections. Each entry in this list + * handles one source. + * +optional + * +listType=atomic + */ + sources: VolumeProjection[]; + /** + * defaultMode are the mode bits used to set permissions on created files by default. + * Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + * YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + * Directories within the path are not affected by this setting. + * This might be in conflict with other options that affect the file + * mode, like fsGroup, and the result can be other mode bits set. + * +optional + */ + defaultMode?: number | undefined; + /** + * defaultUser is Optional: The owner UID of the created files by default. + * The defaultUser field is only used as a fallback when the item-level user field is unset. + * (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + * +featureGate=AtomicWriteVolumeUserFields + * +optional + */ + defaultUser?: number | undefined; +} + +/** + * Represents a Quobyte mount that lasts the lifetime of a pod. + * Quobyte volumes do not support ownership management or SELinux relabeling. + */ +export interface QuobyteVolumeSource { + /** + * registry represents a single or multiple Quobyte Registry services + * specified as a string as host:port pair (multiple entries are separated with commas) + * which acts as the central registry for volumes + */ + registry?: string | undefined; + /** volume is a string that references an already created Quobyte volume by name. */ + volume?: string | undefined; + /** + * readOnly here will force the Quobyte volume to be mounted with read-only permissions. + * Defaults to false. + * +optional + */ + readOnly?: boolean | undefined; + /** + * user to map volume access to + * Defaults to serivceaccount user + * +optional + */ + user?: string | undefined; + /** + * group to map volume access to + * Default is no group + * +optional + */ + group?: string | undefined; + /** + * tenant owning the given Quobyte volume in the Backend + * Used with dynamically provisioned Quobyte volumes, value is set by the plugin + * +optional + */ + tenant?: string | undefined; +} + +/** + * Represents a Rados Block Device mount that lasts the lifetime of a pod. + * RBD volumes support ownership management and SELinux relabeling. + */ +export interface RBDPersistentVolumeSource { + /** + * monitors is a collection of Ceph monitors. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + * +listType=atomic + */ + monitors: string[]; + /** + * image is the rados image name. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + */ + image?: string | undefined; + /** + * fsType is the filesystem type of the volume that you want to mount. + * Tip: Ensure that the filesystem type is supported by the host operating system. + * Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd + * TODO: how do we prevent errors in the filesystem from compromising the machine + * +optional + */ + fsType?: string | undefined; + /** + * pool is the rados pool name. + * Default is rbd. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + * +optional + * +default="rbd" + */ + pool?: string | undefined; + /** + * user is the rados user name. + * Default is admin. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + * +optional + * +default="admin" + */ + user?: string | undefined; + /** + * keyring is the path to key ring for RBDUser. + * Default is /etc/ceph/keyring. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + * +optional + * +default="/etc/ceph/keyring" + */ + keyring?: string | undefined; + /** + * secretRef is name of the authentication secret for RBDUser. If provided + * overrides keyring. + * Default is nil. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + * +optional + */ + secretRef?: SecretReference | undefined; + /** + * readOnly here will force the ReadOnly setting in VolumeMounts. + * Defaults to false. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + * +optional + */ + readOnly?: boolean | undefined; +} + +/** + * Represents a Rados Block Device mount that lasts the lifetime of a pod. + * RBD volumes support ownership management and SELinux relabeling. + */ +export interface RBDVolumeSource { + /** + * monitors is a collection of Ceph monitors. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + * +listType=atomic + */ + monitors: string[]; + /** + * image is the rados image name. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + */ + image?: string | undefined; + /** + * fsType is the filesystem type of the volume that you want to mount. + * Tip: Ensure that the filesystem type is supported by the host operating system. + * Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd + * TODO: how do we prevent errors in the filesystem from compromising the machine + * +optional + */ + fsType?: string | undefined; + /** + * pool is the rados pool name. + * Default is rbd. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + * +optional + * +default="rbd" + */ + pool?: string | undefined; + /** + * user is the rados user name. + * Default is admin. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + * +optional + * +default="admin" + */ + user?: string | undefined; + /** + * keyring is the path to key ring for RBDUser. + * Default is /etc/ceph/keyring. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + * +optional + * +default="/etc/ceph/keyring" + */ + keyring?: string | undefined; + /** + * secretRef is name of the authentication secret for RBDUser. If provided + * overrides keyring. + * Default is nil. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + * +optional + */ + secretRef?: LocalObjectReference | undefined; + /** + * readOnly here will force the ReadOnly setting in VolumeMounts. + * Defaults to false. + * More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + * +optional + */ + readOnly?: boolean | undefined; +} + +/** RangeAllocation is not a public type. */ +export interface RangeAllocation { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** Range is string that identifies the range represented by 'data'. */ + range?: string | undefined; + /** Data is a bit array containing all allocated addresses in the previous segment. */ + data?: Uint8Array | undefined; +} + +/** ReplicationController represents the configuration of a replication controller. */ +export interface ReplicationController { + /** + * If the Labels of a ReplicationController are empty, they are defaulted to + * be the same as the Pod(s) that the replication controller manages. + * Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name + */ + metadata?: ObjectMeta | undefined; + /** + * Spec defines the specification of the desired behavior of the replication controller. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: ReplicationControllerSpec | undefined; + /** + * Status is the most recently observed status of the replication controller. + * This data may be out of date by some window of time. + * Populated by the system. + * Read-only. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: ReplicationControllerStatus | undefined; +} + +/** ReplicationControllerCondition describes the state of a replication controller at a certain point. */ +export interface ReplicationControllerCondition { + /** Type of replication controller condition. */ + type?: string | undefined; + /** Status of the condition, one of True, False, Unknown. */ + status?: string | undefined; + /** + * The last time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * The reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * A human readable message indicating details about the transition. + * +optional + */ + message?: string | undefined; +} + +/** ReplicationControllerList is a collection of replication controllers. */ +export interface ReplicationControllerList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** + * List of replication controllers. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller + */ + items: ReplicationController[]; +} + +/** ReplicationControllerSpec is the specification of a replication controller. */ +export interface ReplicationControllerSpec { + /** + * Replicas is the number of desired replicas. + * This is a pointer to distinguish between explicit zero and unspecified. + * Defaults to 1. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller + * +optional + * +k8s:optional + * +default=1 + * +k8s:minimum=0 + */ + replicas?: number | undefined; + /** + * Minimum number of seconds for which a newly created pod should be ready + * without any of its container crashing, for it to be considered available. + * Defaults to 0 (pod will be considered available as soon as it is ready) + * +optional + * +k8s:optional + * +default=0 + * +k8s:minimum=0 + */ + minReadySeconds?: number | undefined; + /** + * Selector is a label query over pods that should match the Replicas count. + * If Selector is empty, it is defaulted to the labels present on the Pod template. + * Label keys and values that must match in order to be controlled by this replication + * controller, if empty defaulted to labels on Pod template. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + * +optional + * +mapType=atomic + */ + selector: { [key: string]: string }; + /** + * Template is the object that describes the pod that will be created if + * insufficient replicas are detected. This takes precedence over a TemplateRef. + * The only allowed template.spec.restartPolicy value is "Always". + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + */ + template?: PodTemplateSpec | undefined; +} + +export interface ReplicationControllerSpec_SelectorEntry { + key: string; + value: string; +} + +/** + * ReplicationControllerStatus represents the current status of a replication + * controller. + */ +export interface ReplicationControllerStatus { + /** + * Replicas is the most recently observed number of replicas. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller + */ + replicas?: number | undefined; + /** + * The number of pods that have labels matching the labels of the pod template of the replication controller. + * +optional + */ + fullyLabeledReplicas?: number | undefined; + /** + * The number of ready replicas for this replication controller. + * +optional + */ + readyReplicas?: number | undefined; + /** + * The number of available replicas (ready for at least minReadySeconds) for this replication controller. + * +optional + */ + availableReplicas?: number | undefined; + /** + * ObservedGeneration reflects the generation of the most recently observed replication controller. + * +optional + */ + observedGeneration?: number | undefined; + /** + * Represents the latest available observations of a replication controller's current state. + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: ReplicationControllerCondition[]; +} + +/** ResourceClaim references one entry in PodSpec.ResourceClaims. */ +export interface ResourceClaim { + /** + * Name must match the name of one entry in pod.spec.resourceClaims of + * the Pod where this field is used. It makes that resource available + * inside a container. + */ + name?: string | undefined; + /** + * Request is the name chosen for a request in the referenced claim. + * If empty, everything from the claim is made available, otherwise + * only the result of this request. + * + * +optional + */ + request?: string | undefined; +} + +/** + * ResourceFieldSelector represents container resources (cpu, memory) and their output format + * +structType=atomic + */ +export interface ResourceFieldSelector { + /** + * Container name: required for volumes, optional for env vars + * +optional + */ + containerName?: string | undefined; + /** Required: resource to select */ + resource?: string | undefined; + /** + * Specifies the output format of the exposed resources, defaults to "1" + * +optional + */ + divisor?: Quantity | undefined; +} + +/** + * ResourceHealth represents the health of a resource. It has the latest device health information. + * This is a part of KEP https://kep.k8s.io/4680. + */ +export interface ResourceHealth { + /** ResourceID is the unique identifier of the resource. See the ResourceID type for more information. */ + resourceID?: string | undefined; + /** + * Health of the resource. + * can be one of: + * - Healthy: operates as normal + * - Unhealthy: reported unhealthy. We consider this a temporary health issue + * since we do not have a mechanism today to distinguish + * temporary and permanent issues. + * - Unknown: The status cannot be determined. + * For example, Device Plugin got unregistered and hasn't been re-registered since. + * + * In future we may want to introduce the PermanentlyUnhealthy Status. + */ + health?: string | undefined; + /** + * Message provides human-readable context for Health (e.g. "ECC error count exceeded threshold"). + * This field is populated by the kubelet when ResourceHealthStatusMessage is enabled if the DRA plugin returns a message, and is null otherwise. + * +featureGate=ResourceHealthStatusMessage + * +optional + */ + message?: string | undefined; +} + +/** + * ResourceQuota sets aggregate quota restrictions enforced per namespace + * +k8s:supportsSubresource="/status" + */ +export interface ResourceQuota { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Spec defines the desired quota. + * https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: ResourceQuotaSpec | undefined; + /** + * Status defines the actual enforced quota and its current usage. + * https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: ResourceQuotaStatus | undefined; +} + +/** ResourceQuotaList is a list of ResourceQuota items. */ +export interface ResourceQuotaList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** + * Items is a list of ResourceQuota objects. + * More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/ + */ + items: ResourceQuota[]; +} + +/** ResourceQuotaSpec defines the desired hard limits to enforce for Quota. */ +export interface ResourceQuotaSpec { + /** + * hard is the set of desired hard limits for each named resource. + * More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/ + * +optional + */ + hard: { [key: string]: Quantity }; + /** + * A collection of filters that must match each object tracked by a quota. + * If not specified, the quota matches all objects. + * +optional + * +listType=atomic + */ + scopes: string[]; + /** + * scopeSelector is also a collection of filters like scopes that must match each object tracked by a quota + * but expressed using ScopeSelectorOperator in combination with possible values. + * For a resource to match, both scopes AND scopeSelector (if specified in spec), must be matched. + * +optional + */ + scopeSelector?: ScopeSelector | undefined; +} + +export interface ResourceQuotaSpec_HardEntry { + key: string; + value: Quantity | undefined; +} + +/** ResourceQuotaStatus defines the enforced hard limits and observed use. */ +export interface ResourceQuotaStatus { + /** + * Hard is the set of enforced hard limits for each named resource. + * More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/ + * +optional + */ + hard: { [key: string]: Quantity }; + /** + * Used is the current observed total usage of the resource in the namespace. + * +optional + */ + used: { [key: string]: Quantity }; +} + +export interface ResourceQuotaStatus_HardEntry { + key: string; + value: Quantity | undefined; +} + +export interface ResourceQuotaStatus_UsedEntry { + key: string; + value: Quantity | undefined; +} + +/** ResourceRequirements describes the compute resource requirements. */ +export interface ResourceRequirements { + /** + * Limits describes the maximum amount of compute resources allowed. + * More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + * +optional + */ + limits: { [key: string]: Quantity }; + /** + * Requests describes the minimum amount of compute resources required. + * If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + * otherwise to an implementation-defined value. Requests cannot exceed Limits. + * More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + * +optional + */ + requests: { [key: string]: Quantity }; + /** + * Claims lists the names of resources, defined in spec.resourceClaims, + * that are used by this container. + * + * This field depends on the + * DynamicResourceAllocation feature gate. + * + * This field is immutable. It can only be set for containers. + * + * +listType=map + * +listMapKey=name + * +featureGate=DynamicResourceAllocation + * +optional + */ + claims: ResourceClaim[]; +} + +export interface ResourceRequirements_LimitsEntry { + key: string; + value: Quantity | undefined; +} + +export interface ResourceRequirements_RequestsEntry { + key: string; + value: Quantity | undefined; +} + +/** ResourceStatus represents the status of a single resource allocated to a Pod. */ +export interface ResourceStatus { + /** + * Name of the resource. Must be unique within the pod and in case of non-DRA resource, match one of the resources from the pod spec. + * For DRA resources, the value must be "claim:/" when + * container.resources.claims[*].request is set or "claim:" when + * container.resources.claims[*].request is empty. + * For DRA-backed extended resources, "claim:/" is used + * when the claim name and request name are recorded in pod.status.extendedResourceClaimStatus. + * When this status is reported about a container, the "claim_name" and "request" + * must match one of the claims of this container. + * +required + */ + name?: string | undefined; + /** + * List of unique resources health. Each element in the list contains an unique resource ID and its health. + * At a minimum, for the lifetime of a Pod, resource ID must uniquely identify the resource allocated to the Pod on the Node. + * If other Pod on the same Node reports the status with the same resource ID, it must be the same resource they share. + * See ResourceID type definition for a specific format it has in various use cases. + * +listType=map + * +listMapKey=resourceID + */ + resources: ResourceHealth[]; +} + +/** SELinuxOptions are the labels to be applied to the container */ +export interface SELinuxOptions { + /** + * User is a SELinux user label that applies to the container. + * +optional + */ + user?: string | undefined; + /** + * Role is a SELinux role label that applies to the container. + * +optional + */ + role?: string | undefined; + /** + * Type is a SELinux type label that applies to the container. + * +optional + */ + type?: string | undefined; + /** + * Level is SELinux level label that applies to the container. + * +optional + */ + level?: string | undefined; +} + +/** ScaleIOPersistentVolumeSource represents a persistent ScaleIO volume */ +export interface ScaleIOPersistentVolumeSource { + /** gateway is the host address of the ScaleIO API Gateway. */ + gateway?: string | undefined; + /** system is the name of the storage system as configured in ScaleIO. */ + system?: string | undefined; + /** + * secretRef references to the secret for ScaleIO user and other + * sensitive information. If this is not provided, Login operation will fail. + */ + secretRef?: SecretReference | undefined; + /** + * sslEnabled is the flag to enable/disable SSL communication with Gateway, default false + * +optional + */ + sslEnabled?: boolean | undefined; + /** + * protectionDomain is the name of the ScaleIO Protection Domain for the configured storage. + * +optional + */ + protectionDomain?: string | undefined; + /** + * storagePool is the ScaleIO Storage Pool associated with the protection domain. + * +optional + */ + storagePool?: string | undefined; + /** + * storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. + * Default is ThinProvisioned. + * +optional + * +default="ThinProvisioned" + */ + storageMode?: string | undefined; + /** + * volumeName is the name of a volume already created in the ScaleIO system + * that is associated with this volume source. + */ + volumeName?: string | undefined; + /** + * fsType is the filesystem type to mount. + * Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs", "ntfs". + * Default is "xfs" + * +optional + * +default="xfs" + */ + fsType?: string | undefined; + /** + * readOnly defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * +optional + */ + readOnly?: boolean | undefined; +} + +/** ScaleIOVolumeSource represents a persistent ScaleIO volume */ +export interface ScaleIOVolumeSource { + /** gateway is the host address of the ScaleIO API Gateway. */ + gateway?: string | undefined; + /** system is the name of the storage system as configured in ScaleIO. */ + system?: string | undefined; + /** + * secretRef references to the secret for ScaleIO user and other + * sensitive information. If this is not provided, Login operation will fail. + */ + secretRef?: LocalObjectReference | undefined; + /** + * sslEnabled Flag enable/disable SSL communication with Gateway, default false + * +optional + */ + sslEnabled?: boolean | undefined; + /** + * protectionDomain is the name of the ScaleIO Protection Domain for the configured storage. + * +optional + */ + protectionDomain?: string | undefined; + /** + * storagePool is the ScaleIO Storage Pool associated with the protection domain. + * +optional + */ + storagePool?: string | undefined; + /** + * storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. + * Default is ThinProvisioned. + * +optional + * +default="ThinProvisioned" + */ + storageMode?: string | undefined; + /** + * volumeName is the name of a volume already created in the ScaleIO system + * that is associated with this volume source. + */ + volumeName?: string | undefined; + /** + * fsType is the filesystem type to mount. + * Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs", "ntfs". + * Default is "xfs". + * +optional + * +default="xfs" + */ + fsType?: string | undefined; + /** + * readOnly Defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * +optional + */ + readOnly?: boolean | undefined; +} + +/** + * A scope selector represents the AND of the selectors represented + * by the scoped-resource selector requirements. + * +structType=atomic + */ +export interface ScopeSelector { + /** + * A list of scope selector requirements by scope of the resources. + * +optional + * +listType=atomic + */ + matchExpressions: ScopedResourceSelectorRequirement[]; +} + +/** + * A scoped-resource selector requirement is a selector that contains values, a scope name, and an operator + * that relates the scope name and values. + */ +export interface ScopedResourceSelectorRequirement { + /** The name of the scope that the selector applies to. */ + scopeName?: string | undefined; + /** + * Represents a scope's relationship to a set of values. + * Valid operators are In, NotIn, Exists, DoesNotExist. + */ + operator?: string | undefined; + /** + * An array of string values. If the operator is In or NotIn, + * the values array must be non-empty. If the operator is Exists or DoesNotExist, + * the values array must be empty. + * This array is replaced during a strategic merge patch. + * +optional + * +listType=atomic + */ + values: string[]; +} + +/** + * SeccompProfile defines a pod/container's seccomp profile settings. + * Only one profile source may be set. + * +union + */ +export interface SeccompProfile { + /** + * type indicates which kind of seccomp profile will be applied. + * Valid options are: + * + * Localhost - a profile defined in a file on the node should be used. + * RuntimeDefault - the container runtime default profile should be used. + * Unconfined - no profile should be applied. + * +unionDiscriminator + */ + type?: string | undefined; + /** + * localhostProfile indicates a profile defined in a file on the node should be used. + * The profile must be preconfigured on the node to work. + * Must be a descending path, relative to the kubelet's configured seccomp profile location. + * Must be set if type is "Localhost". Must NOT be set for any other type. + * +optional + */ + localhostProfile?: string | undefined; +} + +/** + * Secret holds secret data of a certain type. The total bytes of the values in + * the Data field must be less than MaxSecretSize bytes. + */ +export interface Secret { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Immutable, if set to true, ensures that data stored in the Secret cannot + * be updated (only object metadata can be modified). + * If not set to true, the field can be modified at any time. + * Defaulted to nil. + * +optional + */ + immutable?: boolean | undefined; + /** + * Data contains the secret data. Each key must consist of alphanumeric + * characters, '-', '_' or '.'. The serialized form of the secret data is a + * base64 encoded string, representing the arbitrary (possibly non-string) + * data value here. Described in https://tools.ietf.org/html/rfc4648#section-4 + * +optional + */ + data: { [key: string]: Uint8Array }; + /** + * stringData allows specifying non-binary secret data in string form. + * It is provided as a write-only input field for convenience. + * All keys and values are merged into the data field on write, overwriting any existing values. + * The stringData field is never output when reading from the API. + * +k8s:conversion-gen=false + * +optional + */ + stringData: { [key: string]: string }; + /** + * Used to facilitate programmatic handling of secret data. + * More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types + * +optional + * +k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:immutable + */ + type?: string | undefined; +} + +export interface Secret_DataEntry { + key: string; + value: Uint8Array; +} + +export interface Secret_StringDataEntry { + key: string; + value: string; +} + +/** + * SecretEnvSource selects a Secret to populate the environment + * variables with. + * + * The contents of the target Secret's Data field will represent the + * key-value pairs as environment variables. + */ +export interface SecretEnvSource { + /** The Secret to select from. */ + localObjectReference?: LocalObjectReference | undefined; + /** + * Specify whether the Secret must be defined + * +optional + */ + optional?: boolean | undefined; +} + +/** + * SecretKeySelector selects a key of a Secret. + * +structType=atomic + */ +export interface SecretKeySelector { + /** The name of the secret in the pod's namespace to select from. */ + localObjectReference?: LocalObjectReference | undefined; + /** The key of the secret to select from. Must be a valid secret key. */ + key?: string | undefined; + /** + * Specify whether the Secret or its key must be defined + * +optional + */ + optional?: boolean | undefined; +} + +/** SecretList is a list of Secret. */ +export interface SecretList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** + * Items is a list of secret objects. + * More info: https://kubernetes.io/docs/concepts/configuration/secret + */ + items: Secret[]; +} + +/** + * Adapts a secret into a projected volume. + * + * The contents of the target Secret's Data field will be presented in a + * projected volume as files using the keys in the Data field as the file names. + * Note that this is identical to a secret volume source without the default + * mode. + */ +export interface SecretProjection { + localObjectReference?: LocalObjectReference | undefined; + /** + * items if unspecified, each key-value pair in the Data field of the referenced + * Secret will be projected into the volume as a file whose name is the + * key and content is the value. If specified, the listed keys will be + * projected into the specified paths, and unlisted keys will not be + * present. If a key is specified which is not present in the Secret, + * the volume setup will error unless it is marked optional. Paths must be + * relative and may not contain the '..' path or start with '..'. + * +optional + * +listType=atomic + */ + items: KeyToPath[]; + /** + * optional field specify whether the Secret or its key must be defined + * +optional + */ + optional?: boolean | undefined; +} + +/** + * SecretReference represents a Secret Reference. It has enough information to retrieve secret + * in any namespace + * +structType=atomic + */ +export interface SecretReference { + /** + * name is unique within a namespace to reference a secret resource. + * +optional + */ + name?: string | undefined; + /** + * namespace defines the space within which the secret name must be unique. + * +optional + */ + namespace?: string | undefined; +} + +/** + * Adapts a Secret into a volume. + * + * The contents of the target Secret's Data field will be presented in a volume + * as files using the keys in the Data field as the file names. + * Secret volumes support ownership management and SELinux relabeling. + */ +export interface SecretVolumeSource { + /** + * secretName is the name of the secret in the pod's namespace to use. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + * +optional + */ + secretName?: string | undefined; + /** + * items If unspecified, each key-value pair in the Data field of the referenced + * Secret will be projected into the volume as a file whose name is the + * key and content is the value. If specified, the listed keys will be + * projected into the specified paths, and unlisted keys will not be + * present. If a key is specified which is not present in the Secret, + * the volume setup will error unless it is marked optional. Paths must be + * relative and may not contain the '..' path or start with '..'. + * +optional + * +listType=atomic + */ + items: KeyToPath[]; + /** + * defaultMode is Optional: mode bits used to set permissions on created files by default. + * Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + * YAML accepts both octal and decimal values, JSON requires decimal values + * for mode bits. Defaults to 0644. + * Directories within the path are not affected by this setting. + * This might be in conflict with other options that affect the file + * mode, like fsGroup, and the result can be other mode bits set. + * +optional + */ + defaultMode?: number | undefined; + /** + * optional field specify whether the Secret or its keys must be defined + * +optional + */ + optional?: boolean | undefined; + /** + * defaultUser is Optional: The owner UID of the created files by default. + * The defaultUser field is only used as a fallback when the item-level user field is unset. + * (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + * +featureGate=AtomicWriteVolumeUserFields + * +optional + */ + defaultUser?: number | undefined; +} + +/** + * 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 { + /** + * The capabilities to add/drop when running containers. + * Defaults to the default set of capabilities granted by the container runtime. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + capabilities?: Capabilities | undefined; + /** + * Run container in privileged mode. + * Processes in privileged containers are essentially equivalent to root on the host. + * Defaults to false. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + privileged?: boolean | undefined; + /** + * The SELinux context to be applied to the container. + * If unspecified, the container runtime will allocate a random SELinux context for each + * container. May also be set in PodSecurityContext. If set in both SecurityContext and + * PodSecurityContext, the value specified in SecurityContext takes precedence. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + seLinuxOptions?: SELinuxOptions | undefined; + /** + * The Windows specific settings applied to all containers. + * If unspecified, the options from the PodSecurityContext will be used. + * If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + * Note that this field cannot be set when spec.os.name is linux. + * +optional + */ + windowsOptions?: WindowsSecurityContextOptions | undefined; + /** + * The UID to run the entrypoint of the container process. + * Defaults to user specified in image metadata if unspecified. + * May also be set in PodSecurityContext. If set in both SecurityContext and + * PodSecurityContext, the value specified in SecurityContext takes precedence. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + runAsUser?: number | undefined; + /** + * The GID to run the entrypoint of the container process. + * Uses runtime default if unset. + * May also be set in PodSecurityContext. If set in both SecurityContext and + * PodSecurityContext, the value specified in SecurityContext takes precedence. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + runAsGroup?: number | undefined; + /** + * Indicates that the container must run as a non-root user. + * If true, the Kubelet will validate the image at runtime to ensure that it + * does not run as UID 0 (root) and fail to start the container if it does. + * If unset or false, no such validation will be performed. + * May also be set in PodSecurityContext. If set in both SecurityContext and + * PodSecurityContext, the value specified in SecurityContext takes precedence. + * +optional + */ + runAsNonRoot?: boolean | undefined; + /** + * Whether this container has a read-only root filesystem. + * Default is false. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + readOnlyRootFilesystem?: boolean | undefined; + /** + * AllowPrivilegeEscalation controls whether a process can gain more + * privileges than its parent process. This bool directly controls if + * the no_new_privs flag will be set on the container process. + * AllowPrivilegeEscalation is true always when the container is: + * 1) run as Privileged + * 2) has CAP_SYS_ADMIN + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + allowPrivilegeEscalation?: boolean | undefined; + /** + * procMount denotes the type of proc mount to use for the containers. + * The default value is Default which uses the container runtime defaults for + * readonly paths and masked paths. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + procMount?: string | undefined; + /** + * The seccomp options to use by this container. If seccomp options are + * provided at both the pod & container level, the container options + * override the pod options. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + seccompProfile?: SeccompProfile | undefined; + /** + * appArmorProfile is the AppArmor options to use by this container. If set, this profile + * overrides the pod's appArmorProfile. + * Note that this field cannot be set when spec.os.name is windows. + * +optional + */ + appArmorProfile?: AppArmorProfile | undefined; +} + +/** SerializedReference is a reference to serialized object. */ +export interface SerializedReference { + /** + * The reference to an object in the system. + * +optional + */ + reference?: ObjectReference | undefined; +} + +/** + * Service is a named abstraction of software service (for example, mysql) consisting of local port + * (for example 3306) that the proxy listens on, and the selector that determines which pods + * will answer requests sent through the proxy. + * +k8s:supportsSubresource="/status" + * +k8s:supportsSubresource="/proxy" + */ +export interface Service { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Spec defines the behavior of a service. + * https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: ServiceSpec | undefined; + /** + * Most recently observed status of the service. + * Populated by the system. + * Read-only. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: ServiceStatus | undefined; +} + +/** + * ServiceAccount binds together: + * * a name, understood by users, and perhaps by peripheral systems, for an identity + * * a principal that can be authenticated and authorized + * * a set of secrets + */ +export interface ServiceAccount { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Secrets is a list of the secrets in the same namespace that pods running using this ServiceAccount are allowed to use. + * Pods are only limited to this list if this service account has a "kubernetes.io/enforce-mountable-secrets" annotation set to "true". + * The "kubernetes.io/enforce-mountable-secrets" annotation is deprecated since v1.32. + * Prefer separate namespaces to isolate access to mounted secrets. + * This field should not be used to find auto-generated service account token secrets for use outside of pods. + * Instead, tokens can be requested directly using the TokenRequest API, or service account token secrets can be manually created. + * More info: https://kubernetes.io/docs/concepts/configuration/secret + * +optional + * +patchMergeKey=name + * +patchStrategy=merge + * +listType=map + * +listMapKey=name + */ + secrets: ObjectReference[]; + /** + * ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images + * in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets + * can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. + * More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod + * +optional + * +listType=atomic + */ + imagePullSecrets: LocalObjectReference[]; + /** + * AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. + * Can be overridden at the pod level. + * +optional + */ + automountServiceAccountToken?: boolean | undefined; +} + +/** ServiceAccountList is a list of ServiceAccount objects */ +export interface ServiceAccountList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** + * List of ServiceAccounts. + * More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ + */ + items: ServiceAccount[]; +} + +/** + * ServiceAccountTokenProjection represents a projected service account token + * volume. This projection can be used to insert a service account token into + * the pods runtime filesystem for use against APIs (Kubernetes API Server or + * otherwise). + */ +export interface ServiceAccountTokenProjection { + /** + * audience is the intended audience of the token. A recipient of a token + * must identify itself with an identifier specified in the audience of the + * token, and otherwise should reject the token. The audience defaults to the + * identifier of the apiserver. + * +optional + */ + audience?: string | undefined; + /** + * expirationSeconds is the requested duration of validity of the service + * account token. As the token approaches expiration, the kubelet volume + * plugin will proactively rotate the service account token. The kubelet will + * start trying to rotate the token if the token is older than 80 percent of + * its time to live or if the token is older than 24 hours.Defaults to 1 hour + * and must be at least 10 minutes. + * +optional + */ + expirationSeconds?: number | undefined; + /** + * path is the path relative to the mount point of the file to project the + * token into. + */ + path?: string | undefined; + /** + * user is Optional: The owner UID of the created file. + * If specified, the item-level user field takes precedence over defaultUser. + * (Alpha) This field requires the AtomicWriteVolumeUserFields feature gate to be enabled. + * +featureGate=AtomicWriteVolumeUserFields + * +optional + */ + user?: number | undefined; +} + +/** ServiceList holds a list of services. */ +export interface ServiceList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** List of services */ + items: Service[]; +} + +/** ServicePort contains information on service's port. */ +export interface ServicePort { + /** + * The name of this port within the service. This must be a DNS_LABEL. + * All ports within a ServiceSpec must have unique names. When considering + * the endpoints for a Service, this must match the 'name' field in the + * EndpointPort. + * Optional if only one ServicePort is defined on this service. + * +optional + */ + name?: string | undefined; + /** + * The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". + * Default is TCP. + * +default="TCP" + * +optional + */ + protocol?: string | undefined; + /** + * The application protocol for this port. + * This is used as a hint for implementations to offer richer behavior for protocols that they understand. + * This field follows standard Kubernetes label syntax. + * Valid values are either: + * + * * Un-prefixed protocol names - reserved for IANA standard service names (as per + * RFC-6335 and https://www.iana.org/assignments/service-names). + * + * * Kubernetes-defined prefixed names: + * * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- + * * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 + * * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 + * + * * Other protocols should use implementation-defined prefixed names such as + * mycompany.com/my-custom-protocol. + * +optional + */ + appProtocol?: string | undefined; + /** The port that will be exposed by this service. */ + port?: number | undefined; + /** + * Number or name of the port to access on the pods targeted by the service. + * Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. + * If this is a string, it will be looked up as a named port in the + * target Pod's container ports. If this is not specified, the value + * of the 'port' field is used (an identity map). + * This field is ignored for services with clusterIP=None, and should be + * omitted or set equal to the 'port' field. + * More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service + * +optional + */ + targetPort?: IntOrString | undefined; + /** + * The port on each node on which this service is exposed when type is + * NodePort or LoadBalancer. Usually assigned by the system. If a value is + * specified, in-range, and not in use it will be used, otherwise the + * operation will fail. If not specified, a port will be allocated if this + * Service requires one. If this field is specified when creating a + * Service which does not need it, creation will fail. This field will be + * wiped when updating a Service to no longer need it (e.g. changing type + * from NodePort to ClusterIP). + * More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + * +optional + */ + nodePort?: number | undefined; +} + +/** ServiceProxyOptions is the query options to a Service's proxy call. */ +export interface ServiceProxyOptions { + /** + * Path is the part of URLs that include service endpoints, suffixes, + * and parameters to use for the current proxy request to service. + * For example, the whole request URL is + * http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. + * Path is _search?q=user:kimchy. + * +optional + */ + path?: string | undefined; +} + +/** ServiceSpec describes the attributes that a user creates on a service. */ +export interface ServiceSpec { + /** + * The list of ports that are exposed by this service. + * More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + * +patchMergeKey=port + * +patchStrategy=merge + * +listType=map + * +listMapKey=port + * +listMapKey=protocol + */ + ports: ServicePort[]; + /** + * Route service traffic to pods with label keys and values matching this + * selector. If empty or not present, the service is assumed to have an + * external process managing its endpoints, which Kubernetes will not + * modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. + * Ignored if type is ExternalName. + * More info: https://kubernetes.io/docs/concepts/services-networking/service/ + * +optional + * +mapType=atomic + */ + selector: { [key: string]: string }; + /** + * clusterIP is the IP address of the service and is usually assigned + * randomly. If an address is specified manually, is in-range (as per + * system configuration), and is not in use, it will be allocated to the + * service; otherwise creation of the service will fail. This field may not + * be changed through updates unless the type field is also being changed + * to ExternalName (which requires this field to be blank) or the type + * field is being changed from ExternalName (in which case this field may + * optionally be specified, as describe above). Valid values are "None", + * empty string (""), or a valid IP address. Setting this to "None" makes a + * "headless service" (no virtual IP), which is useful when direct endpoint + * connections are preferred and proxying is not required. Only applies to + * types ClusterIP, NodePort, and LoadBalancer. If this field is specified + * when creating a Service of type ExternalName, creation will fail. This + * field will be wiped when updating a Service to type ExternalName. + * More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + * +optional + */ + clusterIP?: string | undefined; + /** + * ClusterIPs is a list of IP addresses assigned to this service, and are + * usually assigned randomly. If an address is specified manually, is + * in-range (as per system configuration), and is not in use, it will be + * allocated to the service; otherwise creation of the service will fail. + * This field may not be changed through updates unless the type field is + * also being changed to ExternalName (which requires this field to be + * empty) or the type field is being changed from ExternalName (in which + * case this field may optionally be specified, as describe above). Valid + * values are "None", empty string (""), or a valid IP address. Setting + * this to "None" makes a "headless service" (no virtual IP), which is + * useful when direct endpoint connections are preferred and proxying is + * not required. Only applies to types ClusterIP, NodePort, and + * LoadBalancer. If this field is specified when creating a Service of type + * ExternalName, creation will fail. This field will be wiped when updating + * a Service to type ExternalName. If this field is not specified, it will + * be initialized from the clusterIP field. If this field is specified, + * clients must ensure that clusterIPs[0] and clusterIP have the same + * value. + * + * This field may hold a maximum of two entries (dual-stack IPs, in either order). + * These IPs must correspond to the values of the ipFamilies field. Both + * clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. + * More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + * +listType=atomic + * +optional + */ + clusterIPs: string[]; + /** + * type determines how the Service is exposed. Defaults to ClusterIP. Valid + * options are ExternalName, ClusterIP, NodePort, and LoadBalancer. + * "ClusterIP" allocates a cluster-internal IP address for load-balancing + * to endpoints. Endpoints are determined by the selector or if that is not + * specified, by manual construction of an Endpoints object or + * EndpointSlice objects. If clusterIP is "None", no virtual IP is + * allocated and the endpoints are published as a set of endpoints rather + * than a virtual IP. + * "NodePort" builds on ClusterIP and allocates a port on every node which + * routes to the same endpoints as the clusterIP. + * "LoadBalancer" builds on NodePort and creates an external load-balancer + * (if supported in the current cloud) which routes to the same endpoints + * as the clusterIP. + * "ExternalName" aliases this service to the specified externalName. + * Several other fields do not apply to ExternalName services. + * More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types + * +optional + */ + type?: string | undefined; + /** + * externalIPs is a list of IP addresses for which nodes in the cluster + * will also accept traffic for this service. These IPs are not managed by + * Kubernetes. The user is responsible for ensuring that traffic arrives + * at a node with this IP. A common example is external load-balancers + * that are not part of the Kubernetes system. + * +optional + * +listType=atomic + */ + externalIPs: string[]; + /** + * Supports "ClientIP" and "None". Used to maintain session affinity. + * Enable client IP based session affinity. + * Must be ClientIP or None. + * Defaults to None. + * More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + * +optional + */ + sessionAffinity?: string | undefined; + /** + * Only applies to Service Type: LoadBalancer. + * This feature depends on whether the underlying cloud-provider supports specifying + * the loadBalancerIP when a load balancer is created. + * This field will be ignored if the cloud-provider does not support the feature. + * Deprecated: This field was under-specified and its meaning varies across implementations. + * Using it is non-portable and it may not support dual-stack. + * Users are encouraged to use implementation-specific annotations when available. + * +optional + */ + loadBalancerIP?: string | undefined; + /** + * If specified and supported by the platform, this will restrict traffic through the cloud-provider + * load-balancer will be restricted to the specified client IPs. This field will be ignored if the + * cloud-provider does not support the feature." + * More info: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/ + * +optional + * +listType=atomic + */ + loadBalancerSourceRanges: string[]; + /** + * externalName is the external reference that discovery mechanisms will + * return as an alias for this service (e.g. a DNS CNAME record). No + * proxying will be involved. Must be a lowercase RFC-1123 hostname + * (https://tools.ietf.org/html/rfc1123) and requires `type` to be "ExternalName". + * +optional + */ + externalName?: string | undefined; + /** + * externalTrafficPolicy describes how nodes distribute service traffic they + * receive on one of the Service's "externally-facing" addresses (NodePorts, + * ExternalIPs, and LoadBalancer IPs). If set to "Local", the proxy will configure + * the service in a way that assumes that external load balancers will take care + * of balancing the service traffic between nodes, and so each node will deliver + * traffic only to the node-local endpoints of the service, without masquerading + * the client source IP. (Traffic mistakenly sent to a node with no endpoints will + * be dropped.) The default value, "Cluster", uses the standard behavior of + * routing to all endpoints evenly (possibly modified by topology and other + * features). Note that traffic sent to an External IP or LoadBalancer IP from + * within the cluster will always get "Cluster" semantics, but clients sending to + * a NodePort from within the cluster may need to take traffic policy into account + * when picking a node. + * +optional + */ + externalTrafficPolicy?: string | undefined; + /** + * healthCheckNodePort specifies the healthcheck nodePort for the service. + * This only applies when type is set to LoadBalancer and + * externalTrafficPolicy is set to Local. If a value is specified, is + * in-range, and is not in use, it will be used. If not specified, a value + * will be automatically allocated. External systems (e.g. load-balancers) + * can use this port to determine if a given node holds endpoints for this + * service or not. If this field is specified when creating a Service + * which does not need it, creation will fail. This field will be wiped + * when updating a Service to no longer need it (e.g. changing type). + * This field cannot be updated once set. + * +optional + */ + healthCheckNodePort?: number | undefined; + /** + * publishNotReadyAddresses indicates that any agent which deals with endpoints for this + * Service should disregard any indications of ready/not-ready. + * The primary use case for setting this field is for a StatefulSet's Headless Service to + * propagate SRV DNS records for its Pods for the purpose of peer discovery. + * The Kubernetes controllers that generate Endpoints and EndpointSlice resources for + * Services interpret this to mean that all endpoints are considered "ready" even if the + * Pods themselves are not. Agents which consume only Kubernetes generated endpoints + * through the Endpoints or EndpointSlice resources can safely assume this behavior. + * +optional + */ + publishNotReadyAddresses?: boolean | undefined; + /** + * sessionAffinityConfig contains the configurations of session affinity. + * +optional + */ + sessionAffinityConfig?: SessionAffinityConfig | undefined; + /** + * IPFamilies is a list of IP families (e.g. IPv4, IPv6) assigned to this + * service. This field is usually assigned automatically based on cluster + * configuration and the ipFamilyPolicy field. If this field is specified + * manually, the requested family is available in the cluster, + * and ipFamilyPolicy allows it, it will be used; otherwise creation of + * the service will fail. This field is conditionally mutable: it allows + * for adding or removing a secondary IP family, but it does not allow + * changing the primary IP family of the Service. Valid values are "IPv4" + * and "IPv6". This field only applies to Services of types ClusterIP, + * NodePort, and LoadBalancer, and does apply to "headless" services. + * This field will be wiped when updating a Service to type ExternalName. + * + * This field may hold a maximum of two entries (dual-stack families, in + * either order). These families must correspond to the values of the + * clusterIPs field, if specified. Both clusterIPs and ipFamilies are + * governed by the ipFamilyPolicy field. + * +listType=atomic + * +optional + */ + ipFamilies: string[]; + /** + * IPFamilyPolicy represents the dual-stack-ness requested or required by + * this Service. If there is no value provided, then this field will be set + * to SingleStack. Services can be "SingleStack" (a single IP family), + * "PreferDualStack" (two IP families on dual-stack configured clusters or + * a single IP family on single-stack clusters), or "RequireDualStack" + * (two IP families on dual-stack configured clusters, otherwise fail). The + * ipFamilies and clusterIPs fields depend on the value of this field. This + * field will be wiped when updating a service to type ExternalName. + * +optional + */ + ipFamilyPolicy?: string | undefined; + /** + * allocateLoadBalancerNodePorts defines if NodePorts will be automatically + * allocated for services with type LoadBalancer. Default is "true". It + * may be set to "false" if the cluster load-balancer does not rely on + * NodePorts. If the caller requests specific NodePorts (by specifying a + * value), those requests will be respected, regardless of this field. + * This field may only be set for services with type LoadBalancer and will + * be cleared if the type is changed to any other type. + * +optional + */ + allocateLoadBalancerNodePorts?: boolean | undefined; + /** + * loadBalancerClass is the class of the load balancer implementation this Service belongs to. + * If specified, the value of this field must be a label-style identifier, with an optional prefix, + * e.g. "internal-vip" or "example.com/internal-vip". Unprefixed names are reserved for end-users. + * This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load + * balancer implementation is used, today this is typically done through the cloud provider integration, + * but should apply for any default implementation. If set, it is assumed that a load balancer + * implementation is watching for Services with a matching class. Any default load balancer + * implementation (e.g. cloud providers) should ignore Services that set this field. + * This field can only be set when creating or updating a Service to type 'LoadBalancer'. + * Once set, it can not be changed. This field will be wiped when a service is updated to a non 'LoadBalancer' type. + * +optional + */ + loadBalancerClass?: string | undefined; + /** + * InternalTrafficPolicy describes how nodes distribute service traffic they + * receive on the ClusterIP. If set to "Local", the proxy will assume that pods + * only want to talk to endpoints of the service on the same node as the pod, + * dropping the traffic if there are no local endpoints. The default value, + * "Cluster", uses the standard behavior of routing to all endpoints evenly + * (possibly modified by topology and other features). + * +optional + */ + internalTrafficPolicy?: string | undefined; + /** + * TrafficDistribution offers a way to express preferences for how traffic + * is distributed to Service endpoints. Implementations can use this field + * as a hint, but are not required to guarantee strict adherence. If the + * field is not set, the implementation will apply its default routing + * strategy. If set to "PreferClose", implementations should prioritize + * endpoints that are in the same zone. + * +optional + */ + trafficDistribution?: string | undefined; +} + +export interface ServiceSpec_SelectorEntry { + key: string; + value: string; +} + +/** ServiceStatus represents the current status of a service. */ +export interface ServiceStatus { + /** + * LoadBalancer contains the current status of the load-balancer, + * if one is present. + * +optional + */ + loadBalancer?: LoadBalancerStatus | undefined; + /** + * Current service state + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + * +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType + */ + conditions: Condition[]; +} + +/** SessionAffinityConfig represents the configurations of session affinity. */ +export interface SessionAffinityConfig { + /** + * clientIP contains the configurations of Client IP based session affinity. + * +optional + */ + clientIP?: ClientIPConfig | undefined; +} + +/** SleepAction describes a "sleep" action. */ +export interface SleepAction { + /** Seconds is the number of seconds to sleep. */ + seconds?: number | undefined; +} + +/** Represents a StorageOS persistent volume resource. */ +export interface StorageOSPersistentVolumeSource { + /** + * volumeName is the human-readable name of the StorageOS volume. Volume + * names are only unique within a namespace. + */ + volumeName?: string | undefined; + /** + * volumeNamespace specifies the scope of the volume within StorageOS. If no + * namespace is specified then the Pod's namespace will be used. This allows the + * Kubernetes name scoping to be mirrored within StorageOS for tighter integration. + * Set VolumeName to any name to override the default behaviour. + * Set to "default" if you are not using namespaces within StorageOS. + * Namespaces that do not pre-exist within StorageOS will be created. + * +optional + */ + volumeNamespace?: string | undefined; + /** + * fsType is the filesystem type to mount. + * Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * +optional + */ + fsType?: string | undefined; + /** + * readOnly defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * +optional + */ + readOnly?: boolean | undefined; + /** + * secretRef specifies the secret to use for obtaining the StorageOS API + * credentials. If not specified, default values will be attempted. + * +optional + */ + secretRef?: ObjectReference | undefined; +} + +/** Represents a StorageOS persistent volume resource. */ +export interface StorageOSVolumeSource { + /** + * volumeName is the human-readable name of the StorageOS volume. Volume + * names are only unique within a namespace. + */ + volumeName?: string | undefined; + /** + * volumeNamespace specifies the scope of the volume within StorageOS. If no + * namespace is specified then the Pod's namespace will be used. This allows the + * Kubernetes name scoping to be mirrored within StorageOS for tighter integration. + * Set VolumeName to any name to override the default behaviour. + * Set to "default" if you are not using namespaces within StorageOS. + * Namespaces that do not pre-exist within StorageOS will be created. + * +optional + */ + volumeNamespace?: string | undefined; + /** + * fsType is the filesystem type to mount. + * Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * +optional + */ + fsType?: string | undefined; + /** + * readOnly defaults to false (read/write). ReadOnly here will force + * the ReadOnly setting in VolumeMounts. + * +optional + */ + readOnly?: boolean | undefined; + /** + * secretRef specifies the secret to use for obtaining the StorageOS API + * credentials. If not specified, default values will be attempted. + * +optional + */ + secretRef?: LocalObjectReference | undefined; +} + +/** Sysctl defines a kernel parameter to be set */ +export interface Sysctl { + /** Name of a property to set */ + name?: string | undefined; + /** Value of a property to set */ + value?: string | undefined; +} + +/** TCPSocketAction describes an action based on opening a socket */ +export interface TCPSocketAction { + /** + * Number or name of the port to access on the container. + * Number must be in the range 1 to 65535. + * Name must be an IANA_SVC_NAME. + */ + port?: IntOrString | undefined; + /** + * Optional: Host name to connect to, defaults to the pod IP. + * +optional + */ + host?: string | undefined; +} + +/** + * The node this Taint is attached to has the "effect" on + * any pod that does not tolerate the Taint. + */ +export interface Taint { + /** Required. The taint key to be applied to a node. */ + key?: string | undefined; + /** + * The taint value corresponding to the taint key. + * +optional + */ + value?: string | undefined; + /** + * Required. The effect of the taint on pods + * that do not tolerate the taint. + * Valid effects are NoSchedule, PreferNoSchedule and NoExecute. + */ + effect?: string | undefined; + /** + * TimeAdded represents the time at which the taint was added. + * +optional + */ + timeAdded?: Time | undefined; +} + +/** + * The pod this Toleration is attached to tolerates any taint that matches + * the triple using the matching operator . + */ +export interface Toleration { + /** + * Key is the taint key that the toleration applies to. Empty means match all taint keys. + * If the key is empty, operator must be Exists; this combination means to match all values and all keys. + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:format=k8s-label-key + */ + key?: string | undefined; + /** + * Operator represents a key's relationship to the value. + * Valid operators are Exists, Equal, Lt, and Gt. Defaults to Equal. + * Exists is equivalent to wildcard for value, so that a pod can + * tolerate all taints of a particular category. + * Lt and Gt perform numeric comparisons (requires feature gate TaintTolerationComparisonOperators). + * +optional + */ + operator?: string | undefined; + /** + * Value is the taint value the toleration matches to. + * If the operator is Exists, the value should be empty, otherwise just a regular string. + * +optional + */ + value?: string | undefined; + /** + * Effect indicates the taint effect to match. Empty means match all taint effects. + * When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. + * +optional + */ + effect?: string | undefined; + /** + * TolerationSeconds represents the period of time the toleration (which must be + * of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + * it is not set, which means tolerate the taint forever (do not evict). Zero and + * negative values will be treated as 0 (evict immediately) by the system. + * +optional + */ + tolerationSeconds?: number | undefined; +} + +/** + * A topology selector requirement is a selector that matches given label. + * This is an alpha feature and may change in the future. + */ +export interface TopologySelectorLabelRequirement { + /** The label key that the selector applies to. */ + key?: string | undefined; + /** + * An array of string values. One value must match the label to be selected. + * Each entry in Values is ORed. + * +listType=atomic + */ + values: string[]; +} + +/** + * A topology selector term represents the result of label queries. + * A null or empty topology selector term matches no objects. + * The requirements of them are ANDed. + * It provides a subset of functionality as NodeSelectorTerm. + * This is an alpha feature and may change in the future. + * +structType=atomic + */ +export interface TopologySelectorTerm { + /** + * A list of topology selector requirements by labels. + * +optional + * +listType=atomic + */ + matchLabelExpressions: TopologySelectorLabelRequirement[]; +} + +/** TopologySpreadConstraint specifies how to spread matching pods among the given topology. */ +export interface TopologySpreadConstraint { + /** + * MaxSkew describes the degree to which pods may be unevenly distributed. + * When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference + * between the number of matching pods in the target topology and the global minimum. + * The global minimum is the minimum number of matching pods in an eligible domain + * or zero if the number of eligible domains is less than MinDomains. + * For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + * labelSelector spread as 2/2/1: + * In this case, the global minimum is 1. + * +-------+-------+-------+ + * | zone1 | zone2 | zone3 | + * +-------+-------+-------+ + * | P P | P P | P | + * +-------+-------+-------+ + * - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; + * scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) + * violate MaxSkew(1). + * - if MaxSkew is 2, incoming pod can be scheduled onto any zone. + * When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence + * to topologies that satisfy it. + * It's a required field. Default value is 1 and 0 is not allowed. + */ + maxSkew?: number | undefined; + /** + * TopologyKey is the key of node labels. Nodes that have a label with this key + * and identical values are considered to be in the same topology. + * We consider each as a "bucket", and try to put balanced number + * of pods into each bucket. + * We define a domain as a particular instance of a topology. + * Also, we define an eligible domain as a domain whose nodes meet the requirements of + * nodeAffinityPolicy and nodeTaintsPolicy. + * e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. + * And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. + * It's a required field. + */ + topologyKey?: string | undefined; + /** + * WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy + * the spread constraint. + * - DoNotSchedule (default) tells the scheduler not to schedule it. + * - ScheduleAnyway tells the scheduler to schedule the pod in any location, + * but giving higher precedence to topologies that would help reduce the + * skew. + * A constraint is considered "Unsatisfiable" for an incoming pod + * if and only if every possible node assignment for that pod would violate + * "MaxSkew" on some topology. + * For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + * labelSelector spread as 3/1/1: + * +-------+-------+-------+ + * | zone1 | zone2 | zone3 | + * +-------+-------+-------+ + * | P P P | P | P | + * +-------+-------+-------+ + * If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled + * to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies + * MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler + * won't make it *more* imbalanced. + * It's a required field. + */ + whenUnsatisfiable?: string | undefined; + /** + * LabelSelector is used to find matching pods. + * Pods that match this label selector are counted to determine the number of pods + * in their corresponding topology domain. + * +optional + */ + labelSelector?: LabelSelector | undefined; + /** + * MinDomains indicates a minimum number of eligible domains. + * When the number of eligible domains with matching topology keys is less than minDomains, + * Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. + * And when the number of eligible domains with matching topology keys equals or greater than minDomains, + * this value has no effect on scheduling. + * As a result, when the number of eligible domains is less than minDomains, + * scheduler won't schedule more than maxSkew Pods to those domains. + * If value is nil, the constraint behaves as if MinDomains is equal to 1. + * Valid values are integers greater than 0. + * When value is not nil, WhenUnsatisfiable must be DoNotSchedule. + * + * For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same + * labelSelector spread as 2/2/2: + * +-------+-------+-------+ + * | zone1 | zone2 | zone3 | + * +-------+-------+-------+ + * | P P | P P | P P | + * +-------+-------+-------+ + * The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. + * In this situation, new pod with the same labelSelector cannot be scheduled, + * because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, + * it will violate MaxSkew. + * +optional + */ + minDomains?: number | undefined; + /** + * NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector + * when calculating pod topology spread skew. Options are: + * - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. + * - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. + * + * If this value is nil, the behavior is equivalent to the Honor policy. + * +optional + */ + nodeAffinityPolicy?: string | undefined; + /** + * NodeTaintsPolicy indicates how we will treat node taints when calculating + * pod topology spread skew. Options are: + * - Honor: nodes without taints, along with tainted nodes for which the incoming pod + * has a toleration, are included. + * - Ignore: node taints are ignored. All nodes are included. + * + * If this value is nil, the behavior is equivalent to the Ignore policy. + * +optional + */ + nodeTaintsPolicy?: string | undefined; + /** + * MatchLabelKeys is a set of pod label keys to select the pods over which + * spreading will be calculated. The keys are used to lookup values from the + * incoming pod labels, those key-value labels are ANDed with labelSelector + * to select the group of existing pods over which spreading will be calculated + * for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. + * MatchLabelKeys cannot be set when LabelSelector isn't set. + * Keys that don't exist in the incoming pod labels will + * be ignored. A null or empty list means only match against labelSelector. + * + * This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default). + * +listType=atomic + * +optional + */ + matchLabelKeys: string[]; +} + +/** + * TypedLocalObjectReference contains enough information to let you locate the + * typed referenced object inside the same namespace. + * --- + * New uses of this type are discouraged because of difficulty describing its usage when embedded in APIs. + * 1. Invalid usage help. It is impossible to add specific help for individual usage. In most embedded usages, there are particular + * restrictions like, "must refer only to types A and B" or "UID not honored" or "name must be restricted". + * Those cannot be well described when embedded. + * 2. Inconsistent validation. Because the usages are different, the validation rules are different by usage, which makes it hard for users to predict what will happen. + * 3. The fields are both imprecise and overly precise. Kind is not a precise mapping to a URL. This can produce ambiguity + * during interpretation and require a REST mapping. In most cases, the dependency is on the group,resource tuple + * and the version of the actual struct is irrelevant. + * 4. We cannot easily change it. Because this type is embedded in many locations, updates to this type + * will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control. + * + * Instead of using this type, create a locally provided and used type that is well-focused on your reference. + * For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 . + * +structType=atomic + */ +export interface TypedLocalObjectReference { + /** + * APIGroup is the group for the resource being referenced. + * If APIGroup is not specified, the specified Kind must be in the core API group. + * For any other third-party types, APIGroup is required. + * +optional + */ + apiGroup?: string | undefined; + /** Kind is the type of resource being referenced */ + kind?: string | undefined; + /** Name is the name of resource being referenced */ + name?: string | undefined; +} + +/** TypedObjectReference contains enough information to let you locate the typed referenced object */ +export interface TypedObjectReference { + /** + * APIGroup is the group for the resource being referenced. + * If APIGroup is not specified, the specified Kind must be in the core API group. + * For any other third-party types, APIGroup is required. + * +optional + */ + apiGroup?: string | undefined; + /** Kind is the type of resource being referenced */ + kind?: string | undefined; + /** Name is the name of resource being referenced */ + name?: string | undefined; + /** + * Namespace is the namespace of resource being referenced + * Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + * (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + * +featureGate=CrossNamespaceVolumeDataSource + * +optional + */ + namespace?: string | undefined; +} + +/** Volume represents a named volume in a pod that may be accessed by any container in the pod. */ +export interface Volume { + /** + * name of the volume. + * Must be a DNS_LABEL and unique within the pod. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + */ + name?: string | undefined; + /** + * volumeSource represents the location and type of the mounted volume. + * If not specified, the Volume is implied to be an EmptyDir. + * This implied behavior is deprecated and will be removed in a future version. + */ + volumeSource?: VolumeSource | undefined; +} + +/** volumeDevice describes a mapping of a raw block device within a container. */ +export interface VolumeDevice { + /** name must match the name of a persistentVolumeClaim in the pod */ + name?: string | undefined; + /** devicePath is the path inside of the container that the device will be mapped to. */ + devicePath?: string | undefined; +} + +/** VolumeHealthCondition represents an adverse health condition reported for a volume. */ +export interface VolumeHealthCondition { + /** + * status is the machine-parseable health category. + * Possible values: + * - "Inaccessible": the volume cannot be accessed. + * - "DataLoss": data loss has been detected on the volume. + * - "Degraded": the volume is functioning with reduced capability. + * +required + * +k8s:required + */ + status?: string | undefined; + /** + * reason is a brief CamelCase machine-parseable reason. + * Together with status it forms the unique identity of a condition entry. + * Maximum permitted length of a reason is 256 bytes. + * +required + * +k8s:required + * +k8s:maxBytes=256 + */ + reason?: string | undefined; + /** + * message is a human-readable description. + * Maximum permitted length of a message is 1024 bytes. + * +optional + * +k8s:optional + * +k8s:maxBytes=1024 + */ + message?: string | undefined; +} + +/** + * VolumeHealthStatus contains health information for a volume reported + * by the CSI controller plugin. + */ +export interface VolumeHealthStatus { + /** + * conditions is the set of adverse conditions reported by + * the CSI controller plugin. An empty list means no adverse condition. + * At most 16 conditions may be reported. + * +optional + * +listType=map + * +listMapKey=status + * +patchMergeKey=status + * +patchStrategy=merge + * +listMapKey=reason + * +k8s:optional + * +k8s:listType=map + * +k8s:listMapKey=status + * +k8s:listMapKey=reason + * +k8s:maxItems=16 + */ + healthConditions: VolumeHealthCondition[]; + /** + * lastTransitionTime is when the current set of conditions first appeared. + * +optional + */ + lastTransitionTime?: Time | undefined; +} + +/** VolumeMount describes a mounting of a Volume within a container. */ +export interface VolumeMount { + /** This must match the Name of a Volume. */ + name?: string | undefined; + /** + * Mounted read-only if true, read-write otherwise (false or unspecified). + * Defaults to false. + * +optional + */ + readOnly?: boolean | undefined; + /** + * RecursiveReadOnly specifies whether read-only mounts should be handled + * recursively. + * + * If ReadOnly is false, this field has no meaning and must be unspecified. + * + * If ReadOnly is true, and this field is set to Disabled, the mount is not made + * recursively read-only. If this field is set to IfPossible, the mount is made + * recursively read-only, if it is supported by the container runtime. If this + * field is set to Enabled, the mount is made recursively read-only if it is + * supported by the container runtime, otherwise the pod will not be started and + * an error will be generated to indicate the reason. + * + * If this field is set to IfPossible or Enabled, MountPropagation must be set to + * None (or be unspecified, which defaults to None). + * + * If this field is not specified, it is treated as an equivalent of Disabled. + * +optional + */ + recursiveReadOnly?: string | undefined; + /** Path within the container at which the volume should be mounted. */ + mountPath?: string | undefined; + /** + * Path within the volume from which the container's volume should be mounted. + * Defaults to "" (volume's root). + * +optional + */ + subPath?: string | undefined; + /** + * mountPropagation determines how mounts are propagated from the host + * to container and the other way around. + * When not set, MountPropagationNone is used. + * This field is beta in 1.10. + * When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified + * (which defaults to None). + * +optional + */ + mountPropagation?: string | undefined; + /** + * Expanded path within the volume from which the container's volume should be mounted. + * Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. + * Defaults to "" (volume's root). + * SubPathExpr and SubPath are mutually exclusive. + * +optional + */ + subPathExpr?: string | undefined; + /** + * bindMountOptions is the list of additional bind mount options to apply when + * mounting this volume into the container. Allowed values are noexec, + * nodev, and nosuid. These are Linux mount options and have no effect on + * Windows nodes. + * This field is not supported with image volumes. + * This is an alpha field and requires enabling the VolumeBindMountOptions feature gate. + * +featureGate=VolumeBindMountOptions + * +optional + * +listType=set + */ + bindMountOptions: string[]; +} + +/** VolumeMountStatus shows status of volume mounts. */ +export interface VolumeMountStatus { + /** Name corresponds to the name of the original VolumeMount. */ + name?: string | undefined; + /** MountPath corresponds to the original VolumeMount. */ + mountPath?: string | undefined; + /** + * ReadOnly corresponds to the original VolumeMount. + * +optional + */ + readOnly?: boolean | undefined; + /** + * RecursiveReadOnly must be set to Disabled, Enabled, or unspecified (for non-readonly mounts). + * An IfPossible value in the original VolumeMount must be translated to Disabled or Enabled, + * depending on the mount result. + * +optional + */ + recursiveReadOnly?: string | undefined; + /** + * volumeStatus represents volume-type-specific status about the mounted + * volume. + * +optional + */ + volumeStatus?: VolumeStatus | undefined; +} + +/** VolumeNodeAffinity defines constraints that limit what nodes this volume can be accessed from. */ +export interface VolumeNodeAffinity { + /** required specifies hard node constraints that must be met. */ + required?: NodeSelector | undefined; +} + +/** + * Projection that may be projected along with other supported volume types. + * Exactly one of these fields must be set. + */ +export interface VolumeProjection { + /** + * secret information about the secret data to project + * +optional + */ + secret?: SecretProjection | undefined; + /** + * downwardAPI information about the downwardAPI data to project + * +optional + */ + downwardAPI?: DownwardAPIProjection | undefined; + /** + * configMap information about the configMap data to project + * +optional + */ + configMap?: ConfigMapProjection | undefined; + /** + * serviceAccountToken is information about the serviceAccountToken data to project + * +optional + */ + serviceAccountToken?: ServiceAccountTokenProjection | undefined; + /** + * ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field + * of ClusterTrustBundle objects in an auto-updating file. + * + * Alpha, gated by the ClusterTrustBundleProjection feature gate. + * + * ClusterTrustBundle objects can either be selected by name, or by the + * combination of signer name and a label selector. + * + * Kubelet performs aggressive normalization of the PEM contents written + * into the pod filesystem. Esoteric PEM features such as inter-block + * comments and block headers are stripped. Certificates are deduplicated. + * The ordering of certificates within the file is arbitrary, and Kubelet + * may change the order over time. + * + * +featureGate=ClusterTrustBundleProjection + * +optional + */ + clusterTrustBundle?: ClusterTrustBundleProjection | undefined; + /** + * Projects an auto-rotating credential bundle (private key and certificate + * chain) that the pod can use either as a TLS client or server. + * + * Kubelet generates a private key and uses it to send a + * PodCertificateRequest to the named signer. Once the signer approves the + * request and issues a certificate chain, Kubelet writes the key and + * certificate chain to the pod filesystem. The pod does not start until + * certificates have been issued for each podCertificate projected volume + * source in its spec. + * + * Kubelet will begin trying to rotate the certificate at the time indicated + * by the signer using the PodCertificateRequest.Status.BeginRefreshAt + * timestamp. + * + * Kubelet can write a single file, indicated by the credentialBundlePath + * field, or separate files, indicated by the keyPath and + * certificateChainPath fields. + * + * The credential bundle is a single file in PEM format. The first PEM + * entry is the private key (in PKCS#8 format), and the remaining PEM + * entries are the certificate chain issued by the signer (typically, + * signers will return their certificate chain in leaf-to-root order). + * + * Prefer using the credential bundle format, since your application code + * can read it atomically. If you use keyPath and certificateChainPath, + * your application must make two separate file reads. If these coincide + * with a certificate rotation, it is possible that the private key and leaf + * certificate you read may not correspond to each other. Your application + * will need to check for this condition, and re-read until they are + * consistent. + * + * The named signer controls chooses the format of the certificate it + * issues; consult the signer implementation's documentation to learn how to + * use the certificates it issues. + * + * +featureGate=PodCertificateProjection + * +optional + */ + podCertificate?: PodCertificateProjection | undefined; +} + +/** VolumeResourceRequirements describes the storage resource requirements for a volume. */ +export interface VolumeResourceRequirements { + /** + * Limits describes the maximum amount of compute resources allowed. + * More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + * +optional + */ + limits: { [key: string]: Quantity }; + /** + * Requests describes the minimum amount of compute resources required. + * If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + * otherwise to an implementation-defined value. Requests cannot exceed Limits. + * More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + * +optional + */ + requests: { [key: string]: Quantity }; +} + +export interface VolumeResourceRequirements_LimitsEntry { + key: string; + value: Quantity | undefined; +} + +export interface VolumeResourceRequirements_RequestsEntry { + key: string; + value: Quantity | undefined; +} + +/** + * Represents the source of a volume to mount. + * Only one of its members may be specified. + */ +export interface VolumeSource { + /** + * hostPath represents a pre-existing file or directory on the host + * machine that is directly exposed to the container. This is generally + * used for system agents or other privileged things that are allowed + * to see the host machine. Most containers will NOT need this. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + * --- + * TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not + * mount host directories as read/write. + * +optional + */ + hostPath?: HostPathVolumeSource | undefined; + /** + * emptyDir represents a temporary directory that shares a pod's lifetime. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + * +optional + */ + emptyDir?: EmptyDirVolumeSource | undefined; + /** + * gcePersistentDisk represents a GCE Disk resource that is attached to a + * kubelet's host machine and then exposed to the pod. + * Deprecated: GCEPersistentDisk is deprecated. All operations for the in-tree + * gcePersistentDisk type are redirected to the pd.csi.storage.gke.io CSI driver. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + * +optional + */ + gcePersistentDisk?: GCEPersistentDiskVolumeSource | undefined; + /** + * awsElasticBlockStore represents an AWS Disk resource that is attached to a + * kubelet's host machine and then exposed to the pod. + * Deprecated: AWSElasticBlockStore is deprecated. All operations for the in-tree + * awsElasticBlockStore type are redirected to the ebs.csi.aws.com CSI driver. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + * +optional + */ + awsElasticBlockStore?: AWSElasticBlockStoreVolumeSource | undefined; + /** + * gitRepo represents a git repository at a particular revision. + * Deprecated: GitRepo is deprecated. To provision a container with a git repo, mount an + * EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir + * into the Pod's container. + * +optional + */ + gitRepo?: GitRepoVolumeSource | undefined; + /** + * secret represents a secret that should populate this volume. + * More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + * +optional + */ + secret?: SecretVolumeSource | undefined; + /** + * nfs represents an NFS mount on the host that shares a pod's lifetime + * More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + * +optional + */ + nfs?: NFSVolumeSource | undefined; + /** + * iscsi represents an ISCSI Disk resource that is attached to a + * kubelet's host machine and then exposed to the pod. + * More info: https://kubernetes.io/docs/concepts/storage/volumes/#iscsi + * +optional + */ + iscsi?: ISCSIVolumeSource | undefined; + /** + * glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. + * Deprecated: Glusterfs is deprecated and the in-tree glusterfs type is no longer supported. + * +optional + */ + glusterfs?: GlusterfsVolumeSource | undefined; + /** + * persistentVolumeClaimVolumeSource represents a reference to a + * PersistentVolumeClaim in the same namespace. + * More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + * +optional + */ + persistentVolumeClaim?: PersistentVolumeClaimVolumeSource | undefined; + /** + * rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + * Deprecated: RBD is deprecated and the in-tree rbd type is no longer supported. + * +optional + */ + rbd?: RBDVolumeSource | undefined; + /** + * flexVolume represents a generic volume resource that is + * provisioned/attached using an exec based plugin. + * Deprecated: FlexVolume is deprecated. Consider using a CSIDriver instead. + * +optional + */ + flexVolume?: FlexVolumeSource | undefined; + /** + * cinder represents a cinder volume attached and mounted on kubelets host machine. + * Deprecated: Cinder is deprecated. All operations for the in-tree cinder type + * are redirected to the cinder.csi.openstack.org CSI driver. + * More info: https://examples.k8s.io/mysql-cinder-pd/README.md + * +optional + */ + cinder?: CinderVolumeSource | undefined; + /** + * cephFS represents a Ceph FS mount on the host that shares a pod's lifetime. + * Deprecated: CephFS is deprecated and the in-tree cephfs type is no longer supported. + * +optional + */ + cephfs?: CephFSVolumeSource | undefined; + /** + * flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running. + * Deprecated: Flocker is deprecated and the in-tree flocker type is no longer supported. + * +optional + */ + flocker?: FlockerVolumeSource | undefined; + /** + * downwardAPI represents downward API about the pod that should populate this volume + * +optional + */ + downwardAPI?: DownwardAPIVolumeSource | undefined; + /** + * fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod. + * +optional + */ + fc?: FCVolumeSource | undefined; + /** + * azureFile represents an Azure File Service mount on the host and bind mount to the pod. + * Deprecated: AzureFile is deprecated. All operations for the in-tree azureFile type + * are redirected to the file.csi.azure.com CSI driver. + * +optional + */ + azureFile?: AzureFileVolumeSource | undefined; + /** + * configMap represents a configMap that should populate this volume + * +optional + */ + configMap?: ConfigMapVolumeSource | undefined; + /** + * vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine. + * Deprecated: VsphereVolume is deprecated. All operations for the in-tree vsphereVolume type + * are redirected to the csi.vsphere.vmware.com CSI driver. + * +optional + */ + vsphereVolume?: VsphereVirtualDiskVolumeSource | undefined; + /** + * quobyte represents a Quobyte mount on the host that shares a pod's lifetime. + * Deprecated: Quobyte is deprecated and the in-tree quobyte type is no longer supported. + * +optional + */ + quobyte?: QuobyteVolumeSource | undefined; + /** + * azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. + * Deprecated: AzureDisk is deprecated. All operations for the in-tree azureDisk type + * are redirected to the disk.csi.azure.com CSI driver. + * +optional + */ + azureDisk?: AzureDiskVolumeSource | undefined; + /** + * photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine. + * Deprecated: PhotonPersistentDisk is deprecated and the in-tree photonPersistentDisk type is no longer supported. + */ + photonPersistentDisk?: PhotonPersistentDiskVolumeSource | undefined; + /** projected items for all in one resources secrets, configmaps, and downward API */ + projected?: ProjectedVolumeSource | undefined; + /** + * portworxVolume represents a portworx volume attached and mounted on kubelets host machine. + * Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type + * are redirected to the pxd.portworx.com CSI driver. + * +optional + */ + portworxVolume?: PortworxVolumeSource | undefined; + /** + * scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. + * Deprecated: ScaleIO is deprecated and the in-tree scaleIO type is no longer supported. + * +optional + */ + scaleIO?: ScaleIOVolumeSource | undefined; + /** + * storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. + * Deprecated: StorageOS is deprecated and the in-tree storageos type is no longer supported. + * +optional + */ + storageos?: StorageOSVolumeSource | undefined; + /** + * csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers. + * +optional + */ + csi?: CSIVolumeSource | undefined; + /** + * ephemeral represents a volume that is handled by a cluster storage driver. + * The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, + * and deleted when the pod is removed. + * + * Use this if: + * a) the volume is only needed while the pod runs, + * b) features of normal volumes like restoring from snapshot or capacity + * tracking are needed, + * c) the storage driver is specified through a storage class, and + * d) the storage driver supports dynamic volume provisioning through + * a PersistentVolumeClaim (see EphemeralVolumeSource for more + * information on the connection between this volume type + * and PersistentVolumeClaim). + * + * Use PersistentVolumeClaim or one of the vendor-specific + * APIs for volumes that persist for longer than the lifecycle + * of an individual pod. + * + * Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to + * be used that way - see the documentation of the driver for + * more information. + * + * A pod can use both types of ephemeral volumes and + * persistent volumes at the same time. + * + * +optional + */ + ephemeral?: EphemeralVolumeSource | undefined; + /** + * image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. + * The volume is resolved at pod startup depending on which PullPolicy value is provided: + * + * - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. + * - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. + * - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + * + * The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. + * A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. + * The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. + * The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. + * The volume will be mounted read-only (ro). + * Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33. + * The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type. + * +optional + */ + image?: ImageVolumeSource | undefined; +} + +/** + * VolumeStatus represents the status of a mounted volume. + * At most one of its members must be specified. + */ +export interface VolumeStatus { + /** + * image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. + * +featureGate=ImageVolumeWithDigest + * +optional + */ + image?: ImageVolumeStatus | undefined; +} + +/** Represents a vSphere volume resource. */ +export interface VsphereVirtualDiskVolumeSource { + /** volumePath is the path that identifies vSphere volume vmdk */ + volumePath?: string | undefined; + /** + * fsType is filesystem type to mount. + * Must be a filesystem type supported by the host operating system. + * Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + * +optional + */ + fsType?: string | undefined; + /** + * storagePolicyName is the storage Policy Based Management (SPBM) profile name. + * +optional + */ + storagePolicyName?: string | undefined; + /** + * storagePolicyID is the storage Policy Based Management (SPBM) profile ID associated with the StoragePolicyName. + * +optional + */ + storagePolicyID?: string | undefined; +} + +/** The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s) */ +export interface WeightedPodAffinityTerm { + /** + * weight associated with matching the corresponding podAffinityTerm, + * in the range 1-100. + */ + weight?: number | undefined; + /** Required. A pod affinity term, associated with the corresponding weight. */ + podAffinityTerm?: PodAffinityTerm | undefined; +} + +/** WindowsSecurityContextOptions contain Windows-specific options and credentials. */ +export interface WindowsSecurityContextOptions { + /** + * GMSACredentialSpecName is the name of the GMSA credential spec to use. + * +optional + */ + gmsaCredentialSpecName?: string | undefined; + /** + * GMSACredentialSpec is where the GMSA admission webhook + * (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + * GMSA credential spec named by the GMSACredentialSpecName field. + * +optional + */ + gmsaCredentialSpec?: string | undefined; + /** + * The UserName in Windows to run the entrypoint of the container process. + * Defaults to the user specified in image metadata if unspecified. + * May also be set in PodSecurityContext. If set in both SecurityContext and + * PodSecurityContext, the value specified in SecurityContext takes precedence. + * +optional + */ + runAsUserName?: string | undefined; + /** + * HostProcess determines if a container should be run as a 'Host Process' container. + * All of a Pod's containers must have the same effective HostProcess value + * (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers). + * In addition, if HostProcess is true then HostNetwork must also be set to true. + * +optional + */ + hostProcess?: boolean | undefined; +} + +function createBaseAWSElasticBlockStoreVolumeSource(): AWSElasticBlockStoreVolumeSource { + return { volumeID: '', fsType: '', partition: 0, readOnly: false }; +} + +export const AWSElasticBlockStoreVolumeSource: MessageFns = { + encode( + message: AWSElasticBlockStoreVolumeSource, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.volumeID !== undefined && message.volumeID !== '') { + writer.uint32(10).string(message.volumeID); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(18).string(message.fsType); + } + if (message.partition !== undefined && message.partition !== 0) { + writer.uint32(24).int32(message.partition); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AWSElasticBlockStoreVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAWSElasticBlockStoreVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.volumeID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.partition = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AWSElasticBlockStoreVolumeSource { + return { + volumeID: isSet(object.volumeID) ? globalThis.String(object.volumeID) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + partition: isSet(object.partition) ? globalThis.Number(object.partition) : 0, + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: AWSElasticBlockStoreVolumeSource): unknown { + const obj: any = {}; + if (message.volumeID !== undefined && message.volumeID !== '') { + obj.volumeID = message.volumeID; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.partition !== undefined && message.partition !== 0) { + obj.partition = Math.round(message.partition); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>( + base?: I, + ): AWSElasticBlockStoreVolumeSource { + return AWSElasticBlockStoreVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): AWSElasticBlockStoreVolumeSource { + const message = createBaseAWSElasticBlockStoreVolumeSource(); + message.volumeID = object.volumeID ?? ''; + message.fsType = object.fsType ?? ''; + message.partition = object.partition ?? 0; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBaseAffinity(): Affinity { + return { nodeAffinity: undefined, podAffinity: undefined, podAntiAffinity: undefined }; +} + +export const Affinity: MessageFns = { + encode(message: Affinity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nodeAffinity !== undefined) { + NodeAffinity.encode(message.nodeAffinity, writer.uint32(10).fork()).join(); + } + if (message.podAffinity !== undefined) { + PodAffinity.encode(message.podAffinity, writer.uint32(18).fork()).join(); + } + if (message.podAntiAffinity !== undefined) { + PodAntiAffinity.encode(message.podAntiAffinity, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Affinity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAffinity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.nodeAffinity = NodeAffinity.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.podAffinity = PodAffinity.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.podAntiAffinity = PodAntiAffinity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Affinity { + return { + nodeAffinity: isSet(object.nodeAffinity) ? NodeAffinity.fromJSON(object.nodeAffinity) : undefined, + podAffinity: isSet(object.podAffinity) ? PodAffinity.fromJSON(object.podAffinity) : undefined, + podAntiAffinity: isSet(object.podAntiAffinity) + ? PodAntiAffinity.fromJSON(object.podAntiAffinity) + : undefined, + }; + }, + + toJSON(message: Affinity): unknown { + const obj: any = {}; + if (message.nodeAffinity !== undefined) { + obj.nodeAffinity = NodeAffinity.toJSON(message.nodeAffinity); + } + if (message.podAffinity !== undefined) { + obj.podAffinity = PodAffinity.toJSON(message.podAffinity); + } + if (message.podAntiAffinity !== undefined) { + obj.podAntiAffinity = PodAntiAffinity.toJSON(message.podAntiAffinity); + } + return obj; + }, + + create, I>>(base?: I): Affinity { + return Affinity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Affinity { + const message = createBaseAffinity(); + message.nodeAffinity = + object.nodeAffinity !== undefined && object.nodeAffinity !== null + ? NodeAffinity.fromPartial(object.nodeAffinity) + : undefined; + message.podAffinity = + object.podAffinity !== undefined && object.podAffinity !== null + ? PodAffinity.fromPartial(object.podAffinity) + : undefined; + message.podAntiAffinity = + object.podAntiAffinity !== undefined && object.podAntiAffinity !== null + ? PodAntiAffinity.fromPartial(object.podAntiAffinity) + : undefined; + return message; + }, +}; + +function createBaseAppArmorProfile(): AppArmorProfile { + return { type: '', localhostProfile: '' }; +} + +export const AppArmorProfile: MessageFns = { + encode(message: AppArmorProfile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.localhostProfile !== undefined && message.localhostProfile !== '') { + writer.uint32(18).string(message.localhostProfile); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppArmorProfile { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppArmorProfile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.localhostProfile = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AppArmorProfile { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + localhostProfile: isSet(object.localhostProfile) + ? globalThis.String(object.localhostProfile) + : '', + }; + }, + + toJSON(message: AppArmorProfile): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.localhostProfile !== undefined && message.localhostProfile !== '') { + obj.localhostProfile = message.localhostProfile; + } + return obj; + }, + + create, I>>(base?: I): AppArmorProfile { + return AppArmorProfile.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AppArmorProfile { + const message = createBaseAppArmorProfile(); + message.type = object.type ?? ''; + message.localhostProfile = object.localhostProfile ?? ''; + return message; + }, +}; + +function createBaseAttachedVolume(): AttachedVolume { + return { name: '', devicePath: '' }; +} + +export const AttachedVolume: MessageFns = { + encode(message: AttachedVolume, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.devicePath !== undefined && message.devicePath !== '') { + writer.uint32(18).string(message.devicePath); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AttachedVolume { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttachedVolume(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.devicePath = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AttachedVolume { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + devicePath: isSet(object.devicePath) ? globalThis.String(object.devicePath) : '', + }; + }, + + toJSON(message: AttachedVolume): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.devicePath !== undefined && message.devicePath !== '') { + obj.devicePath = message.devicePath; + } + return obj; + }, + + create, I>>(base?: I): AttachedVolume { + return AttachedVolume.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AttachedVolume { + const message = createBaseAttachedVolume(); + message.name = object.name ?? ''; + message.devicePath = object.devicePath ?? ''; + return message; + }, +}; + +function createBaseAvoidPods(): AvoidPods { + return { preferAvoidPods: [] }; +} + +export const AvoidPods: MessageFns = { + encode(message: AvoidPods, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.preferAvoidPods) { + PreferAvoidPodsEntry.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AvoidPods { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAvoidPods(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.preferAvoidPods.push(PreferAvoidPodsEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AvoidPods { + return { + preferAvoidPods: globalThis.Array.isArray(object?.preferAvoidPods) + ? object.preferAvoidPods.map((e: any) => PreferAvoidPodsEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: AvoidPods): unknown { + const obj: any = {}; + if (message.preferAvoidPods?.length) { + obj.preferAvoidPods = message.preferAvoidPods.map((e) => PreferAvoidPodsEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): AvoidPods { + return AvoidPods.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AvoidPods { + const message = createBaseAvoidPods(); + message.preferAvoidPods = + object.preferAvoidPods?.map((e) => PreferAvoidPodsEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAzureDiskVolumeSource(): AzureDiskVolumeSource { + return { diskName: '', diskURI: '', cachingMode: '', fsType: '', readOnly: false, kind: '' }; +} + +export const AzureDiskVolumeSource: MessageFns = { + encode(message: AzureDiskVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.diskName !== undefined && message.diskName !== '') { + writer.uint32(10).string(message.diskName); + } + if (message.diskURI !== undefined && message.diskURI !== '') { + writer.uint32(18).string(message.diskURI); + } + if (message.cachingMode !== undefined && message.cachingMode !== '') { + writer.uint32(26).string(message.cachingMode); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(34).string(message.fsType); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(40).bool(message.readOnly); + } + if (message.kind !== undefined && message.kind !== '') { + writer.uint32(50).string(message.kind); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AzureDiskVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAzureDiskVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.diskName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.diskURI = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.cachingMode = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.kind = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AzureDiskVolumeSource { + return { + diskName: isSet(object.diskName) ? globalThis.String(object.diskName) : '', + diskURI: isSet(object.diskURI) ? globalThis.String(object.diskURI) : '', + cachingMode: isSet(object.cachingMode) ? globalThis.String(object.cachingMode) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + kind: isSet(object.kind) ? globalThis.String(object.kind) : '', + }; + }, + + toJSON(message: AzureDiskVolumeSource): unknown { + const obj: any = {}; + if (message.diskName !== undefined && message.diskName !== '') { + obj.diskName = message.diskName; + } + if (message.diskURI !== undefined && message.diskURI !== '') { + obj.diskURI = message.diskURI; + } + if (message.cachingMode !== undefined && message.cachingMode !== '') { + obj.cachingMode = message.cachingMode; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.kind !== undefined && message.kind !== '') { + obj.kind = message.kind; + } + return obj; + }, + + create, I>>(base?: I): AzureDiskVolumeSource { + return AzureDiskVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AzureDiskVolumeSource { + const message = createBaseAzureDiskVolumeSource(); + message.diskName = object.diskName ?? ''; + message.diskURI = object.diskURI ?? ''; + message.cachingMode = object.cachingMode ?? ''; + message.fsType = object.fsType ?? ''; + message.readOnly = object.readOnly ?? false; + message.kind = object.kind ?? ''; + return message; + }, +}; + +function createBaseAzureFilePersistentVolumeSource(): AzureFilePersistentVolumeSource { + return { secretName: '', shareName: '', readOnly: false, secretNamespace: '' }; +} + +export const AzureFilePersistentVolumeSource: MessageFns = { + encode( + message: AzureFilePersistentVolumeSource, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.secretName !== undefined && message.secretName !== '') { + writer.uint32(10).string(message.secretName); + } + if (message.shareName !== undefined && message.shareName !== '') { + writer.uint32(18).string(message.shareName); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(24).bool(message.readOnly); + } + if (message.secretNamespace !== undefined && message.secretNamespace !== '') { + writer.uint32(34).string(message.secretNamespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AzureFilePersistentVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAzureFilePersistentVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.secretName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.shareName = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.secretNamespace = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AzureFilePersistentVolumeSource { + return { + secretName: isSet(object.secretName) ? globalThis.String(object.secretName) : '', + shareName: isSet(object.shareName) ? globalThis.String(object.shareName) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + secretNamespace: isSet(object.secretNamespace) ? globalThis.String(object.secretNamespace) : '', + }; + }, + + toJSON(message: AzureFilePersistentVolumeSource): unknown { + const obj: any = {}; + if (message.secretName !== undefined && message.secretName !== '') { + obj.secretName = message.secretName; + } + if (message.shareName !== undefined && message.shareName !== '') { + obj.shareName = message.shareName; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.secretNamespace !== undefined && message.secretNamespace !== '') { + obj.secretNamespace = message.secretNamespace; + } + return obj; + }, + + create, I>>( + base?: I, + ): AzureFilePersistentVolumeSource { + return AzureFilePersistentVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): AzureFilePersistentVolumeSource { + const message = createBaseAzureFilePersistentVolumeSource(); + message.secretName = object.secretName ?? ''; + message.shareName = object.shareName ?? ''; + message.readOnly = object.readOnly ?? false; + message.secretNamespace = object.secretNamespace ?? ''; + return message; + }, +}; + +function createBaseAzureFileVolumeSource(): AzureFileVolumeSource { + return { secretName: '', shareName: '', readOnly: false }; +} + +export const AzureFileVolumeSource: MessageFns = { + encode(message: AzureFileVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.secretName !== undefined && message.secretName !== '') { + writer.uint32(10).string(message.secretName); + } + if (message.shareName !== undefined && message.shareName !== '') { + writer.uint32(18).string(message.shareName); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(24).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AzureFileVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAzureFileVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.secretName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.shareName = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AzureFileVolumeSource { + return { + secretName: isSet(object.secretName) ? globalThis.String(object.secretName) : '', + shareName: isSet(object.shareName) ? globalThis.String(object.shareName) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: AzureFileVolumeSource): unknown { + const obj: any = {}; + if (message.secretName !== undefined && message.secretName !== '') { + obj.secretName = message.secretName; + } + if (message.shareName !== undefined && message.shareName !== '') { + obj.shareName = message.shareName; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>(base?: I): AzureFileVolumeSource { + return AzureFileVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AzureFileVolumeSource { + const message = createBaseAzureFileVolumeSource(); + message.secretName = object.secretName ?? ''; + message.shareName = object.shareName ?? ''; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBaseBinding(): Binding { + return { metadata: undefined, target: undefined }; +} + +export const Binding: MessageFns = { + encode(message: Binding, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.target !== undefined) { + ObjectReference.encode(message.target, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Binding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBinding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.target = ObjectReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Binding { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + target: isSet(object.target) ? ObjectReference.fromJSON(object.target) : undefined, + }; + }, + + toJSON(message: Binding): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.target !== undefined) { + obj.target = ObjectReference.toJSON(message.target); + } + return obj; + }, + + create, I>>(base?: I): Binding { + return Binding.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Binding { + const message = createBaseBinding(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.target = + object.target !== undefined && object.target !== null + ? ObjectReference.fromPartial(object.target) + : undefined; + return message; + }, +}; + +function createBaseCSIPersistentVolumeSource(): CSIPersistentVolumeSource { + return { + driver: '', + volumeHandle: '', + readOnly: false, + fsType: '', + volumeAttributes: {}, + controllerPublishSecretRef: undefined, + nodeStageSecretRef: undefined, + nodePublishSecretRef: undefined, + controllerExpandSecretRef: undefined, + nodeExpandSecretRef: undefined, + }; +} + +export const CSIPersistentVolumeSource: MessageFns = { + encode(message: CSIPersistentVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.driver !== undefined && message.driver !== '') { + writer.uint32(10).string(message.driver); + } + if (message.volumeHandle !== undefined && message.volumeHandle !== '') { + writer.uint32(18).string(message.volumeHandle); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(24).bool(message.readOnly); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(34).string(message.fsType); + } + globalThis.Object.entries(message.volumeAttributes).forEach(([key, value]: [string, string]) => { + CSIPersistentVolumeSource_VolumeAttributesEntry.encode( + { key: key as any, value }, + writer.uint32(42).fork(), + ).join(); + }); + if (message.controllerPublishSecretRef !== undefined) { + SecretReference.encode(message.controllerPublishSecretRef, writer.uint32(50).fork()).join(); + } + if (message.nodeStageSecretRef !== undefined) { + SecretReference.encode(message.nodeStageSecretRef, writer.uint32(58).fork()).join(); + } + if (message.nodePublishSecretRef !== undefined) { + SecretReference.encode(message.nodePublishSecretRef, writer.uint32(66).fork()).join(); + } + if (message.controllerExpandSecretRef !== undefined) { + SecretReference.encode(message.controllerExpandSecretRef, writer.uint32(74).fork()).join(); + } + if (message.nodeExpandSecretRef !== undefined) { + SecretReference.encode(message.nodeExpandSecretRef, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CSIPersistentVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCSIPersistentVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.driver = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.volumeHandle = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + const entry5 = CSIPersistentVolumeSource_VolumeAttributesEntry.decode( + reader, + reader.uint32(), + ); + if (entry5.value !== undefined) { + message.volumeAttributes[entry5.key] = entry5.value; + } + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.controllerPublishSecretRef = SecretReference.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.nodeStageSecretRef = SecretReference.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.nodePublishSecretRef = SecretReference.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.controllerExpandSecretRef = SecretReference.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.nodeExpandSecretRef = SecretReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CSIPersistentVolumeSource { + return { + driver: isSet(object.driver) ? globalThis.String(object.driver) : '', + volumeHandle: isSet(object.volumeHandle) ? globalThis.String(object.volumeHandle) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + volumeAttributes: isObject(object.volumeAttributes) + ? (globalThis.Object.entries(object.volumeAttributes) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + controllerPublishSecretRef: isSet(object.controllerPublishSecretRef) + ? SecretReference.fromJSON(object.controllerPublishSecretRef) + : undefined, + nodeStageSecretRef: isSet(object.nodeStageSecretRef) + ? SecretReference.fromJSON(object.nodeStageSecretRef) + : undefined, + nodePublishSecretRef: isSet(object.nodePublishSecretRef) + ? SecretReference.fromJSON(object.nodePublishSecretRef) + : undefined, + controllerExpandSecretRef: isSet(object.controllerExpandSecretRef) + ? SecretReference.fromJSON(object.controllerExpandSecretRef) + : undefined, + nodeExpandSecretRef: isSet(object.nodeExpandSecretRef) + ? SecretReference.fromJSON(object.nodeExpandSecretRef) + : undefined, + }; + }, + + toJSON(message: CSIPersistentVolumeSource): unknown { + const obj: any = {}; + if (message.driver !== undefined && message.driver !== '') { + obj.driver = message.driver; + } + if (message.volumeHandle !== undefined && message.volumeHandle !== '') { + obj.volumeHandle = message.volumeHandle; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.volumeAttributes) { + const entries = globalThis.Object.entries(message.volumeAttributes) as [string, string][]; + if (entries.length > 0) { + obj.volumeAttributes = {}; + entries.forEach(([k, v]) => { + obj.volumeAttributes[k] = v; + }); + } + } + if (message.controllerPublishSecretRef !== undefined) { + obj.controllerPublishSecretRef = SecretReference.toJSON(message.controllerPublishSecretRef); + } + if (message.nodeStageSecretRef !== undefined) { + obj.nodeStageSecretRef = SecretReference.toJSON(message.nodeStageSecretRef); + } + if (message.nodePublishSecretRef !== undefined) { + obj.nodePublishSecretRef = SecretReference.toJSON(message.nodePublishSecretRef); + } + if (message.controllerExpandSecretRef !== undefined) { + obj.controllerExpandSecretRef = SecretReference.toJSON(message.controllerExpandSecretRef); + } + if (message.nodeExpandSecretRef !== undefined) { + obj.nodeExpandSecretRef = SecretReference.toJSON(message.nodeExpandSecretRef); + } + return obj; + }, + + create, I>>(base?: I): CSIPersistentVolumeSource { + return CSIPersistentVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CSIPersistentVolumeSource { + const message = createBaseCSIPersistentVolumeSource(); + message.driver = object.driver ?? ''; + message.volumeHandle = object.volumeHandle ?? ''; + message.readOnly = object.readOnly ?? false; + message.fsType = object.fsType ?? ''; + message.volumeAttributes = ( + globalThis.Object.entries(object.volumeAttributes ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.controllerPublishSecretRef = + object.controllerPublishSecretRef !== undefined && object.controllerPublishSecretRef !== null + ? SecretReference.fromPartial(object.controllerPublishSecretRef) + : undefined; + message.nodeStageSecretRef = + object.nodeStageSecretRef !== undefined && object.nodeStageSecretRef !== null + ? SecretReference.fromPartial(object.nodeStageSecretRef) + : undefined; + message.nodePublishSecretRef = + object.nodePublishSecretRef !== undefined && object.nodePublishSecretRef !== null + ? SecretReference.fromPartial(object.nodePublishSecretRef) + : undefined; + message.controllerExpandSecretRef = + object.controllerExpandSecretRef !== undefined && object.controllerExpandSecretRef !== null + ? SecretReference.fromPartial(object.controllerExpandSecretRef) + : undefined; + message.nodeExpandSecretRef = + object.nodeExpandSecretRef !== undefined && object.nodeExpandSecretRef !== null + ? SecretReference.fromPartial(object.nodeExpandSecretRef) + : undefined; + return message; + }, +}; + +function createBaseCSIPersistentVolumeSource_VolumeAttributesEntry(): CSIPersistentVolumeSource_VolumeAttributesEntry { + return { key: '', value: '' }; +} + +export const CSIPersistentVolumeSource_VolumeAttributesEntry: MessageFns = + { + encode( + message: CSIPersistentVolumeSource_VolumeAttributesEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): CSIPersistentVolumeSource_VolumeAttributesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCSIPersistentVolumeSource_VolumeAttributesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CSIPersistentVolumeSource_VolumeAttributesEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: CSIPersistentVolumeSource_VolumeAttributesEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): CSIPersistentVolumeSource_VolumeAttributesEntry { + return CSIPersistentVolumeSource_VolumeAttributesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CSIPersistentVolumeSource_VolumeAttributesEntry { + const message = createBaseCSIPersistentVolumeSource_VolumeAttributesEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, + }; + +function createBaseCSIVolumeSource(): CSIVolumeSource { + return { driver: '', readOnly: false, fsType: '', volumeAttributes: {}, nodePublishSecretRef: undefined }; +} + +export const CSIVolumeSource: MessageFns = { + encode(message: CSIVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.driver !== undefined && message.driver !== '') { + writer.uint32(10).string(message.driver); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(16).bool(message.readOnly); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(26).string(message.fsType); + } + globalThis.Object.entries(message.volumeAttributes).forEach(([key, value]: [string, string]) => { + CSIVolumeSource_VolumeAttributesEntry.encode( + { key: key as any, value }, + writer.uint32(34).fork(), + ).join(); + }); + if (message.nodePublishSecretRef !== undefined) { + LocalObjectReference.encode(message.nodePublishSecretRef, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CSIVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCSIVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.driver = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + const entry4 = CSIVolumeSource_VolumeAttributesEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.volumeAttributes[entry4.key] = entry4.value; + } + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.nodePublishSecretRef = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CSIVolumeSource { + return { + driver: isSet(object.driver) ? globalThis.String(object.driver) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + volumeAttributes: isObject(object.volumeAttributes) + ? (globalThis.Object.entries(object.volumeAttributes) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + nodePublishSecretRef: isSet(object.nodePublishSecretRef) + ? LocalObjectReference.fromJSON(object.nodePublishSecretRef) + : undefined, + }; + }, + + toJSON(message: CSIVolumeSource): unknown { + const obj: any = {}; + if (message.driver !== undefined && message.driver !== '') { + obj.driver = message.driver; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.volumeAttributes) { + const entries = globalThis.Object.entries(message.volumeAttributes) as [string, string][]; + if (entries.length > 0) { + obj.volumeAttributes = {}; + entries.forEach(([k, v]) => { + obj.volumeAttributes[k] = v; + }); + } + } + if (message.nodePublishSecretRef !== undefined) { + obj.nodePublishSecretRef = LocalObjectReference.toJSON(message.nodePublishSecretRef); + } + return obj; + }, + + create, I>>(base?: I): CSIVolumeSource { + return CSIVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CSIVolumeSource { + const message = createBaseCSIVolumeSource(); + message.driver = object.driver ?? ''; + message.readOnly = object.readOnly ?? false; + message.fsType = object.fsType ?? ''; + message.volumeAttributes = ( + globalThis.Object.entries(object.volumeAttributes ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.nodePublishSecretRef = + object.nodePublishSecretRef !== undefined && object.nodePublishSecretRef !== null + ? LocalObjectReference.fromPartial(object.nodePublishSecretRef) + : undefined; + return message; + }, +}; + +function createBaseCSIVolumeSource_VolumeAttributesEntry(): CSIVolumeSource_VolumeAttributesEntry { + return { key: '', value: '' }; +} + +export const CSIVolumeSource_VolumeAttributesEntry: MessageFns = { + encode( + message: CSIVolumeSource_VolumeAttributesEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CSIVolumeSource_VolumeAttributesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCSIVolumeSource_VolumeAttributesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CSIVolumeSource_VolumeAttributesEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: CSIVolumeSource_VolumeAttributesEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): CSIVolumeSource_VolumeAttributesEntry { + return CSIVolumeSource_VolumeAttributesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CSIVolumeSource_VolumeAttributesEntry { + const message = createBaseCSIVolumeSource_VolumeAttributesEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBaseCapabilities(): Capabilities { + return { add: [], drop: [] }; +} + +export const Capabilities: MessageFns = { + encode(message: Capabilities, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.add) { + writer.uint32(10).string(v!); + } + for (const v of message.drop) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Capabilities { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCapabilities(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.add.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.drop.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Capabilities { + return { + add: globalThis.Array.isArray(object?.add) + ? object.add.map((e: any) => globalThis.String(e)) + : [], + drop: globalThis.Array.isArray(object?.drop) + ? object.drop.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: Capabilities): unknown { + const obj: any = {}; + if (message.add?.length) { + obj.add = message.add; + } + if (message.drop?.length) { + obj.drop = message.drop; + } + return obj; + }, + + create, I>>(base?: I): Capabilities { + return Capabilities.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Capabilities { + const message = createBaseCapabilities(); + message.add = object.add?.map((e) => e) || []; + message.drop = object.drop?.map((e) => e) || []; + return message; + }, +}; + +function createBaseCephFSPersistentVolumeSource(): CephFSPersistentVolumeSource { + return { monitors: [], path: '', user: '', secretFile: '', secretRef: undefined, readOnly: false }; +} + +export const CephFSPersistentVolumeSource: MessageFns = { + encode(message: CephFSPersistentVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.monitors) { + writer.uint32(10).string(v!); + } + if (message.path !== undefined && message.path !== '') { + writer.uint32(18).string(message.path); + } + if (message.user !== undefined && message.user !== '') { + writer.uint32(26).string(message.user); + } + if (message.secretFile !== undefined && message.secretFile !== '') { + writer.uint32(34).string(message.secretFile); + } + if (message.secretRef !== undefined) { + SecretReference.encode(message.secretRef, writer.uint32(42).fork()).join(); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(48).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CephFSPersistentVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCephFSPersistentVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.monitors.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.user = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.secretFile = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.secretRef = SecretReference.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CephFSPersistentVolumeSource { + return { + monitors: globalThis.Array.isArray(object?.monitors) + ? object.monitors.map((e: any) => globalThis.String(e)) + : [], + path: isSet(object.path) ? globalThis.String(object.path) : '', + user: isSet(object.user) ? globalThis.String(object.user) : '', + secretFile: isSet(object.secretFile) ? globalThis.String(object.secretFile) : '', + secretRef: isSet(object.secretRef) ? SecretReference.fromJSON(object.secretRef) : undefined, + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: CephFSPersistentVolumeSource): unknown { + const obj: any = {}; + if (message.monitors?.length) { + obj.monitors = message.monitors; + } + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.user !== undefined && message.user !== '') { + obj.user = message.user; + } + if (message.secretFile !== undefined && message.secretFile !== '') { + obj.secretFile = message.secretFile; + } + if (message.secretRef !== undefined) { + obj.secretRef = SecretReference.toJSON(message.secretRef); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>( + base?: I, + ): CephFSPersistentVolumeSource { + return CephFSPersistentVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CephFSPersistentVolumeSource { + const message = createBaseCephFSPersistentVolumeSource(); + message.monitors = object.monitors?.map((e) => e) || []; + message.path = object.path ?? ''; + message.user = object.user ?? ''; + message.secretFile = object.secretFile ?? ''; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? SecretReference.fromPartial(object.secretRef) + : undefined; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBaseCephFSVolumeSource(): CephFSVolumeSource { + return { monitors: [], path: '', user: '', secretFile: '', secretRef: undefined, readOnly: false }; +} + +export const CephFSVolumeSource: MessageFns = { + encode(message: CephFSVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.monitors) { + writer.uint32(10).string(v!); + } + if (message.path !== undefined && message.path !== '') { + writer.uint32(18).string(message.path); + } + if (message.user !== undefined && message.user !== '') { + writer.uint32(26).string(message.user); + } + if (message.secretFile !== undefined && message.secretFile !== '') { + writer.uint32(34).string(message.secretFile); + } + if (message.secretRef !== undefined) { + LocalObjectReference.encode(message.secretRef, writer.uint32(42).fork()).join(); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(48).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CephFSVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCephFSVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.monitors.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.user = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.secretFile = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.secretRef = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CephFSVolumeSource { + return { + monitors: globalThis.Array.isArray(object?.monitors) + ? object.monitors.map((e: any) => globalThis.String(e)) + : [], + path: isSet(object.path) ? globalThis.String(object.path) : '', + user: isSet(object.user) ? globalThis.String(object.user) : '', + secretFile: isSet(object.secretFile) ? globalThis.String(object.secretFile) : '', + secretRef: isSet(object.secretRef) ? LocalObjectReference.fromJSON(object.secretRef) : undefined, + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: CephFSVolumeSource): unknown { + const obj: any = {}; + if (message.monitors?.length) { + obj.monitors = message.monitors; + } + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.user !== undefined && message.user !== '') { + obj.user = message.user; + } + if (message.secretFile !== undefined && message.secretFile !== '') { + obj.secretFile = message.secretFile; + } + if (message.secretRef !== undefined) { + obj.secretRef = LocalObjectReference.toJSON(message.secretRef); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>(base?: I): CephFSVolumeSource { + return CephFSVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CephFSVolumeSource { + const message = createBaseCephFSVolumeSource(); + message.monitors = object.monitors?.map((e) => e) || []; + message.path = object.path ?? ''; + message.user = object.user ?? ''; + message.secretFile = object.secretFile ?? ''; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? LocalObjectReference.fromPartial(object.secretRef) + : undefined; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBaseCinderPersistentVolumeSource(): CinderPersistentVolumeSource { + return { volumeID: '', fsType: '', readOnly: false, secretRef: undefined }; +} + +export const CinderPersistentVolumeSource: MessageFns = { + encode(message: CinderPersistentVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.volumeID !== undefined && message.volumeID !== '') { + writer.uint32(10).string(message.volumeID); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(18).string(message.fsType); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(24).bool(message.readOnly); + } + if (message.secretRef !== undefined) { + SecretReference.encode(message.secretRef, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CinderPersistentVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCinderPersistentVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.volumeID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.secretRef = SecretReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CinderPersistentVolumeSource { + return { + volumeID: isSet(object.volumeID) ? globalThis.String(object.volumeID) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + secretRef: isSet(object.secretRef) ? SecretReference.fromJSON(object.secretRef) : undefined, + }; + }, + + toJSON(message: CinderPersistentVolumeSource): unknown { + const obj: any = {}; + if (message.volumeID !== undefined && message.volumeID !== '') { + obj.volumeID = message.volumeID; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.secretRef !== undefined) { + obj.secretRef = SecretReference.toJSON(message.secretRef); + } + return obj; + }, + + create, I>>( + base?: I, + ): CinderPersistentVolumeSource { + return CinderPersistentVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CinderPersistentVolumeSource { + const message = createBaseCinderPersistentVolumeSource(); + message.volumeID = object.volumeID ?? ''; + message.fsType = object.fsType ?? ''; + message.readOnly = object.readOnly ?? false; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? SecretReference.fromPartial(object.secretRef) + : undefined; + return message; + }, +}; + +function createBaseCinderVolumeSource(): CinderVolumeSource { + return { volumeID: '', fsType: '', readOnly: false, secretRef: undefined }; +} + +export const CinderVolumeSource: MessageFns = { + encode(message: CinderVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.volumeID !== undefined && message.volumeID !== '') { + writer.uint32(10).string(message.volumeID); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(18).string(message.fsType); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(24).bool(message.readOnly); + } + if (message.secretRef !== undefined) { + LocalObjectReference.encode(message.secretRef, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CinderVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCinderVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.volumeID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.secretRef = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CinderVolumeSource { + return { + volumeID: isSet(object.volumeID) ? globalThis.String(object.volumeID) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + secretRef: isSet(object.secretRef) ? LocalObjectReference.fromJSON(object.secretRef) : undefined, + }; + }, + + toJSON(message: CinderVolumeSource): unknown { + const obj: any = {}; + if (message.volumeID !== undefined && message.volumeID !== '') { + obj.volumeID = message.volumeID; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.secretRef !== undefined) { + obj.secretRef = LocalObjectReference.toJSON(message.secretRef); + } + return obj; + }, + + create, I>>(base?: I): CinderVolumeSource { + return CinderVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CinderVolumeSource { + const message = createBaseCinderVolumeSource(); + message.volumeID = object.volumeID ?? ''; + message.fsType = object.fsType ?? ''; + message.readOnly = object.readOnly ?? false; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? LocalObjectReference.fromPartial(object.secretRef) + : undefined; + return message; + }, +}; + +function createBaseClientIPConfig(): ClientIPConfig { + return { timeoutSeconds: 0 }; +} + +export const ClientIPConfig: MessageFns = { + encode(message: ClientIPConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.timeoutSeconds !== undefined && message.timeoutSeconds !== 0) { + writer.uint32(8).int32(message.timeoutSeconds); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientIPConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientIPConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.timeoutSeconds = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ClientIPConfig { + return { + timeoutSeconds: isSet(object.timeoutSeconds) ? globalThis.Number(object.timeoutSeconds) : 0, + }; + }, + + toJSON(message: ClientIPConfig): unknown { + const obj: any = {}; + if (message.timeoutSeconds !== undefined && message.timeoutSeconds !== 0) { + obj.timeoutSeconds = Math.round(message.timeoutSeconds); + } + return obj; + }, + + create, I>>(base?: I): ClientIPConfig { + return ClientIPConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClientIPConfig { + const message = createBaseClientIPConfig(); + message.timeoutSeconds = object.timeoutSeconds ?? 0; + return message; + }, +}; + +function createBaseClusterTrustBundleProjection(): ClusterTrustBundleProjection { + return { name: '', signerName: '', labelSelector: undefined, optional: false, path: '', user: 0 }; +} + +export const ClusterTrustBundleProjection: MessageFns = { + encode(message: ClusterTrustBundleProjection, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.signerName !== undefined && message.signerName !== '') { + writer.uint32(18).string(message.signerName); + } + if (message.labelSelector !== undefined) { + LabelSelector.encode(message.labelSelector, writer.uint32(26).fork()).join(); + } + if (message.optional !== undefined && message.optional !== false) { + writer.uint32(40).bool(message.optional); + } + if (message.path !== undefined && message.path !== '') { + writer.uint32(34).string(message.path); + } + if (message.user !== undefined && message.user !== 0) { + writer.uint32(48).int64(message.user); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClusterTrustBundleProjection { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClusterTrustBundleProjection(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.signerName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.labelSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.optional = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.path = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.user = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ClusterTrustBundleProjection { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + signerName: isSet(object.signerName) ? globalThis.String(object.signerName) : '', + labelSelector: isSet(object.labelSelector) + ? LabelSelector.fromJSON(object.labelSelector) + : undefined, + optional: isSet(object.optional) ? globalThis.Boolean(object.optional) : false, + path: isSet(object.path) ? globalThis.String(object.path) : '', + user: isSet(object.user) ? globalThis.Number(object.user) : 0, + }; + }, + + toJSON(message: ClusterTrustBundleProjection): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.signerName !== undefined && message.signerName !== '') { + obj.signerName = message.signerName; + } + if (message.labelSelector !== undefined) { + obj.labelSelector = LabelSelector.toJSON(message.labelSelector); + } + if (message.optional !== undefined && message.optional !== false) { + obj.optional = message.optional; + } + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.user !== undefined && message.user !== 0) { + obj.user = Math.round(message.user); + } + return obj; + }, + + create, I>>( + base?: I, + ): ClusterTrustBundleProjection { + return ClusterTrustBundleProjection.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ClusterTrustBundleProjection { + const message = createBaseClusterTrustBundleProjection(); + message.name = object.name ?? ''; + message.signerName = object.signerName ?? ''; + message.labelSelector = + object.labelSelector !== undefined && object.labelSelector !== null + ? LabelSelector.fromPartial(object.labelSelector) + : undefined; + message.optional = object.optional ?? false; + message.path = object.path ?? ''; + message.user = object.user ?? 0; + return message; + }, +}; + +function createBaseComponentCondition(): ComponentCondition { + return { type: '', status: '', message: '', error: '' }; +} + +export const ComponentCondition: MessageFns = { + encode(message: ComponentCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(26).string(message.message); + } + if (message.error !== undefined && message.error !== '') { + writer.uint32(34).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ComponentCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseComponentCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.error = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ComponentCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + error: isSet(object.error) ? globalThis.String(object.error) : '', + }; + }, + + toJSON(message: ComponentCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + if (message.error !== undefined && message.error !== '') { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): ComponentCondition { + return ComponentCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ComponentCondition { + const message = createBaseComponentCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.message = object.message ?? ''; + message.error = object.error ?? ''; + return message; + }, +}; + +function createBaseComponentStatus(): ComponentStatus { + return { metadata: undefined, conditions: [] }; +} + +export const ComponentStatus: MessageFns = { + encode(message: ComponentStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.conditions) { + ComponentCondition.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ComponentStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseComponentStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.conditions.push(ComponentCondition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ComponentStatus { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => ComponentCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ComponentStatus): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => ComponentCondition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ComponentStatus { + return ComponentStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ComponentStatus { + const message = createBaseComponentStatus(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.conditions = object.conditions?.map((e) => ComponentCondition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseComponentStatusList(): ComponentStatusList { + return { metadata: undefined, items: [] }; +} + +export const ComponentStatusList: MessageFns = { + encode(message: ComponentStatusList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ComponentStatus.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ComponentStatusList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseComponentStatusList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ComponentStatus.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ComponentStatusList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ComponentStatus.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ComponentStatusList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ComponentStatus.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ComponentStatusList { + return ComponentStatusList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ComponentStatusList { + const message = createBaseComponentStatusList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ComponentStatus.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseConfigMap(): ConfigMap { + return { metadata: undefined, immutable: false, data: {}, binaryData: {} }; +} + +export const ConfigMap: MessageFns = { + encode(message: ConfigMap, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.immutable !== undefined && message.immutable !== false) { + writer.uint32(32).bool(message.immutable); + } + globalThis.Object.entries(message.data).forEach(([key, value]: [string, string]) => { + ConfigMap_DataEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); + }); + globalThis.Object.entries(message.binaryData).forEach(([key, value]: [string, Uint8Array]) => { + ConfigMap_BinaryDataEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigMap { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigMap(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.immutable = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = ConfigMap_DataEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.data[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + const entry3 = ConfigMap_BinaryDataEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.binaryData[entry3.key] = entry3.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ConfigMap { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + immutable: isSet(object.immutable) ? globalThis.Boolean(object.immutable) : false, + data: isObject(object.data) + ? (globalThis.Object.entries(object.data) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + binaryData: isObject(object.binaryData) + ? (globalThis.Object.entries(object.binaryData) as [string, any][]).reduce( + (acc: { [key: string]: Uint8Array }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: bytesFromBase64(value as string), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: ConfigMap): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.immutable !== undefined && message.immutable !== false) { + obj.immutable = message.immutable; + } + if (message.data) { + const entries = globalThis.Object.entries(message.data) as [string, string][]; + if (entries.length > 0) { + obj.data = {}; + entries.forEach(([k, v]) => { + obj.data[k] = v; + }); + } + } + if (message.binaryData) { + const entries = globalThis.Object.entries(message.binaryData) as [string, Uint8Array][]; + if (entries.length > 0) { + obj.binaryData = {}; + entries.forEach(([k, v]) => { + obj.binaryData[k] = base64FromBytes(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): ConfigMap { + return ConfigMap.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigMap { + const message = createBaseConfigMap(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.immutable = object.immutable ?? false; + message.data = (globalThis.Object.entries(object.data ?? {}) as [string, string][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.binaryData = ( + globalThis.Object.entries(object.binaryData ?? {}) as [string, Uint8Array][] + ).reduce((acc: { [key: string]: Uint8Array }, [key, value]: [string, Uint8Array]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseConfigMap_DataEntry(): ConfigMap_DataEntry { + return { key: '', value: '' }; +} + +export const ConfigMap_DataEntry: MessageFns = { + encode(message: ConfigMap_DataEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigMap_DataEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigMap_DataEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ConfigMap_DataEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: ConfigMap_DataEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): ConfigMap_DataEntry { + return ConfigMap_DataEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigMap_DataEntry { + const message = createBaseConfigMap_DataEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBaseConfigMap_BinaryDataEntry(): ConfigMap_BinaryDataEntry { + return { key: '', value: new Uint8Array(0) }; +} + +export const ConfigMap_BinaryDataEntry: MessageFns = { + encode(message: ConfigMap_BinaryDataEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigMap_BinaryDataEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigMap_BinaryDataEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ConfigMap_BinaryDataEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: ConfigMap_BinaryDataEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): ConfigMap_BinaryDataEntry { + return ConfigMap_BinaryDataEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ConfigMap_BinaryDataEntry { + const message = createBaseConfigMap_BinaryDataEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseConfigMapEnvSource(): ConfigMapEnvSource { + return { localObjectReference: undefined, optional: false }; +} + +export const ConfigMapEnvSource: MessageFns = { + encode(message: ConfigMapEnvSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.localObjectReference !== undefined) { + LocalObjectReference.encode(message.localObjectReference, writer.uint32(10).fork()).join(); + } + if (message.optional !== undefined && message.optional !== false) { + writer.uint32(16).bool(message.optional); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigMapEnvSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigMapEnvSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.localObjectReference = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.optional = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ConfigMapEnvSource { + return { + localObjectReference: isSet(object.localObjectReference) + ? LocalObjectReference.fromJSON(object.localObjectReference) + : undefined, + optional: isSet(object.optional) ? globalThis.Boolean(object.optional) : false, + }; + }, + + toJSON(message: ConfigMapEnvSource): unknown { + const obj: any = {}; + if (message.localObjectReference !== undefined) { + obj.localObjectReference = LocalObjectReference.toJSON(message.localObjectReference); + } + if (message.optional !== undefined && message.optional !== false) { + obj.optional = message.optional; + } + return obj; + }, + + create, I>>(base?: I): ConfigMapEnvSource { + return ConfigMapEnvSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigMapEnvSource { + const message = createBaseConfigMapEnvSource(); + message.localObjectReference = + object.localObjectReference !== undefined && object.localObjectReference !== null + ? LocalObjectReference.fromPartial(object.localObjectReference) + : undefined; + message.optional = object.optional ?? false; + return message; + }, +}; + +function createBaseConfigMapKeySelector(): ConfigMapKeySelector { + return { localObjectReference: undefined, key: '', optional: false }; +} + +export const ConfigMapKeySelector: MessageFns = { + encode(message: ConfigMapKeySelector, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.localObjectReference !== undefined) { + LocalObjectReference.encode(message.localObjectReference, writer.uint32(10).fork()).join(); + } + if (message.key !== undefined && message.key !== '') { + writer.uint32(18).string(message.key); + } + if (message.optional !== undefined && message.optional !== false) { + writer.uint32(24).bool(message.optional); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigMapKeySelector { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigMapKeySelector(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.localObjectReference = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.optional = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ConfigMapKeySelector { + return { + localObjectReference: isSet(object.localObjectReference) + ? LocalObjectReference.fromJSON(object.localObjectReference) + : undefined, + key: isSet(object.key) ? globalThis.String(object.key) : '', + optional: isSet(object.optional) ? globalThis.Boolean(object.optional) : false, + }; + }, + + toJSON(message: ConfigMapKeySelector): unknown { + const obj: any = {}; + if (message.localObjectReference !== undefined) { + obj.localObjectReference = LocalObjectReference.toJSON(message.localObjectReference); + } + if (message.key !== undefined && message.key !== '') { + obj.key = message.key; + } + if (message.optional !== undefined && message.optional !== false) { + obj.optional = message.optional; + } + return obj; + }, + + create, I>>(base?: I): ConfigMapKeySelector { + return ConfigMapKeySelector.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigMapKeySelector { + const message = createBaseConfigMapKeySelector(); + message.localObjectReference = + object.localObjectReference !== undefined && object.localObjectReference !== null + ? LocalObjectReference.fromPartial(object.localObjectReference) + : undefined; + message.key = object.key ?? ''; + message.optional = object.optional ?? false; + return message; + }, +}; + +function createBaseConfigMapList(): ConfigMapList { + return { metadata: undefined, items: [] }; +} + +export const ConfigMapList: MessageFns = { + encode(message: ConfigMapList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ConfigMap.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigMapList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigMapList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ConfigMap.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ConfigMapList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ConfigMap.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ConfigMapList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ConfigMap.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ConfigMapList { + return ConfigMapList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigMapList { + const message = createBaseConfigMapList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ConfigMap.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseConfigMapNodeConfigSource(): ConfigMapNodeConfigSource { + return { namespace: '', name: '', uid: '', resourceVersion: '', kubeletConfigKey: '' }; +} + +export const ConfigMapNodeConfigSource: MessageFns = { + encode(message: ConfigMapNodeConfigSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(10).string(message.namespace); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(18).string(message.name); + } + if (message.uid !== undefined && message.uid !== '') { + writer.uint32(26).string(message.uid); + } + if (message.resourceVersion !== undefined && message.resourceVersion !== '') { + writer.uint32(34).string(message.resourceVersion); + } + if (message.kubeletConfigKey !== undefined && message.kubeletConfigKey !== '') { + writer.uint32(42).string(message.kubeletConfigKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigMapNodeConfigSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigMapNodeConfigSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.namespace = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.uid = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.resourceVersion = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.kubeletConfigKey = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ConfigMapNodeConfigSource { + return { + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + uid: isSet(object.uid) ? globalThis.String(object.uid) : '', + resourceVersion: isSet(object.resourceVersion) ? globalThis.String(object.resourceVersion) : '', + kubeletConfigKey: isSet(object.kubeletConfigKey) + ? globalThis.String(object.kubeletConfigKey) + : '', + }; + }, + + toJSON(message: ConfigMapNodeConfigSource): unknown { + const obj: any = {}; + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.uid !== undefined && message.uid !== '') { + obj.uid = message.uid; + } + if (message.resourceVersion !== undefined && message.resourceVersion !== '') { + obj.resourceVersion = message.resourceVersion; + } + if (message.kubeletConfigKey !== undefined && message.kubeletConfigKey !== '') { + obj.kubeletConfigKey = message.kubeletConfigKey; + } + return obj; + }, + + create, I>>(base?: I): ConfigMapNodeConfigSource { + return ConfigMapNodeConfigSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ConfigMapNodeConfigSource { + const message = createBaseConfigMapNodeConfigSource(); + message.namespace = object.namespace ?? ''; + message.name = object.name ?? ''; + message.uid = object.uid ?? ''; + message.resourceVersion = object.resourceVersion ?? ''; + message.kubeletConfigKey = object.kubeletConfigKey ?? ''; + return message; + }, +}; + +function createBaseConfigMapProjection(): ConfigMapProjection { + return { localObjectReference: undefined, items: [], optional: false }; +} + +export const ConfigMapProjection: MessageFns = { + encode(message: ConfigMapProjection, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.localObjectReference !== undefined) { + LocalObjectReference.encode(message.localObjectReference, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + KeyToPath.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.optional !== undefined && message.optional !== false) { + writer.uint32(32).bool(message.optional); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigMapProjection { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigMapProjection(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.localObjectReference = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(KeyToPath.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.optional = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ConfigMapProjection { + return { + localObjectReference: isSet(object.localObjectReference) + ? LocalObjectReference.fromJSON(object.localObjectReference) + : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => KeyToPath.fromJSON(e)) + : [], + optional: isSet(object.optional) ? globalThis.Boolean(object.optional) : false, + }; + }, + + toJSON(message: ConfigMapProjection): unknown { + const obj: any = {}; + if (message.localObjectReference !== undefined) { + obj.localObjectReference = LocalObjectReference.toJSON(message.localObjectReference); + } + if (message.items?.length) { + obj.items = message.items.map((e) => KeyToPath.toJSON(e)); + } + if (message.optional !== undefined && message.optional !== false) { + obj.optional = message.optional; + } + return obj; + }, + + create, I>>(base?: I): ConfigMapProjection { + return ConfigMapProjection.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigMapProjection { + const message = createBaseConfigMapProjection(); + message.localObjectReference = + object.localObjectReference !== undefined && object.localObjectReference !== null + ? LocalObjectReference.fromPartial(object.localObjectReference) + : undefined; + message.items = object.items?.map((e) => KeyToPath.fromPartial(e)) || []; + message.optional = object.optional ?? false; + return message; + }, +}; + +function createBaseConfigMapVolumeSource(): ConfigMapVolumeSource { + return { localObjectReference: undefined, items: [], defaultMode: 0, optional: false, defaultUser: 0 }; +} + +export const ConfigMapVolumeSource: MessageFns = { + encode(message: ConfigMapVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.localObjectReference !== undefined) { + LocalObjectReference.encode(message.localObjectReference, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + KeyToPath.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.defaultMode !== undefined && message.defaultMode !== 0) { + writer.uint32(24).int32(message.defaultMode); + } + if (message.optional !== undefined && message.optional !== false) { + writer.uint32(32).bool(message.optional); + } + if (message.defaultUser !== undefined && message.defaultUser !== 0) { + writer.uint32(40).int64(message.defaultUser); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigMapVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigMapVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.localObjectReference = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(KeyToPath.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.defaultMode = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.optional = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.defaultUser = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ConfigMapVolumeSource { + return { + localObjectReference: isSet(object.localObjectReference) + ? LocalObjectReference.fromJSON(object.localObjectReference) + : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => KeyToPath.fromJSON(e)) + : [], + defaultMode: isSet(object.defaultMode) ? globalThis.Number(object.defaultMode) : 0, + optional: isSet(object.optional) ? globalThis.Boolean(object.optional) : false, + defaultUser: isSet(object.defaultUser) ? globalThis.Number(object.defaultUser) : 0, + }; + }, + + toJSON(message: ConfigMapVolumeSource): unknown { + const obj: any = {}; + if (message.localObjectReference !== undefined) { + obj.localObjectReference = LocalObjectReference.toJSON(message.localObjectReference); + } + if (message.items?.length) { + obj.items = message.items.map((e) => KeyToPath.toJSON(e)); + } + if (message.defaultMode !== undefined && message.defaultMode !== 0) { + obj.defaultMode = Math.round(message.defaultMode); + } + if (message.optional !== undefined && message.optional !== false) { + obj.optional = message.optional; + } + if (message.defaultUser !== undefined && message.defaultUser !== 0) { + obj.defaultUser = Math.round(message.defaultUser); + } + return obj; + }, + + create, I>>(base?: I): ConfigMapVolumeSource { + return ConfigMapVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigMapVolumeSource { + const message = createBaseConfigMapVolumeSource(); + message.localObjectReference = + object.localObjectReference !== undefined && object.localObjectReference !== null + ? LocalObjectReference.fromPartial(object.localObjectReference) + : undefined; + message.items = object.items?.map((e) => KeyToPath.fromPartial(e)) || []; + message.defaultMode = object.defaultMode ?? 0; + message.optional = object.optional ?? false; + message.defaultUser = object.defaultUser ?? 0; + return message; + }, +}; + +function createBaseContainer(): Container { + return { + name: '', + image: '', + command: [], + args: [], + workingDir: '', + ports: [], + envFrom: [], + env: [], + resources: undefined, + resizePolicy: [], + restartPolicy: '', + restartPolicyRules: [], + volumeMounts: [], + volumeDevices: [], + livenessProbe: undefined, + readinessProbe: undefined, + startupProbe: undefined, + lifecycle: undefined, + terminationMessagePath: '', + terminationMessagePolicy: '', + imagePullPolicy: '', + securityContext: undefined, + stdin: false, + stdinOnce: false, + tty: false, + }; +} + +export const Container: MessageFns = { + encode(message: Container, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.image !== undefined && message.image !== '') { + writer.uint32(18).string(message.image); + } + for (const v of message.command) { + writer.uint32(26).string(v!); + } + for (const v of message.args) { + writer.uint32(34).string(v!); + } + if (message.workingDir !== undefined && message.workingDir !== '') { + writer.uint32(42).string(message.workingDir); + } + for (const v of message.ports) { + ContainerPort.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.envFrom) { + EnvFromSource.encode(v!, writer.uint32(154).fork()).join(); + } + for (const v of message.env) { + EnvVar.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.resources !== undefined) { + ResourceRequirements.encode(message.resources, writer.uint32(66).fork()).join(); + } + for (const v of message.resizePolicy) { + ContainerResizePolicy.encode(v!, writer.uint32(186).fork()).join(); + } + if (message.restartPolicy !== undefined && message.restartPolicy !== '') { + writer.uint32(194).string(message.restartPolicy); + } + for (const v of message.restartPolicyRules) { + ContainerRestartRule.encode(v!, writer.uint32(202).fork()).join(); + } + for (const v of message.volumeMounts) { + VolumeMount.encode(v!, writer.uint32(74).fork()).join(); + } + for (const v of message.volumeDevices) { + VolumeDevice.encode(v!, writer.uint32(170).fork()).join(); + } + if (message.livenessProbe !== undefined) { + Probe.encode(message.livenessProbe, writer.uint32(82).fork()).join(); + } + if (message.readinessProbe !== undefined) { + Probe.encode(message.readinessProbe, writer.uint32(90).fork()).join(); + } + if (message.startupProbe !== undefined) { + Probe.encode(message.startupProbe, writer.uint32(178).fork()).join(); + } + if (message.lifecycle !== undefined) { + Lifecycle.encode(message.lifecycle, writer.uint32(98).fork()).join(); + } + if (message.terminationMessagePath !== undefined && message.terminationMessagePath !== '') { + writer.uint32(106).string(message.terminationMessagePath); + } + if (message.terminationMessagePolicy !== undefined && message.terminationMessagePolicy !== '') { + writer.uint32(162).string(message.terminationMessagePolicy); + } + if (message.imagePullPolicy !== undefined && message.imagePullPolicy !== '') { + writer.uint32(114).string(message.imagePullPolicy); + } + if (message.securityContext !== undefined) { + SecurityContext.encode(message.securityContext, writer.uint32(122).fork()).join(); + } + if (message.stdin !== undefined && message.stdin !== false) { + writer.uint32(128).bool(message.stdin); + } + if (message.stdinOnce !== undefined && message.stdinOnce !== false) { + writer.uint32(136).bool(message.stdinOnce); + } + if (message.tty !== undefined && message.tty !== false) { + writer.uint32(144).bool(message.tty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Container { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainer(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.image = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.command.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.args.push(reader.string()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.workingDir = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.ports.push(ContainerPort.decode(reader, reader.uint32())); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + + message.envFrom.push(EnvFromSource.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.env.push(EnvVar.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.resources = ResourceRequirements.decode(reader, reader.uint32()); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + + message.resizePolicy.push(ContainerResizePolicy.decode(reader, reader.uint32())); + continue; + } + case 24: { + if (tag !== 194) { + break; + } + + message.restartPolicy = reader.string(); + continue; + } + case 25: { + if (tag !== 202) { + break; + } + + message.restartPolicyRules.push(ContainerRestartRule.decode(reader, reader.uint32())); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.volumeMounts.push(VolumeMount.decode(reader, reader.uint32())); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + + message.volumeDevices.push(VolumeDevice.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.livenessProbe = Probe.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.readinessProbe = Probe.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + + message.startupProbe = Probe.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.lifecycle = Lifecycle.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.terminationMessagePath = reader.string(); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + + message.terminationMessagePolicy = reader.string(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.imagePullPolicy = reader.string(); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.securityContext = SecurityContext.decode(reader, reader.uint32()); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + + message.stdin = reader.bool(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + + message.stdinOnce = reader.bool(); + continue; + } + case 18: { + if (tag !== 144) { + break; + } + + message.tty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Container { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + image: isSet(object.image) ? globalThis.String(object.image) : '', + command: globalThis.Array.isArray(object?.command) + ? object.command.map((e: any) => globalThis.String(e)) + : [], + args: globalThis.Array.isArray(object?.args) + ? object.args.map((e: any) => globalThis.String(e)) + : [], + workingDir: isSet(object.workingDir) ? globalThis.String(object.workingDir) : '', + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => ContainerPort.fromJSON(e)) + : [], + envFrom: globalThis.Array.isArray(object?.envFrom) + ? object.envFrom.map((e: any) => EnvFromSource.fromJSON(e)) + : [], + env: globalThis.Array.isArray(object?.env) ? object.env.map((e: any) => EnvVar.fromJSON(e)) : [], + resources: isSet(object.resources) ? ResourceRequirements.fromJSON(object.resources) : undefined, + resizePolicy: globalThis.Array.isArray(object?.resizePolicy) + ? object.resizePolicy.map((e: any) => ContainerResizePolicy.fromJSON(e)) + : [], + restartPolicy: isSet(object.restartPolicy) ? globalThis.String(object.restartPolicy) : '', + restartPolicyRules: globalThis.Array.isArray(object?.restartPolicyRules) + ? object.restartPolicyRules.map((e: any) => ContainerRestartRule.fromJSON(e)) + : [], + volumeMounts: globalThis.Array.isArray(object?.volumeMounts) + ? object.volumeMounts.map((e: any) => VolumeMount.fromJSON(e)) + : [], + volumeDevices: globalThis.Array.isArray(object?.volumeDevices) + ? object.volumeDevices.map((e: any) => VolumeDevice.fromJSON(e)) + : [], + livenessProbe: isSet(object.livenessProbe) ? Probe.fromJSON(object.livenessProbe) : undefined, + readinessProbe: isSet(object.readinessProbe) ? Probe.fromJSON(object.readinessProbe) : undefined, + startupProbe: isSet(object.startupProbe) ? Probe.fromJSON(object.startupProbe) : undefined, + lifecycle: isSet(object.lifecycle) ? Lifecycle.fromJSON(object.lifecycle) : undefined, + terminationMessagePath: isSet(object.terminationMessagePath) + ? globalThis.String(object.terminationMessagePath) + : '', + terminationMessagePolicy: isSet(object.terminationMessagePolicy) + ? globalThis.String(object.terminationMessagePolicy) + : '', + imagePullPolicy: isSet(object.imagePullPolicy) ? globalThis.String(object.imagePullPolicy) : '', + securityContext: isSet(object.securityContext) + ? SecurityContext.fromJSON(object.securityContext) + : undefined, + stdin: isSet(object.stdin) ? globalThis.Boolean(object.stdin) : false, + stdinOnce: isSet(object.stdinOnce) ? globalThis.Boolean(object.stdinOnce) : false, + tty: isSet(object.tty) ? globalThis.Boolean(object.tty) : false, + }; + }, + + toJSON(message: Container): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.image !== undefined && message.image !== '') { + obj.image = message.image; + } + if (message.command?.length) { + obj.command = message.command; + } + if (message.args?.length) { + obj.args = message.args; + } + if (message.workingDir !== undefined && message.workingDir !== '') { + obj.workingDir = message.workingDir; + } + if (message.ports?.length) { + obj.ports = message.ports.map((e) => ContainerPort.toJSON(e)); + } + if (message.envFrom?.length) { + obj.envFrom = message.envFrom.map((e) => EnvFromSource.toJSON(e)); + } + if (message.env?.length) { + obj.env = message.env.map((e) => EnvVar.toJSON(e)); + } + if (message.resources !== undefined) { + obj.resources = ResourceRequirements.toJSON(message.resources); + } + if (message.resizePolicy?.length) { + obj.resizePolicy = message.resizePolicy.map((e) => ContainerResizePolicy.toJSON(e)); + } + if (message.restartPolicy !== undefined && message.restartPolicy !== '') { + obj.restartPolicy = message.restartPolicy; + } + if (message.restartPolicyRules?.length) { + obj.restartPolicyRules = message.restartPolicyRules.map((e) => ContainerRestartRule.toJSON(e)); + } + if (message.volumeMounts?.length) { + obj.volumeMounts = message.volumeMounts.map((e) => VolumeMount.toJSON(e)); + } + if (message.volumeDevices?.length) { + obj.volumeDevices = message.volumeDevices.map((e) => VolumeDevice.toJSON(e)); + } + if (message.livenessProbe !== undefined) { + obj.livenessProbe = Probe.toJSON(message.livenessProbe); + } + if (message.readinessProbe !== undefined) { + obj.readinessProbe = Probe.toJSON(message.readinessProbe); + } + if (message.startupProbe !== undefined) { + obj.startupProbe = Probe.toJSON(message.startupProbe); + } + if (message.lifecycle !== undefined) { + obj.lifecycle = Lifecycle.toJSON(message.lifecycle); + } + if (message.terminationMessagePath !== undefined && message.terminationMessagePath !== '') { + obj.terminationMessagePath = message.terminationMessagePath; + } + if (message.terminationMessagePolicy !== undefined && message.terminationMessagePolicy !== '') { + obj.terminationMessagePolicy = message.terminationMessagePolicy; + } + if (message.imagePullPolicy !== undefined && message.imagePullPolicy !== '') { + obj.imagePullPolicy = message.imagePullPolicy; + } + if (message.securityContext !== undefined) { + obj.securityContext = SecurityContext.toJSON(message.securityContext); + } + if (message.stdin !== undefined && message.stdin !== false) { + obj.stdin = message.stdin; + } + if (message.stdinOnce !== undefined && message.stdinOnce !== false) { + obj.stdinOnce = message.stdinOnce; + } + if (message.tty !== undefined && message.tty !== false) { + obj.tty = message.tty; + } + return obj; + }, + + create, I>>(base?: I): Container { + return Container.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Container { + const message = createBaseContainer(); + message.name = object.name ?? ''; + message.image = object.image ?? ''; + message.command = object.command?.map((e) => e) || []; + message.args = object.args?.map((e) => e) || []; + message.workingDir = object.workingDir ?? ''; + message.ports = object.ports?.map((e) => ContainerPort.fromPartial(e)) || []; + message.envFrom = object.envFrom?.map((e) => EnvFromSource.fromPartial(e)) || []; + message.env = object.env?.map((e) => EnvVar.fromPartial(e)) || []; + message.resources = + object.resources !== undefined && object.resources !== null + ? ResourceRequirements.fromPartial(object.resources) + : undefined; + message.resizePolicy = object.resizePolicy?.map((e) => ContainerResizePolicy.fromPartial(e)) || []; + message.restartPolicy = object.restartPolicy ?? ''; + message.restartPolicyRules = + object.restartPolicyRules?.map((e) => ContainerRestartRule.fromPartial(e)) || []; + message.volumeMounts = object.volumeMounts?.map((e) => VolumeMount.fromPartial(e)) || []; + message.volumeDevices = object.volumeDevices?.map((e) => VolumeDevice.fromPartial(e)) || []; + message.livenessProbe = + object.livenessProbe !== undefined && object.livenessProbe !== null + ? Probe.fromPartial(object.livenessProbe) + : undefined; + message.readinessProbe = + object.readinessProbe !== undefined && object.readinessProbe !== null + ? Probe.fromPartial(object.readinessProbe) + : undefined; + message.startupProbe = + object.startupProbe !== undefined && object.startupProbe !== null + ? Probe.fromPartial(object.startupProbe) + : undefined; + message.lifecycle = + object.lifecycle !== undefined && object.lifecycle !== null + ? Lifecycle.fromPartial(object.lifecycle) + : undefined; + message.terminationMessagePath = object.terminationMessagePath ?? ''; + message.terminationMessagePolicy = object.terminationMessagePolicy ?? ''; + message.imagePullPolicy = object.imagePullPolicy ?? ''; + message.securityContext = + object.securityContext !== undefined && object.securityContext !== null + ? SecurityContext.fromPartial(object.securityContext) + : undefined; + message.stdin = object.stdin ?? false; + message.stdinOnce = object.stdinOnce ?? false; + message.tty = object.tty ?? false; + return message; + }, +}; + +function createBaseContainerExtendedResourceRequest(): ContainerExtendedResourceRequest { + return { containerName: '', resourceName: '', requestName: '' }; +} + +export const ContainerExtendedResourceRequest: MessageFns = { + encode( + message: ContainerExtendedResourceRequest, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.containerName !== undefined && message.containerName !== '') { + writer.uint32(10).string(message.containerName); + } + if (message.resourceName !== undefined && message.resourceName !== '') { + writer.uint32(18).string(message.resourceName); + } + if (message.requestName !== undefined && message.requestName !== '') { + writer.uint32(26).string(message.requestName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerExtendedResourceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerExtendedResourceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.containerName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resourceName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.requestName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerExtendedResourceRequest { + return { + containerName: isSet(object.containerName) ? globalThis.String(object.containerName) : '', + resourceName: isSet(object.resourceName) ? globalThis.String(object.resourceName) : '', + requestName: isSet(object.requestName) ? globalThis.String(object.requestName) : '', + }; + }, + + toJSON(message: ContainerExtendedResourceRequest): unknown { + const obj: any = {}; + if (message.containerName !== undefined && message.containerName !== '') { + obj.containerName = message.containerName; + } + if (message.resourceName !== undefined && message.resourceName !== '') { + obj.resourceName = message.resourceName; + } + if (message.requestName !== undefined && message.requestName !== '') { + obj.requestName = message.requestName; + } + return obj; + }, + + create, I>>( + base?: I, + ): ContainerExtendedResourceRequest { + return ContainerExtendedResourceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ContainerExtendedResourceRequest { + const message = createBaseContainerExtendedResourceRequest(); + message.containerName = object.containerName ?? ''; + message.resourceName = object.resourceName ?? ''; + message.requestName = object.requestName ?? ''; + return message; + }, +}; + +function createBaseContainerImage(): ContainerImage { + return { names: [], sizeBytes: 0 }; +} + +export const ContainerImage: MessageFns = { + encode(message: ContainerImage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.names) { + writer.uint32(10).string(v!); + } + if (message.sizeBytes !== undefined && message.sizeBytes !== 0) { + writer.uint32(16).int64(message.sizeBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerImage { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerImage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.names.push(reader.string()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.sizeBytes = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerImage { + return { + names: globalThis.Array.isArray(object?.names) + ? object.names.map((e: any) => globalThis.String(e)) + : [], + sizeBytes: isSet(object.sizeBytes) ? globalThis.Number(object.sizeBytes) : 0, + }; + }, + + toJSON(message: ContainerImage): unknown { + const obj: any = {}; + if (message.names?.length) { + obj.names = message.names; + } + if (message.sizeBytes !== undefined && message.sizeBytes !== 0) { + obj.sizeBytes = Math.round(message.sizeBytes); + } + return obj; + }, + + create, I>>(base?: I): ContainerImage { + return ContainerImage.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContainerImage { + const message = createBaseContainerImage(); + message.names = object.names?.map((e) => e) || []; + message.sizeBytes = object.sizeBytes ?? 0; + return message; + }, +}; + +function createBaseContainerPort(): ContainerPort { + return { name: '', hostPort: 0, containerPort: 0, protocol: '', hostIP: '' }; +} + +export const ContainerPort: MessageFns = { + encode(message: ContainerPort, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.hostPort !== undefined && message.hostPort !== 0) { + writer.uint32(16).int32(message.hostPort); + } + if (message.containerPort !== undefined && message.containerPort !== 0) { + writer.uint32(24).int32(message.containerPort); + } + if (message.protocol !== undefined && message.protocol !== '') { + writer.uint32(34).string(message.protocol); + } + if (message.hostIP !== undefined && message.hostIP !== '') { + writer.uint32(42).string(message.hostIP); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerPort { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerPort(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.hostPort = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.containerPort = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.protocol = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.hostIP = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerPort { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + hostPort: isSet(object.hostPort) ? globalThis.Number(object.hostPort) : 0, + containerPort: isSet(object.containerPort) ? globalThis.Number(object.containerPort) : 0, + protocol: isSet(object.protocol) ? globalThis.String(object.protocol) : '', + hostIP: isSet(object.hostIP) ? globalThis.String(object.hostIP) : '', + }; + }, + + toJSON(message: ContainerPort): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.hostPort !== undefined && message.hostPort !== 0) { + obj.hostPort = Math.round(message.hostPort); + } + if (message.containerPort !== undefined && message.containerPort !== 0) { + obj.containerPort = Math.round(message.containerPort); + } + if (message.protocol !== undefined && message.protocol !== '') { + obj.protocol = message.protocol; + } + if (message.hostIP !== undefined && message.hostIP !== '') { + obj.hostIP = message.hostIP; + } + return obj; + }, + + create, I>>(base?: I): ContainerPort { + return ContainerPort.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContainerPort { + const message = createBaseContainerPort(); + message.name = object.name ?? ''; + message.hostPort = object.hostPort ?? 0; + message.containerPort = object.containerPort ?? 0; + message.protocol = object.protocol ?? ''; + message.hostIP = object.hostIP ?? ''; + return message; + }, +}; + +function createBaseContainerResizePolicy(): ContainerResizePolicy { + return { resourceName: '', restartPolicy: '' }; +} + +export const ContainerResizePolicy: MessageFns = { + encode(message: ContainerResizePolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.resourceName !== undefined && message.resourceName !== '') { + writer.uint32(10).string(message.resourceName); + } + if (message.restartPolicy !== undefined && message.restartPolicy !== '') { + writer.uint32(18).string(message.restartPolicy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerResizePolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerResizePolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resourceName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.restartPolicy = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerResizePolicy { + return { + resourceName: isSet(object.resourceName) ? globalThis.String(object.resourceName) : '', + restartPolicy: isSet(object.restartPolicy) ? globalThis.String(object.restartPolicy) : '', + }; + }, + + toJSON(message: ContainerResizePolicy): unknown { + const obj: any = {}; + if (message.resourceName !== undefined && message.resourceName !== '') { + obj.resourceName = message.resourceName; + } + if (message.restartPolicy !== undefined && message.restartPolicy !== '') { + obj.restartPolicy = message.restartPolicy; + } + return obj; + }, + + create, I>>(base?: I): ContainerResizePolicy { + return ContainerResizePolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContainerResizePolicy { + const message = createBaseContainerResizePolicy(); + message.resourceName = object.resourceName ?? ''; + message.restartPolicy = object.restartPolicy ?? ''; + return message; + }, +}; + +function createBaseContainerRestartRule(): ContainerRestartRule { + return { action: '', exitCodes: undefined }; +} + +export const ContainerRestartRule: MessageFns = { + encode(message: ContainerRestartRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.action !== undefined && message.action !== '') { + writer.uint32(10).string(message.action); + } + if (message.exitCodes !== undefined) { + ContainerRestartRuleOnExitCodes.encode(message.exitCodes, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerRestartRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerRestartRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.action = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.exitCodes = ContainerRestartRuleOnExitCodes.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerRestartRule { + return { + action: isSet(object.action) ? globalThis.String(object.action) : '', + exitCodes: isSet(object.exitCodes) + ? ContainerRestartRuleOnExitCodes.fromJSON(object.exitCodes) + : undefined, + }; + }, + + toJSON(message: ContainerRestartRule): unknown { + const obj: any = {}; + if (message.action !== undefined && message.action !== '') { + obj.action = message.action; + } + if (message.exitCodes !== undefined) { + obj.exitCodes = ContainerRestartRuleOnExitCodes.toJSON(message.exitCodes); + } + return obj; + }, + + create, I>>(base?: I): ContainerRestartRule { + return ContainerRestartRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContainerRestartRule { + const message = createBaseContainerRestartRule(); + message.action = object.action ?? ''; + message.exitCodes = + object.exitCodes !== undefined && object.exitCodes !== null + ? ContainerRestartRuleOnExitCodes.fromPartial(object.exitCodes) + : undefined; + return message; + }, +}; + +function createBaseContainerRestartRuleOnExitCodes(): ContainerRestartRuleOnExitCodes { + return { operator: '', values: [] }; +} + +export const ContainerRestartRuleOnExitCodes: MessageFns = { + encode( + message: ContainerRestartRuleOnExitCodes, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.operator !== undefined && message.operator !== '') { + writer.uint32(10).string(message.operator); + } + for (const v of message.values) { + writer.uint32(16).int32(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerRestartRuleOnExitCodes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerRestartRuleOnExitCodes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.operator = reader.string(); + continue; + } + case 2: { + if (tag === 16) { + message.values.push(reader.int32()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.values.push(reader.int32()); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerRestartRuleOnExitCodes { + return { + operator: isSet(object.operator) ? globalThis.String(object.operator) : '', + values: globalThis.Array.isArray(object?.values) + ? object.values.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: ContainerRestartRuleOnExitCodes): unknown { + const obj: any = {}; + if (message.operator !== undefined && message.operator !== '') { + obj.operator = message.operator; + } + if (message.values?.length) { + obj.values = message.values.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ContainerRestartRuleOnExitCodes { + return ContainerRestartRuleOnExitCodes.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ContainerRestartRuleOnExitCodes { + const message = createBaseContainerRestartRuleOnExitCodes(); + message.operator = object.operator ?? ''; + message.values = object.values?.map((e) => e) || []; + return message; + }, +}; + +function createBaseContainerState(): ContainerState { + return { waiting: undefined, running: undefined, terminated: undefined }; +} + +export const ContainerState: MessageFns = { + encode(message: ContainerState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.waiting !== undefined) { + ContainerStateWaiting.encode(message.waiting, writer.uint32(10).fork()).join(); + } + if (message.running !== undefined) { + ContainerStateRunning.encode(message.running, writer.uint32(18).fork()).join(); + } + if (message.terminated !== undefined) { + ContainerStateTerminated.encode(message.terminated, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.waiting = ContainerStateWaiting.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.running = ContainerStateRunning.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.terminated = ContainerStateTerminated.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerState { + return { + waiting: isSet(object.waiting) ? ContainerStateWaiting.fromJSON(object.waiting) : undefined, + running: isSet(object.running) ? ContainerStateRunning.fromJSON(object.running) : undefined, + terminated: isSet(object.terminated) + ? ContainerStateTerminated.fromJSON(object.terminated) + : undefined, + }; + }, + + toJSON(message: ContainerState): unknown { + const obj: any = {}; + if (message.waiting !== undefined) { + obj.waiting = ContainerStateWaiting.toJSON(message.waiting); + } + if (message.running !== undefined) { + obj.running = ContainerStateRunning.toJSON(message.running); + } + if (message.terminated !== undefined) { + obj.terminated = ContainerStateTerminated.toJSON(message.terminated); + } + return obj; + }, + + create, I>>(base?: I): ContainerState { + return ContainerState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContainerState { + const message = createBaseContainerState(); + message.waiting = + object.waiting !== undefined && object.waiting !== null + ? ContainerStateWaiting.fromPartial(object.waiting) + : undefined; + message.running = + object.running !== undefined && object.running !== null + ? ContainerStateRunning.fromPartial(object.running) + : undefined; + message.terminated = + object.terminated !== undefined && object.terminated !== null + ? ContainerStateTerminated.fromPartial(object.terminated) + : undefined; + return message; + }, +}; + +function createBaseContainerStateRunning(): ContainerStateRunning { + return { startedAt: undefined }; +} + +export const ContainerStateRunning: MessageFns = { + encode(message: ContainerStateRunning, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.startedAt !== undefined) { + Time.encode(message.startedAt, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerStateRunning { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerStateRunning(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.startedAt = Time.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerStateRunning { + return { startedAt: isSet(object.startedAt) ? Time.fromJSON(object.startedAt) : undefined }; + }, + + toJSON(message: ContainerStateRunning): unknown { + const obj: any = {}; + if (message.startedAt !== undefined) { + obj.startedAt = Time.toJSON(message.startedAt); + } + return obj; + }, + + create, I>>(base?: I): ContainerStateRunning { + return ContainerStateRunning.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContainerStateRunning { + const message = createBaseContainerStateRunning(); + message.startedAt = + object.startedAt !== undefined && object.startedAt !== null + ? Time.fromPartial(object.startedAt) + : undefined; + return message; + }, +}; + +function createBaseContainerStateTerminated(): ContainerStateTerminated { + return { + exitCode: 0, + signal: 0, + reason: '', + message: '', + startedAt: undefined, + finishedAt: undefined, + containerID: '', + }; +} + +export const ContainerStateTerminated: MessageFns = { + encode(message: ContainerStateTerminated, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exitCode !== undefined && message.exitCode !== 0) { + writer.uint32(8).int32(message.exitCode); + } + if (message.signal !== undefined && message.signal !== 0) { + writer.uint32(16).int32(message.signal); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(26).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(34).string(message.message); + } + if (message.startedAt !== undefined) { + Time.encode(message.startedAt, writer.uint32(42).fork()).join(); + } + if (message.finishedAt !== undefined) { + Time.encode(message.finishedAt, writer.uint32(50).fork()).join(); + } + if (message.containerID !== undefined && message.containerID !== '') { + writer.uint32(58).string(message.containerID); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerStateTerminated { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerStateTerminated(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.exitCode = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.signal = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.reason = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.message = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.startedAt = Time.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.finishedAt = Time.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.containerID = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerStateTerminated { + return { + exitCode: isSet(object.exitCode) ? globalThis.Number(object.exitCode) : 0, + signal: isSet(object.signal) ? globalThis.Number(object.signal) : 0, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + startedAt: isSet(object.startedAt) ? Time.fromJSON(object.startedAt) : undefined, + finishedAt: isSet(object.finishedAt) ? Time.fromJSON(object.finishedAt) : undefined, + containerID: isSet(object.containerID) ? globalThis.String(object.containerID) : '', + }; + }, + + toJSON(message: ContainerStateTerminated): unknown { + const obj: any = {}; + if (message.exitCode !== undefined && message.exitCode !== 0) { + obj.exitCode = Math.round(message.exitCode); + } + if (message.signal !== undefined && message.signal !== 0) { + obj.signal = Math.round(message.signal); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + if (message.startedAt !== undefined) { + obj.startedAt = Time.toJSON(message.startedAt); + } + if (message.finishedAt !== undefined) { + obj.finishedAt = Time.toJSON(message.finishedAt); + } + if (message.containerID !== undefined && message.containerID !== '') { + obj.containerID = message.containerID; + } + return obj; + }, + + create, I>>(base?: I): ContainerStateTerminated { + return ContainerStateTerminated.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ContainerStateTerminated { + const message = createBaseContainerStateTerminated(); + message.exitCode = object.exitCode ?? 0; + message.signal = object.signal ?? 0; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + message.startedAt = + object.startedAt !== undefined && object.startedAt !== null + ? Time.fromPartial(object.startedAt) + : undefined; + message.finishedAt = + object.finishedAt !== undefined && object.finishedAt !== null + ? Time.fromPartial(object.finishedAt) + : undefined; + message.containerID = object.containerID ?? ''; + return message; + }, +}; + +function createBaseContainerStateWaiting(): ContainerStateWaiting { + return { reason: '', message: '' }; +} + +export const ContainerStateWaiting: MessageFns = { + encode(message: ContainerStateWaiting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(10).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(18).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerStateWaiting { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerStateWaiting(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.reason = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerStateWaiting { + return { + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: ContainerStateWaiting): unknown { + const obj: any = {}; + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): ContainerStateWaiting { + return ContainerStateWaiting.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContainerStateWaiting { + const message = createBaseContainerStateWaiting(); + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseContainerStatus(): ContainerStatus { + return { + name: '', + state: undefined, + lastState: undefined, + ready: false, + restartCount: 0, + image: '', + imageID: '', + containerID: '', + started: false, + allocatedResources: {}, + resources: undefined, + volumeMounts: [], + user: undefined, + allocatedResourcesStatus: [], + stopSignal: '', + }; +} + +export const ContainerStatus: MessageFns = { + encode(message: ContainerStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.state !== undefined) { + ContainerState.encode(message.state, writer.uint32(18).fork()).join(); + } + if (message.lastState !== undefined) { + ContainerState.encode(message.lastState, writer.uint32(26).fork()).join(); + } + if (message.ready !== undefined && message.ready !== false) { + writer.uint32(32).bool(message.ready); + } + if (message.restartCount !== undefined && message.restartCount !== 0) { + writer.uint32(40).int32(message.restartCount); + } + if (message.image !== undefined && message.image !== '') { + writer.uint32(50).string(message.image); + } + if (message.imageID !== undefined && message.imageID !== '') { + writer.uint32(58).string(message.imageID); + } + if (message.containerID !== undefined && message.containerID !== '') { + writer.uint32(66).string(message.containerID); + } + if (message.started !== undefined && message.started !== false) { + writer.uint32(72).bool(message.started); + } + globalThis.Object.entries(message.allocatedResources).forEach(([key, value]: [string, Quantity]) => { + ContainerStatus_AllocatedResourcesEntry.encode( + { key: key as any, value }, + writer.uint32(82).fork(), + ).join(); + }); + if (message.resources !== undefined) { + ResourceRequirements.encode(message.resources, writer.uint32(90).fork()).join(); + } + for (const v of message.volumeMounts) { + VolumeMountStatus.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.user !== undefined) { + ContainerUser.encode(message.user, writer.uint32(106).fork()).join(); + } + for (const v of message.allocatedResourcesStatus) { + ResourceStatus.encode(v!, writer.uint32(114).fork()).join(); + } + if (message.stopSignal !== undefined && message.stopSignal !== '') { + writer.uint32(122).string(message.stopSignal); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.state = ContainerState.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastState = ContainerState.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.ready = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.restartCount = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.image = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.imageID = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.containerID = reader.string(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.started = reader.bool(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + const entry10 = ContainerStatus_AllocatedResourcesEntry.decode( + reader, + reader.uint32(), + ); + if (entry10.value !== undefined) { + message.allocatedResources[entry10.key] = entry10.value; + } + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.resources = ResourceRequirements.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.volumeMounts.push(VolumeMountStatus.decode(reader, reader.uint32())); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.user = ContainerUser.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.allocatedResourcesStatus.push(ResourceStatus.decode(reader, reader.uint32())); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.stopSignal = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerStatus { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + state: isSet(object.state) ? ContainerState.fromJSON(object.state) : undefined, + lastState: isSet(object.lastState) ? ContainerState.fromJSON(object.lastState) : undefined, + ready: isSet(object.ready) ? globalThis.Boolean(object.ready) : false, + restartCount: isSet(object.restartCount) ? globalThis.Number(object.restartCount) : 0, + image: isSet(object.image) ? globalThis.String(object.image) : '', + imageID: isSet(object.imageID) ? globalThis.String(object.imageID) : '', + containerID: isSet(object.containerID) ? globalThis.String(object.containerID) : '', + started: isSet(object.started) ? globalThis.Boolean(object.started) : false, + allocatedResources: isObject(object.allocatedResources) + ? (globalThis.Object.entries(object.allocatedResources) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + resources: isSet(object.resources) ? ResourceRequirements.fromJSON(object.resources) : undefined, + volumeMounts: globalThis.Array.isArray(object?.volumeMounts) + ? object.volumeMounts.map((e: any) => VolumeMountStatus.fromJSON(e)) + : [], + user: isSet(object.user) ? ContainerUser.fromJSON(object.user) : undefined, + allocatedResourcesStatus: globalThis.Array.isArray(object?.allocatedResourcesStatus) + ? object.allocatedResourcesStatus.map((e: any) => ResourceStatus.fromJSON(e)) + : [], + stopSignal: isSet(object.stopSignal) ? globalThis.String(object.stopSignal) : '', + }; + }, + + toJSON(message: ContainerStatus): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.state !== undefined) { + obj.state = ContainerState.toJSON(message.state); + } + if (message.lastState !== undefined) { + obj.lastState = ContainerState.toJSON(message.lastState); + } + if (message.ready !== undefined && message.ready !== false) { + obj.ready = message.ready; + } + if (message.restartCount !== undefined && message.restartCount !== 0) { + obj.restartCount = Math.round(message.restartCount); + } + if (message.image !== undefined && message.image !== '') { + obj.image = message.image; + } + if (message.imageID !== undefined && message.imageID !== '') { + obj.imageID = message.imageID; + } + if (message.containerID !== undefined && message.containerID !== '') { + obj.containerID = message.containerID; + } + if (message.started !== undefined && message.started !== false) { + obj.started = message.started; + } + if (message.allocatedResources) { + const entries = globalThis.Object.entries(message.allocatedResources) as [string, Quantity][]; + if (entries.length > 0) { + obj.allocatedResources = {}; + entries.forEach(([k, v]) => { + obj.allocatedResources[k] = Quantity.toJSON(v); + }); + } + } + if (message.resources !== undefined) { + obj.resources = ResourceRequirements.toJSON(message.resources); + } + if (message.volumeMounts?.length) { + obj.volumeMounts = message.volumeMounts.map((e) => VolumeMountStatus.toJSON(e)); + } + if (message.user !== undefined) { + obj.user = ContainerUser.toJSON(message.user); + } + if (message.allocatedResourcesStatus?.length) { + obj.allocatedResourcesStatus = message.allocatedResourcesStatus.map((e) => + ResourceStatus.toJSON(e), + ); + } + if (message.stopSignal !== undefined && message.stopSignal !== '') { + obj.stopSignal = message.stopSignal; + } + return obj; + }, + + create, I>>(base?: I): ContainerStatus { + return ContainerStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContainerStatus { + const message = createBaseContainerStatus(); + message.name = object.name ?? ''; + message.state = + object.state !== undefined && object.state !== null + ? ContainerState.fromPartial(object.state) + : undefined; + message.lastState = + object.lastState !== undefined && object.lastState !== null + ? ContainerState.fromPartial(object.lastState) + : undefined; + message.ready = object.ready ?? false; + message.restartCount = object.restartCount ?? 0; + message.image = object.image ?? ''; + message.imageID = object.imageID ?? ''; + message.containerID = object.containerID ?? ''; + message.started = object.started ?? false; + message.allocatedResources = ( + globalThis.Object.entries(object.allocatedResources ?? {}) as [string, Quantity][] + ).reduce((acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, {}); + message.resources = + object.resources !== undefined && object.resources !== null + ? ResourceRequirements.fromPartial(object.resources) + : undefined; + message.volumeMounts = object.volumeMounts?.map((e) => VolumeMountStatus.fromPartial(e)) || []; + message.user = + object.user !== undefined && object.user !== null + ? ContainerUser.fromPartial(object.user) + : undefined; + message.allocatedResourcesStatus = + object.allocatedResourcesStatus?.map((e) => ResourceStatus.fromPartial(e)) || []; + message.stopSignal = object.stopSignal ?? ''; + return message; + }, +}; + +function createBaseContainerStatus_AllocatedResourcesEntry(): ContainerStatus_AllocatedResourcesEntry { + return { key: '', value: undefined }; +} + +export const ContainerStatus_AllocatedResourcesEntry: MessageFns = { + encode( + message: ContainerStatus_AllocatedResourcesEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerStatus_AllocatedResourcesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerStatus_AllocatedResourcesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerStatus_AllocatedResourcesEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ContainerStatus_AllocatedResourcesEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ContainerStatus_AllocatedResourcesEntry { + return ContainerStatus_AllocatedResourcesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ContainerStatus_AllocatedResourcesEntry { + const message = createBaseContainerStatus_AllocatedResourcesEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseContainerUser(): ContainerUser { + return { linux: undefined }; +} + +export const ContainerUser: MessageFns = { + encode(message: ContainerUser, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.linux !== undefined) { + LinuxContainerUser.encode(message.linux, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContainerUser { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContainerUser(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.linux = LinuxContainerUser.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ContainerUser { + return { linux: isSet(object.linux) ? LinuxContainerUser.fromJSON(object.linux) : undefined }; + }, + + toJSON(message: ContainerUser): unknown { + const obj: any = {}; + if (message.linux !== undefined) { + obj.linux = LinuxContainerUser.toJSON(message.linux); + } + return obj; + }, + + create, I>>(base?: I): ContainerUser { + return ContainerUser.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContainerUser { + const message = createBaseContainerUser(); + message.linux = + object.linux !== undefined && object.linux !== null + ? LinuxContainerUser.fromPartial(object.linux) + : undefined; + return message; + }, +}; + +function createBaseDaemonEndpoint(): DaemonEndpoint { + return { Port: 0 }; +} + +export const DaemonEndpoint: MessageFns = { + encode(message: DaemonEndpoint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.Port !== undefined && message.Port !== 0) { + writer.uint32(8).int32(message.Port); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonEndpoint { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonEndpoint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.Port = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonEndpoint { + return { Port: isSet(object.Port) ? globalThis.Number(object.Port) : 0 }; + }, + + toJSON(message: DaemonEndpoint): unknown { + const obj: any = {}; + if (message.Port !== undefined && message.Port !== 0) { + obj.Port = Math.round(message.Port); + } + return obj; + }, + + create, I>>(base?: I): DaemonEndpoint { + return DaemonEndpoint.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DaemonEndpoint { + const message = createBaseDaemonEndpoint(); + message.Port = object.Port ?? 0; + return message; + }, +}; + +function createBaseDownwardAPIProjection(): DownwardAPIProjection { + return { items: [] }; +} + +export const DownwardAPIProjection: MessageFns = { + encode(message: DownwardAPIProjection, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.items) { + DownwardAPIVolumeFile.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DownwardAPIProjection { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDownwardAPIProjection(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.items.push(DownwardAPIVolumeFile.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DownwardAPIProjection { + return { + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => DownwardAPIVolumeFile.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DownwardAPIProjection): unknown { + const obj: any = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => DownwardAPIVolumeFile.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DownwardAPIProjection { + return DownwardAPIProjection.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DownwardAPIProjection { + const message = createBaseDownwardAPIProjection(); + message.items = object.items?.map((e) => DownwardAPIVolumeFile.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDownwardAPIVolumeFile(): DownwardAPIVolumeFile { + return { path: '', fieldRef: undefined, resourceFieldRef: undefined, mode: 0, user: 0 }; +} + +export const DownwardAPIVolumeFile: MessageFns = { + encode(message: DownwardAPIVolumeFile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined && message.path !== '') { + writer.uint32(10).string(message.path); + } + if (message.fieldRef !== undefined) { + ObjectFieldSelector.encode(message.fieldRef, writer.uint32(18).fork()).join(); + } + if (message.resourceFieldRef !== undefined) { + ResourceFieldSelector.encode(message.resourceFieldRef, writer.uint32(26).fork()).join(); + } + if (message.mode !== undefined && message.mode !== 0) { + writer.uint32(32).int32(message.mode); + } + if (message.user !== undefined && message.user !== 0) { + writer.uint32(40).int64(message.user); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DownwardAPIVolumeFile { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDownwardAPIVolumeFile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fieldRef = ObjectFieldSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.resourceFieldRef = ResourceFieldSelector.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.mode = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.user = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DownwardAPIVolumeFile { + return { + path: isSet(object.path) ? globalThis.String(object.path) : '', + fieldRef: isSet(object.fieldRef) ? ObjectFieldSelector.fromJSON(object.fieldRef) : undefined, + resourceFieldRef: isSet(object.resourceFieldRef) + ? ResourceFieldSelector.fromJSON(object.resourceFieldRef) + : undefined, + mode: isSet(object.mode) ? globalThis.Number(object.mode) : 0, + user: isSet(object.user) ? globalThis.Number(object.user) : 0, + }; + }, + + toJSON(message: DownwardAPIVolumeFile): unknown { + const obj: any = {}; + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.fieldRef !== undefined) { + obj.fieldRef = ObjectFieldSelector.toJSON(message.fieldRef); + } + if (message.resourceFieldRef !== undefined) { + obj.resourceFieldRef = ResourceFieldSelector.toJSON(message.resourceFieldRef); + } + if (message.mode !== undefined && message.mode !== 0) { + obj.mode = Math.round(message.mode); + } + if (message.user !== undefined && message.user !== 0) { + obj.user = Math.round(message.user); + } + return obj; + }, + + create, I>>(base?: I): DownwardAPIVolumeFile { + return DownwardAPIVolumeFile.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DownwardAPIVolumeFile { + const message = createBaseDownwardAPIVolumeFile(); + message.path = object.path ?? ''; + message.fieldRef = + object.fieldRef !== undefined && object.fieldRef !== null + ? ObjectFieldSelector.fromPartial(object.fieldRef) + : undefined; + message.resourceFieldRef = + object.resourceFieldRef !== undefined && object.resourceFieldRef !== null + ? ResourceFieldSelector.fromPartial(object.resourceFieldRef) + : undefined; + message.mode = object.mode ?? 0; + message.user = object.user ?? 0; + return message; + }, +}; + +function createBaseDownwardAPIVolumeSource(): DownwardAPIVolumeSource { + return { items: [], defaultMode: 0, defaultUser: 0 }; +} + +export const DownwardAPIVolumeSource: MessageFns = { + encode(message: DownwardAPIVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.items) { + DownwardAPIVolumeFile.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.defaultMode !== undefined && message.defaultMode !== 0) { + writer.uint32(16).int32(message.defaultMode); + } + if (message.defaultUser !== undefined && message.defaultUser !== 0) { + writer.uint32(24).int64(message.defaultUser); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DownwardAPIVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDownwardAPIVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.items.push(DownwardAPIVolumeFile.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.defaultMode = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.defaultUser = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DownwardAPIVolumeSource { + return { + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => DownwardAPIVolumeFile.fromJSON(e)) + : [], + defaultMode: isSet(object.defaultMode) ? globalThis.Number(object.defaultMode) : 0, + defaultUser: isSet(object.defaultUser) ? globalThis.Number(object.defaultUser) : 0, + }; + }, + + toJSON(message: DownwardAPIVolumeSource): unknown { + const obj: any = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => DownwardAPIVolumeFile.toJSON(e)); + } + if (message.defaultMode !== undefined && message.defaultMode !== 0) { + obj.defaultMode = Math.round(message.defaultMode); + } + if (message.defaultUser !== undefined && message.defaultUser !== 0) { + obj.defaultUser = Math.round(message.defaultUser); + } + return obj; + }, + + create, I>>(base?: I): DownwardAPIVolumeSource { + return DownwardAPIVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): DownwardAPIVolumeSource { + const message = createBaseDownwardAPIVolumeSource(); + message.items = object.items?.map((e) => DownwardAPIVolumeFile.fromPartial(e)) || []; + message.defaultMode = object.defaultMode ?? 0; + message.defaultUser = object.defaultUser ?? 0; + return message; + }, +}; + +function createBaseEmptyDirVolumeSource(): EmptyDirVolumeSource { + return { medium: '', sizeLimit: undefined, mode: 0 }; +} + +export const EmptyDirVolumeSource: MessageFns = { + encode(message: EmptyDirVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.medium !== undefined && message.medium !== '') { + writer.uint32(10).string(message.medium); + } + if (message.sizeLimit !== undefined) { + Quantity.encode(message.sizeLimit, writer.uint32(18).fork()).join(); + } + if (message.mode !== undefined && message.mode !== 0) { + writer.uint32(24).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EmptyDirVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmptyDirVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.medium = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.sizeLimit = Quantity.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.mode = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EmptyDirVolumeSource { + return { + medium: isSet(object.medium) ? globalThis.String(object.medium) : '', + sizeLimit: isSet(object.sizeLimit) ? Quantity.fromJSON(object.sizeLimit) : undefined, + mode: isSet(object.mode) ? globalThis.Number(object.mode) : 0, + }; + }, + + toJSON(message: EmptyDirVolumeSource): unknown { + const obj: any = {}; + if (message.medium !== undefined && message.medium !== '') { + obj.medium = message.medium; + } + if (message.sizeLimit !== undefined) { + obj.sizeLimit = Quantity.toJSON(message.sizeLimit); + } + if (message.mode !== undefined && message.mode !== 0) { + obj.mode = Math.round(message.mode); + } + return obj; + }, + + create, I>>(base?: I): EmptyDirVolumeSource { + return EmptyDirVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EmptyDirVolumeSource { + const message = createBaseEmptyDirVolumeSource(); + message.medium = object.medium ?? ''; + message.sizeLimit = + object.sizeLimit !== undefined && object.sizeLimit !== null + ? Quantity.fromPartial(object.sizeLimit) + : undefined; + message.mode = object.mode ?? 0; + return message; + }, +}; + +function createBaseEndpointAddress(): EndpointAddress { + return { ip: '', hostname: '', nodeName: '', targetRef: undefined }; +} + +export const EndpointAddress: MessageFns = { + encode(message: EndpointAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ip !== undefined && message.ip !== '') { + writer.uint32(10).string(message.ip); + } + if (message.hostname !== undefined && message.hostname !== '') { + writer.uint32(26).string(message.hostname); + } + if (message.nodeName !== undefined && message.nodeName !== '') { + writer.uint32(34).string(message.nodeName); + } + if (message.targetRef !== undefined) { + ObjectReference.encode(message.targetRef, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EndpointAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndpointAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ip = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.hostname = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.nodeName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.targetRef = ObjectReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EndpointAddress { + return { + ip: isSet(object.ip) ? globalThis.String(object.ip) : '', + hostname: isSet(object.hostname) ? globalThis.String(object.hostname) : '', + nodeName: isSet(object.nodeName) ? globalThis.String(object.nodeName) : '', + targetRef: isSet(object.targetRef) ? ObjectReference.fromJSON(object.targetRef) : undefined, + }; + }, + + toJSON(message: EndpointAddress): unknown { + const obj: any = {}; + if (message.ip !== undefined && message.ip !== '') { + obj.ip = message.ip; + } + if (message.hostname !== undefined && message.hostname !== '') { + obj.hostname = message.hostname; + } + if (message.nodeName !== undefined && message.nodeName !== '') { + obj.nodeName = message.nodeName; + } + if (message.targetRef !== undefined) { + obj.targetRef = ObjectReference.toJSON(message.targetRef); + } + return obj; + }, + + create, I>>(base?: I): EndpointAddress { + return EndpointAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EndpointAddress { + const message = createBaseEndpointAddress(); + message.ip = object.ip ?? ''; + message.hostname = object.hostname ?? ''; + message.nodeName = object.nodeName ?? ''; + message.targetRef = + object.targetRef !== undefined && object.targetRef !== null + ? ObjectReference.fromPartial(object.targetRef) + : undefined; + return message; + }, +}; + +function createBaseEndpointPort(): EndpointPort { + return { name: '', port: 0, protocol: '', appProtocol: '' }; +} + +export const EndpointPort: MessageFns = { + encode(message: EndpointPort, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.port !== undefined && message.port !== 0) { + writer.uint32(16).int32(message.port); + } + if (message.protocol !== undefined && message.protocol !== '') { + writer.uint32(26).string(message.protocol); + } + if (message.appProtocol !== undefined && message.appProtocol !== '') { + writer.uint32(34).string(message.appProtocol); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EndpointPort { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndpointPort(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.port = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.protocol = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.appProtocol = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EndpointPort { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + protocol: isSet(object.protocol) ? globalThis.String(object.protocol) : '', + appProtocol: isSet(object.appProtocol) ? globalThis.String(object.appProtocol) : '', + }; + }, + + toJSON(message: EndpointPort): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.port !== undefined && message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.protocol !== undefined && message.protocol !== '') { + obj.protocol = message.protocol; + } + if (message.appProtocol !== undefined && message.appProtocol !== '') { + obj.appProtocol = message.appProtocol; + } + return obj; + }, + + create, I>>(base?: I): EndpointPort { + return EndpointPort.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EndpointPort { + const message = createBaseEndpointPort(); + message.name = object.name ?? ''; + message.port = object.port ?? 0; + message.protocol = object.protocol ?? ''; + message.appProtocol = object.appProtocol ?? ''; + return message; + }, +}; + +function createBaseEndpointSubset(): EndpointSubset { + return { addresses: [], notReadyAddresses: [], ports: [] }; +} + +export const EndpointSubset: MessageFns = { + encode(message: EndpointSubset, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.addresses) { + EndpointAddress.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.notReadyAddresses) { + EndpointAddress.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.ports) { + EndpointPort.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EndpointSubset { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndpointSubset(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.addresses.push(EndpointAddress.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.notReadyAddresses.push(EndpointAddress.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.ports.push(EndpointPort.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EndpointSubset { + return { + addresses: globalThis.Array.isArray(object?.addresses) + ? object.addresses.map((e: any) => EndpointAddress.fromJSON(e)) + : [], + notReadyAddresses: globalThis.Array.isArray(object?.notReadyAddresses) + ? object.notReadyAddresses.map((e: any) => EndpointAddress.fromJSON(e)) + : [], + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => EndpointPort.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EndpointSubset): unknown { + const obj: any = {}; + if (message.addresses?.length) { + obj.addresses = message.addresses.map((e) => EndpointAddress.toJSON(e)); + } + if (message.notReadyAddresses?.length) { + obj.notReadyAddresses = message.notReadyAddresses.map((e) => EndpointAddress.toJSON(e)); + } + if (message.ports?.length) { + obj.ports = message.ports.map((e) => EndpointPort.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EndpointSubset { + return EndpointSubset.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EndpointSubset { + const message = createBaseEndpointSubset(); + message.addresses = object.addresses?.map((e) => EndpointAddress.fromPartial(e)) || []; + message.notReadyAddresses = + object.notReadyAddresses?.map((e) => EndpointAddress.fromPartial(e)) || []; + message.ports = object.ports?.map((e) => EndpointPort.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEndpoints(): Endpoints { + return { metadata: undefined, subsets: [] }; +} + +export const Endpoints: MessageFns = { + encode(message: Endpoints, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.subsets) { + EndpointSubset.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Endpoints { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndpoints(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.subsets.push(EndpointSubset.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Endpoints { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + subsets: globalThis.Array.isArray(object?.subsets) + ? object.subsets.map((e: any) => EndpointSubset.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Endpoints): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.subsets?.length) { + obj.subsets = message.subsets.map((e) => EndpointSubset.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Endpoints { + return Endpoints.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Endpoints { + const message = createBaseEndpoints(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.subsets = object.subsets?.map((e) => EndpointSubset.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEndpointsList(): EndpointsList { + return { metadata: undefined, items: [] }; +} + +export const EndpointsList: MessageFns = { + encode(message: EndpointsList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Endpoints.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EndpointsList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndpointsList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Endpoints.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EndpointsList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Endpoints.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EndpointsList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Endpoints.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EndpointsList { + return EndpointsList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EndpointsList { + const message = createBaseEndpointsList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Endpoints.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnvFromSource(): EnvFromSource { + return { prefix: '', configMapRef: undefined, secretRef: undefined }; +} + +export const EnvFromSource: MessageFns = { + encode(message: EnvFromSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.prefix !== undefined && message.prefix !== '') { + writer.uint32(10).string(message.prefix); + } + if (message.configMapRef !== undefined) { + ConfigMapEnvSource.encode(message.configMapRef, writer.uint32(18).fork()).join(); + } + if (message.secretRef !== undefined) { + SecretEnvSource.encode(message.secretRef, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnvFromSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnvFromSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.prefix = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.configMapRef = ConfigMapEnvSource.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.secretRef = SecretEnvSource.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EnvFromSource { + return { + prefix: isSet(object.prefix) ? globalThis.String(object.prefix) : '', + configMapRef: isSet(object.configMapRef) + ? ConfigMapEnvSource.fromJSON(object.configMapRef) + : undefined, + secretRef: isSet(object.secretRef) ? SecretEnvSource.fromJSON(object.secretRef) : undefined, + }; + }, + + toJSON(message: EnvFromSource): unknown { + const obj: any = {}; + if (message.prefix !== undefined && message.prefix !== '') { + obj.prefix = message.prefix; + } + if (message.configMapRef !== undefined) { + obj.configMapRef = ConfigMapEnvSource.toJSON(message.configMapRef); + } + if (message.secretRef !== undefined) { + obj.secretRef = SecretEnvSource.toJSON(message.secretRef); + } + return obj; + }, + + create, I>>(base?: I): EnvFromSource { + return EnvFromSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnvFromSource { + const message = createBaseEnvFromSource(); + message.prefix = object.prefix ?? ''; + message.configMapRef = + object.configMapRef !== undefined && object.configMapRef !== null + ? ConfigMapEnvSource.fromPartial(object.configMapRef) + : undefined; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? SecretEnvSource.fromPartial(object.secretRef) + : undefined; + return message; + }, +}; + +function createBaseEnvVar(): EnvVar { + return { name: '', value: '', valueFrom: undefined }; +} + +export const EnvVar: MessageFns = { + encode(message: EnvVar, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.value !== undefined && message.value !== '') { + writer.uint32(18).string(message.value); + } + if (message.valueFrom !== undefined) { + EnvVarSource.encode(message.valueFrom, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnvVar { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnvVar(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.valueFrom = EnvVarSource.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EnvVar { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + valueFrom: isSet(object.valueFrom) ? EnvVarSource.fromJSON(object.valueFrom) : undefined, + }; + }, + + toJSON(message: EnvVar): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.value !== undefined && message.value !== '') { + obj.value = message.value; + } + if (message.valueFrom !== undefined) { + obj.valueFrom = EnvVarSource.toJSON(message.valueFrom); + } + return obj; + }, + + create, I>>(base?: I): EnvVar { + return EnvVar.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnvVar { + const message = createBaseEnvVar(); + message.name = object.name ?? ''; + message.value = object.value ?? ''; + message.valueFrom = + object.valueFrom !== undefined && object.valueFrom !== null + ? EnvVarSource.fromPartial(object.valueFrom) + : undefined; + return message; + }, +}; + +function createBaseEnvVarSource(): EnvVarSource { + return { + fieldRef: undefined, + resourceFieldRef: undefined, + configMapKeyRef: undefined, + secretKeyRef: undefined, + fileKeyRef: undefined, + }; +} + +export const EnvVarSource: MessageFns = { + encode(message: EnvVarSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldRef !== undefined) { + ObjectFieldSelector.encode(message.fieldRef, writer.uint32(10).fork()).join(); + } + if (message.resourceFieldRef !== undefined) { + ResourceFieldSelector.encode(message.resourceFieldRef, writer.uint32(18).fork()).join(); + } + if (message.configMapKeyRef !== undefined) { + ConfigMapKeySelector.encode(message.configMapKeyRef, writer.uint32(26).fork()).join(); + } + if (message.secretKeyRef !== undefined) { + SecretKeySelector.encode(message.secretKeyRef, writer.uint32(34).fork()).join(); + } + if (message.fileKeyRef !== undefined) { + FileKeySelector.encode(message.fileKeyRef, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnvVarSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnvVarSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.fieldRef = ObjectFieldSelector.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resourceFieldRef = ResourceFieldSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.configMapKeyRef = ConfigMapKeySelector.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.secretKeyRef = SecretKeySelector.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.fileKeyRef = FileKeySelector.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EnvVarSource { + return { + fieldRef: isSet(object.fieldRef) ? ObjectFieldSelector.fromJSON(object.fieldRef) : undefined, + resourceFieldRef: isSet(object.resourceFieldRef) + ? ResourceFieldSelector.fromJSON(object.resourceFieldRef) + : undefined, + configMapKeyRef: isSet(object.configMapKeyRef) + ? ConfigMapKeySelector.fromJSON(object.configMapKeyRef) + : undefined, + secretKeyRef: isSet(object.secretKeyRef) + ? SecretKeySelector.fromJSON(object.secretKeyRef) + : undefined, + fileKeyRef: isSet(object.fileKeyRef) ? FileKeySelector.fromJSON(object.fileKeyRef) : undefined, + }; + }, + + toJSON(message: EnvVarSource): unknown { + const obj: any = {}; + if (message.fieldRef !== undefined) { + obj.fieldRef = ObjectFieldSelector.toJSON(message.fieldRef); + } + if (message.resourceFieldRef !== undefined) { + obj.resourceFieldRef = ResourceFieldSelector.toJSON(message.resourceFieldRef); + } + if (message.configMapKeyRef !== undefined) { + obj.configMapKeyRef = ConfigMapKeySelector.toJSON(message.configMapKeyRef); + } + if (message.secretKeyRef !== undefined) { + obj.secretKeyRef = SecretKeySelector.toJSON(message.secretKeyRef); + } + if (message.fileKeyRef !== undefined) { + obj.fileKeyRef = FileKeySelector.toJSON(message.fileKeyRef); + } + return obj; + }, + + create, I>>(base?: I): EnvVarSource { + return EnvVarSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnvVarSource { + const message = createBaseEnvVarSource(); + message.fieldRef = + object.fieldRef !== undefined && object.fieldRef !== null + ? ObjectFieldSelector.fromPartial(object.fieldRef) + : undefined; + message.resourceFieldRef = + object.resourceFieldRef !== undefined && object.resourceFieldRef !== null + ? ResourceFieldSelector.fromPartial(object.resourceFieldRef) + : undefined; + message.configMapKeyRef = + object.configMapKeyRef !== undefined && object.configMapKeyRef !== null + ? ConfigMapKeySelector.fromPartial(object.configMapKeyRef) + : undefined; + message.secretKeyRef = + object.secretKeyRef !== undefined && object.secretKeyRef !== null + ? SecretKeySelector.fromPartial(object.secretKeyRef) + : undefined; + message.fileKeyRef = + object.fileKeyRef !== undefined && object.fileKeyRef !== null + ? FileKeySelector.fromPartial(object.fileKeyRef) + : undefined; + return message; + }, +}; + +function createBaseEphemeralContainer(): EphemeralContainer { + return { ephemeralContainerCommon: undefined, targetContainerName: '' }; +} + +export const EphemeralContainer: MessageFns = { + encode(message: EphemeralContainer, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ephemeralContainerCommon !== undefined) { + EphemeralContainerCommon.encode( + message.ephemeralContainerCommon, + writer.uint32(10).fork(), + ).join(); + } + if (message.targetContainerName !== undefined && message.targetContainerName !== '') { + writer.uint32(18).string(message.targetContainerName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EphemeralContainer { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEphemeralContainer(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ephemeralContainerCommon = EphemeralContainerCommon.decode( + reader, + reader.uint32(), + ); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.targetContainerName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EphemeralContainer { + return { + ephemeralContainerCommon: isSet(object.ephemeralContainerCommon) + ? EphemeralContainerCommon.fromJSON(object.ephemeralContainerCommon) + : undefined, + targetContainerName: isSet(object.targetContainerName) + ? globalThis.String(object.targetContainerName) + : '', + }; + }, + + toJSON(message: EphemeralContainer): unknown { + const obj: any = {}; + if (message.ephemeralContainerCommon !== undefined) { + obj.ephemeralContainerCommon = EphemeralContainerCommon.toJSON(message.ephemeralContainerCommon); + } + if (message.targetContainerName !== undefined && message.targetContainerName !== '') { + obj.targetContainerName = message.targetContainerName; + } + return obj; + }, + + create, I>>(base?: I): EphemeralContainer { + return EphemeralContainer.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EphemeralContainer { + const message = createBaseEphemeralContainer(); + message.ephemeralContainerCommon = + object.ephemeralContainerCommon !== undefined && object.ephemeralContainerCommon !== null + ? EphemeralContainerCommon.fromPartial(object.ephemeralContainerCommon) + : undefined; + message.targetContainerName = object.targetContainerName ?? ''; + return message; + }, +}; + +function createBaseEphemeralContainerCommon(): EphemeralContainerCommon { + return { + name: '', + image: '', + command: [], + args: [], + workingDir: '', + ports: [], + envFrom: [], + env: [], + resources: undefined, + resizePolicy: [], + restartPolicy: '', + restartPolicyRules: [], + volumeMounts: [], + volumeDevices: [], + livenessProbe: undefined, + readinessProbe: undefined, + startupProbe: undefined, + lifecycle: undefined, + terminationMessagePath: '', + terminationMessagePolicy: '', + imagePullPolicy: '', + securityContext: undefined, + stdin: false, + stdinOnce: false, + tty: false, + }; +} + +export const EphemeralContainerCommon: MessageFns = { + encode(message: EphemeralContainerCommon, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.image !== undefined && message.image !== '') { + writer.uint32(18).string(message.image); + } + for (const v of message.command) { + writer.uint32(26).string(v!); + } + for (const v of message.args) { + writer.uint32(34).string(v!); + } + if (message.workingDir !== undefined && message.workingDir !== '') { + writer.uint32(42).string(message.workingDir); + } + for (const v of message.ports) { + ContainerPort.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.envFrom) { + EnvFromSource.encode(v!, writer.uint32(154).fork()).join(); + } + for (const v of message.env) { + EnvVar.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.resources !== undefined) { + ResourceRequirements.encode(message.resources, writer.uint32(66).fork()).join(); + } + for (const v of message.resizePolicy) { + ContainerResizePolicy.encode(v!, writer.uint32(186).fork()).join(); + } + if (message.restartPolicy !== undefined && message.restartPolicy !== '') { + writer.uint32(194).string(message.restartPolicy); + } + for (const v of message.restartPolicyRules) { + ContainerRestartRule.encode(v!, writer.uint32(202).fork()).join(); + } + for (const v of message.volumeMounts) { + VolumeMount.encode(v!, writer.uint32(74).fork()).join(); + } + for (const v of message.volumeDevices) { + VolumeDevice.encode(v!, writer.uint32(170).fork()).join(); + } + if (message.livenessProbe !== undefined) { + Probe.encode(message.livenessProbe, writer.uint32(82).fork()).join(); + } + if (message.readinessProbe !== undefined) { + Probe.encode(message.readinessProbe, writer.uint32(90).fork()).join(); + } + if (message.startupProbe !== undefined) { + Probe.encode(message.startupProbe, writer.uint32(178).fork()).join(); + } + if (message.lifecycle !== undefined) { + Lifecycle.encode(message.lifecycle, writer.uint32(98).fork()).join(); + } + if (message.terminationMessagePath !== undefined && message.terminationMessagePath !== '') { + writer.uint32(106).string(message.terminationMessagePath); + } + if (message.terminationMessagePolicy !== undefined && message.terminationMessagePolicy !== '') { + writer.uint32(162).string(message.terminationMessagePolicy); + } + if (message.imagePullPolicy !== undefined && message.imagePullPolicy !== '') { + writer.uint32(114).string(message.imagePullPolicy); + } + if (message.securityContext !== undefined) { + SecurityContext.encode(message.securityContext, writer.uint32(122).fork()).join(); + } + if (message.stdin !== undefined && message.stdin !== false) { + writer.uint32(128).bool(message.stdin); + } + if (message.stdinOnce !== undefined && message.stdinOnce !== false) { + writer.uint32(136).bool(message.stdinOnce); + } + if (message.tty !== undefined && message.tty !== false) { + writer.uint32(144).bool(message.tty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EphemeralContainerCommon { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEphemeralContainerCommon(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.image = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.command.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.args.push(reader.string()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.workingDir = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.ports.push(ContainerPort.decode(reader, reader.uint32())); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + + message.envFrom.push(EnvFromSource.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.env.push(EnvVar.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.resources = ResourceRequirements.decode(reader, reader.uint32()); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + + message.resizePolicy.push(ContainerResizePolicy.decode(reader, reader.uint32())); + continue; + } + case 24: { + if (tag !== 194) { + break; + } + + message.restartPolicy = reader.string(); + continue; + } + case 25: { + if (tag !== 202) { + break; + } + + message.restartPolicyRules.push(ContainerRestartRule.decode(reader, reader.uint32())); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.volumeMounts.push(VolumeMount.decode(reader, reader.uint32())); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + + message.volumeDevices.push(VolumeDevice.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.livenessProbe = Probe.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.readinessProbe = Probe.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + + message.startupProbe = Probe.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.lifecycle = Lifecycle.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.terminationMessagePath = reader.string(); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + + message.terminationMessagePolicy = reader.string(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.imagePullPolicy = reader.string(); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.securityContext = SecurityContext.decode(reader, reader.uint32()); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + + message.stdin = reader.bool(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + + message.stdinOnce = reader.bool(); + continue; + } + case 18: { + if (tag !== 144) { + break; + } + + message.tty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EphemeralContainerCommon { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + image: isSet(object.image) ? globalThis.String(object.image) : '', + command: globalThis.Array.isArray(object?.command) + ? object.command.map((e: any) => globalThis.String(e)) + : [], + args: globalThis.Array.isArray(object?.args) + ? object.args.map((e: any) => globalThis.String(e)) + : [], + workingDir: isSet(object.workingDir) ? globalThis.String(object.workingDir) : '', + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => ContainerPort.fromJSON(e)) + : [], + envFrom: globalThis.Array.isArray(object?.envFrom) + ? object.envFrom.map((e: any) => EnvFromSource.fromJSON(e)) + : [], + env: globalThis.Array.isArray(object?.env) ? object.env.map((e: any) => EnvVar.fromJSON(e)) : [], + resources: isSet(object.resources) ? ResourceRequirements.fromJSON(object.resources) : undefined, + resizePolicy: globalThis.Array.isArray(object?.resizePolicy) + ? object.resizePolicy.map((e: any) => ContainerResizePolicy.fromJSON(e)) + : [], + restartPolicy: isSet(object.restartPolicy) ? globalThis.String(object.restartPolicy) : '', + restartPolicyRules: globalThis.Array.isArray(object?.restartPolicyRules) + ? object.restartPolicyRules.map((e: any) => ContainerRestartRule.fromJSON(e)) + : [], + volumeMounts: globalThis.Array.isArray(object?.volumeMounts) + ? object.volumeMounts.map((e: any) => VolumeMount.fromJSON(e)) + : [], + volumeDevices: globalThis.Array.isArray(object?.volumeDevices) + ? object.volumeDevices.map((e: any) => VolumeDevice.fromJSON(e)) + : [], + livenessProbe: isSet(object.livenessProbe) ? Probe.fromJSON(object.livenessProbe) : undefined, + readinessProbe: isSet(object.readinessProbe) ? Probe.fromJSON(object.readinessProbe) : undefined, + startupProbe: isSet(object.startupProbe) ? Probe.fromJSON(object.startupProbe) : undefined, + lifecycle: isSet(object.lifecycle) ? Lifecycle.fromJSON(object.lifecycle) : undefined, + terminationMessagePath: isSet(object.terminationMessagePath) + ? globalThis.String(object.terminationMessagePath) + : '', + terminationMessagePolicy: isSet(object.terminationMessagePolicy) + ? globalThis.String(object.terminationMessagePolicy) + : '', + imagePullPolicy: isSet(object.imagePullPolicy) ? globalThis.String(object.imagePullPolicy) : '', + securityContext: isSet(object.securityContext) + ? SecurityContext.fromJSON(object.securityContext) + : undefined, + stdin: isSet(object.stdin) ? globalThis.Boolean(object.stdin) : false, + stdinOnce: isSet(object.stdinOnce) ? globalThis.Boolean(object.stdinOnce) : false, + tty: isSet(object.tty) ? globalThis.Boolean(object.tty) : false, + }; + }, + + toJSON(message: EphemeralContainerCommon): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.image !== undefined && message.image !== '') { + obj.image = message.image; + } + if (message.command?.length) { + obj.command = message.command; + } + if (message.args?.length) { + obj.args = message.args; + } + if (message.workingDir !== undefined && message.workingDir !== '') { + obj.workingDir = message.workingDir; + } + if (message.ports?.length) { + obj.ports = message.ports.map((e) => ContainerPort.toJSON(e)); + } + if (message.envFrom?.length) { + obj.envFrom = message.envFrom.map((e) => EnvFromSource.toJSON(e)); + } + if (message.env?.length) { + obj.env = message.env.map((e) => EnvVar.toJSON(e)); + } + if (message.resources !== undefined) { + obj.resources = ResourceRequirements.toJSON(message.resources); + } + if (message.resizePolicy?.length) { + obj.resizePolicy = message.resizePolicy.map((e) => ContainerResizePolicy.toJSON(e)); + } + if (message.restartPolicy !== undefined && message.restartPolicy !== '') { + obj.restartPolicy = message.restartPolicy; + } + if (message.restartPolicyRules?.length) { + obj.restartPolicyRules = message.restartPolicyRules.map((e) => ContainerRestartRule.toJSON(e)); + } + if (message.volumeMounts?.length) { + obj.volumeMounts = message.volumeMounts.map((e) => VolumeMount.toJSON(e)); + } + if (message.volumeDevices?.length) { + obj.volumeDevices = message.volumeDevices.map((e) => VolumeDevice.toJSON(e)); + } + if (message.livenessProbe !== undefined) { + obj.livenessProbe = Probe.toJSON(message.livenessProbe); + } + if (message.readinessProbe !== undefined) { + obj.readinessProbe = Probe.toJSON(message.readinessProbe); + } + if (message.startupProbe !== undefined) { + obj.startupProbe = Probe.toJSON(message.startupProbe); + } + if (message.lifecycle !== undefined) { + obj.lifecycle = Lifecycle.toJSON(message.lifecycle); + } + if (message.terminationMessagePath !== undefined && message.terminationMessagePath !== '') { + obj.terminationMessagePath = message.terminationMessagePath; + } + if (message.terminationMessagePolicy !== undefined && message.terminationMessagePolicy !== '') { + obj.terminationMessagePolicy = message.terminationMessagePolicy; + } + if (message.imagePullPolicy !== undefined && message.imagePullPolicy !== '') { + obj.imagePullPolicy = message.imagePullPolicy; + } + if (message.securityContext !== undefined) { + obj.securityContext = SecurityContext.toJSON(message.securityContext); + } + if (message.stdin !== undefined && message.stdin !== false) { + obj.stdin = message.stdin; + } + if (message.stdinOnce !== undefined && message.stdinOnce !== false) { + obj.stdinOnce = message.stdinOnce; + } + if (message.tty !== undefined && message.tty !== false) { + obj.tty = message.tty; + } + return obj; + }, + + create, I>>(base?: I): EphemeralContainerCommon { + return EphemeralContainerCommon.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): EphemeralContainerCommon { + const message = createBaseEphemeralContainerCommon(); + message.name = object.name ?? ''; + message.image = object.image ?? ''; + message.command = object.command?.map((e) => e) || []; + message.args = object.args?.map((e) => e) || []; + message.workingDir = object.workingDir ?? ''; + message.ports = object.ports?.map((e) => ContainerPort.fromPartial(e)) || []; + message.envFrom = object.envFrom?.map((e) => EnvFromSource.fromPartial(e)) || []; + message.env = object.env?.map((e) => EnvVar.fromPartial(e)) || []; + message.resources = + object.resources !== undefined && object.resources !== null + ? ResourceRequirements.fromPartial(object.resources) + : undefined; + message.resizePolicy = object.resizePolicy?.map((e) => ContainerResizePolicy.fromPartial(e)) || []; + message.restartPolicy = object.restartPolicy ?? ''; + message.restartPolicyRules = + object.restartPolicyRules?.map((e) => ContainerRestartRule.fromPartial(e)) || []; + message.volumeMounts = object.volumeMounts?.map((e) => VolumeMount.fromPartial(e)) || []; + message.volumeDevices = object.volumeDevices?.map((e) => VolumeDevice.fromPartial(e)) || []; + message.livenessProbe = + object.livenessProbe !== undefined && object.livenessProbe !== null + ? Probe.fromPartial(object.livenessProbe) + : undefined; + message.readinessProbe = + object.readinessProbe !== undefined && object.readinessProbe !== null + ? Probe.fromPartial(object.readinessProbe) + : undefined; + message.startupProbe = + object.startupProbe !== undefined && object.startupProbe !== null + ? Probe.fromPartial(object.startupProbe) + : undefined; + message.lifecycle = + object.lifecycle !== undefined && object.lifecycle !== null + ? Lifecycle.fromPartial(object.lifecycle) + : undefined; + message.terminationMessagePath = object.terminationMessagePath ?? ''; + message.terminationMessagePolicy = object.terminationMessagePolicy ?? ''; + message.imagePullPolicy = object.imagePullPolicy ?? ''; + message.securityContext = + object.securityContext !== undefined && object.securityContext !== null + ? SecurityContext.fromPartial(object.securityContext) + : undefined; + message.stdin = object.stdin ?? false; + message.stdinOnce = object.stdinOnce ?? false; + message.tty = object.tty ?? false; + return message; + }, +}; + +function createBaseEphemeralVolumeSource(): EphemeralVolumeSource { + return { volumeClaimTemplate: undefined }; +} + +export const EphemeralVolumeSource: MessageFns = { + encode(message: EphemeralVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.volumeClaimTemplate !== undefined) { + PersistentVolumeClaimTemplate.encode( + message.volumeClaimTemplate, + writer.uint32(10).fork(), + ).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EphemeralVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEphemeralVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.volumeClaimTemplate = PersistentVolumeClaimTemplate.decode( + reader, + reader.uint32(), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EphemeralVolumeSource { + return { + volumeClaimTemplate: isSet(object.volumeClaimTemplate) + ? PersistentVolumeClaimTemplate.fromJSON(object.volumeClaimTemplate) + : undefined, + }; + }, + + toJSON(message: EphemeralVolumeSource): unknown { + const obj: any = {}; + if (message.volumeClaimTemplate !== undefined) { + obj.volumeClaimTemplate = PersistentVolumeClaimTemplate.toJSON(message.volumeClaimTemplate); + } + return obj; + }, + + create, I>>(base?: I): EphemeralVolumeSource { + return EphemeralVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EphemeralVolumeSource { + const message = createBaseEphemeralVolumeSource(); + message.volumeClaimTemplate = + object.volumeClaimTemplate !== undefined && object.volumeClaimTemplate !== null + ? PersistentVolumeClaimTemplate.fromPartial(object.volumeClaimTemplate) + : undefined; + return message; + }, +}; + +function createBaseEvent(): Event { + return { + metadata: undefined, + involvedObject: undefined, + reason: '', + message: '', + source: undefined, + firstTimestamp: undefined, + lastTimestamp: undefined, + count: 0, + type: '', + eventTime: undefined, + series: undefined, + action: '', + related: undefined, + reportingComponent: '', + reportingInstance: '', + }; +} + +export const Event: MessageFns = { + encode(message: Event, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.involvedObject !== undefined) { + ObjectReference.encode(message.involvedObject, writer.uint32(18).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(26).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(34).string(message.message); + } + if (message.source !== undefined) { + EventSource.encode(message.source, writer.uint32(42).fork()).join(); + } + if (message.firstTimestamp !== undefined) { + Time.encode(message.firstTimestamp, writer.uint32(50).fork()).join(); + } + if (message.lastTimestamp !== undefined) { + Time.encode(message.lastTimestamp, writer.uint32(58).fork()).join(); + } + if (message.count !== undefined && message.count !== 0) { + writer.uint32(64).int32(message.count); + } + if (message.type !== undefined && message.type !== '') { + writer.uint32(74).string(message.type); + } + if (message.eventTime !== undefined) { + MicroTime.encode(message.eventTime, writer.uint32(82).fork()).join(); + } + if (message.series !== undefined) { + EventSeries.encode(message.series, writer.uint32(90).fork()).join(); + } + if (message.action !== undefined && message.action !== '') { + writer.uint32(98).string(message.action); + } + if (message.related !== undefined) { + ObjectReference.encode(message.related, writer.uint32(106).fork()).join(); + } + if (message.reportingComponent !== undefined && message.reportingComponent !== '') { + writer.uint32(114).string(message.reportingComponent); + } + if (message.reportingInstance !== undefined && message.reportingInstance !== '') { + writer.uint32(122).string(message.reportingInstance); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.involvedObject = ObjectReference.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.reason = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.message = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.source = EventSource.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.firstTimestamp = Time.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.lastTimestamp = Time.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.count = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.type = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.eventTime = MicroTime.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.series = EventSeries.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.action = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.related = ObjectReference.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.reportingComponent = reader.string(); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.reportingInstance = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Event { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + involvedObject: isSet(object.involvedObject) + ? ObjectReference.fromJSON(object.involvedObject) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + source: isSet(object.source) ? EventSource.fromJSON(object.source) : undefined, + firstTimestamp: isSet(object.firstTimestamp) ? Time.fromJSON(object.firstTimestamp) : undefined, + lastTimestamp: isSet(object.lastTimestamp) ? Time.fromJSON(object.lastTimestamp) : undefined, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + type: isSet(object.type) ? globalThis.String(object.type) : '', + eventTime: isSet(object.eventTime) ? MicroTime.fromJSON(object.eventTime) : undefined, + series: isSet(object.series) ? EventSeries.fromJSON(object.series) : undefined, + action: isSet(object.action) ? globalThis.String(object.action) : '', + related: isSet(object.related) ? ObjectReference.fromJSON(object.related) : undefined, + reportingComponent: isSet(object.reportingComponent) + ? globalThis.String(object.reportingComponent) + : '', + reportingInstance: isSet(object.reportingInstance) + ? globalThis.String(object.reportingInstance) + : '', + }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.involvedObject !== undefined) { + obj.involvedObject = ObjectReference.toJSON(message.involvedObject); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + if (message.source !== undefined) { + obj.source = EventSource.toJSON(message.source); + } + if (message.firstTimestamp !== undefined) { + obj.firstTimestamp = Time.toJSON(message.firstTimestamp); + } + if (message.lastTimestamp !== undefined) { + obj.lastTimestamp = Time.toJSON(message.lastTimestamp); + } + if (message.count !== undefined && message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.eventTime !== undefined) { + obj.eventTime = MicroTime.toJSON(message.eventTime); + } + if (message.series !== undefined) { + obj.series = EventSeries.toJSON(message.series); + } + if (message.action !== undefined && message.action !== '') { + obj.action = message.action; + } + if (message.related !== undefined) { + obj.related = ObjectReference.toJSON(message.related); + } + if (message.reportingComponent !== undefined && message.reportingComponent !== '') { + obj.reportingComponent = message.reportingComponent; + } + if (message.reportingInstance !== undefined && message.reportingInstance !== '') { + obj.reportingInstance = message.reportingInstance; + } + return obj; + }, + + create, I>>(base?: I): Event { + return Event.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Event { + const message = createBaseEvent(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.involvedObject = + object.involvedObject !== undefined && object.involvedObject !== null + ? ObjectReference.fromPartial(object.involvedObject) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + message.source = + object.source !== undefined && object.source !== null + ? EventSource.fromPartial(object.source) + : undefined; + message.firstTimestamp = + object.firstTimestamp !== undefined && object.firstTimestamp !== null + ? Time.fromPartial(object.firstTimestamp) + : undefined; + message.lastTimestamp = + object.lastTimestamp !== undefined && object.lastTimestamp !== null + ? Time.fromPartial(object.lastTimestamp) + : undefined; + message.count = object.count ?? 0; + message.type = object.type ?? ''; + message.eventTime = + object.eventTime !== undefined && object.eventTime !== null + ? MicroTime.fromPartial(object.eventTime) + : undefined; + message.series = + object.series !== undefined && object.series !== null + ? EventSeries.fromPartial(object.series) + : undefined; + message.action = object.action ?? ''; + message.related = + object.related !== undefined && object.related !== null + ? ObjectReference.fromPartial(object.related) + : undefined; + message.reportingComponent = object.reportingComponent ?? ''; + message.reportingInstance = object.reportingInstance ?? ''; + return message; + }, +}; + +function createBaseEventList(): EventList { + return { metadata: undefined, items: [] }; +} + +export const EventList: MessageFns = { + encode(message: EventList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Event.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Event.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EventList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Event.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EventList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Event.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EventList { + return EventList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventList { + const message = createBaseEventList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Event.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEventSeries(): EventSeries { + return { count: 0, lastObservedTime: undefined }; +} + +export const EventSeries: MessageFns = { + encode(message: EventSeries, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.count !== undefined && message.count !== 0) { + writer.uint32(8).int32(message.count); + } + if (message.lastObservedTime !== undefined) { + MicroTime.encode(message.lastObservedTime, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventSeries { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSeries(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.count = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.lastObservedTime = MicroTime.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EventSeries { + return { + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + lastObservedTime: isSet(object.lastObservedTime) + ? MicroTime.fromJSON(object.lastObservedTime) + : undefined, + }; + }, + + toJSON(message: EventSeries): unknown { + const obj: any = {}; + if (message.count !== undefined && message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.lastObservedTime !== undefined) { + obj.lastObservedTime = MicroTime.toJSON(message.lastObservedTime); + } + return obj; + }, + + create, I>>(base?: I): EventSeries { + return EventSeries.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventSeries { + const message = createBaseEventSeries(); + message.count = object.count ?? 0; + message.lastObservedTime = + object.lastObservedTime !== undefined && object.lastObservedTime !== null + ? MicroTime.fromPartial(object.lastObservedTime) + : undefined; + return message; + }, +}; + +function createBaseEventSource(): EventSource { + return { component: '', host: '' }; +} + +export const EventSource: MessageFns = { + encode(message: EventSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.component !== undefined && message.component !== '') { + writer.uint32(10).string(message.component); + } + if (message.host !== undefined && message.host !== '') { + writer.uint32(18).string(message.host); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.component = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.host = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EventSource { + return { + component: isSet(object.component) ? globalThis.String(object.component) : '', + host: isSet(object.host) ? globalThis.String(object.host) : '', + }; + }, + + toJSON(message: EventSource): unknown { + const obj: any = {}; + if (message.component !== undefined && message.component !== '') { + obj.component = message.component; + } + if (message.host !== undefined && message.host !== '') { + obj.host = message.host; + } + return obj; + }, + + create, I>>(base?: I): EventSource { + return EventSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventSource { + const message = createBaseEventSource(); + message.component = object.component ?? ''; + message.host = object.host ?? ''; + return message; + }, +}; + +function createBaseEvictionResponder(): EvictionResponder { + return { name: '', priority: 0 }; +} + +export const EvictionResponder: MessageFns = { + encode(message: EvictionResponder, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.priority !== undefined && message.priority !== 0) { + writer.uint32(16).int32(message.priority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvictionResponder { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvictionResponder(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.priority = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EvictionResponder { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + priority: isSet(object.priority) ? globalThis.Number(object.priority) : 0, + }; + }, + + toJSON(message: EvictionResponder): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.priority !== undefined && message.priority !== 0) { + obj.priority = Math.round(message.priority); + } + return obj; + }, + + create, I>>(base?: I): EvictionResponder { + return EvictionResponder.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EvictionResponder { + const message = createBaseEvictionResponder(); + message.name = object.name ?? ''; + message.priority = object.priority ?? 0; + return message; + }, +}; + +function createBaseExecAction(): ExecAction { + return { command: [] }; +} + +export const ExecAction: MessageFns = { + encode(message: ExecAction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.command) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecAction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecAction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.command.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ExecAction { + return { + command: globalThis.Array.isArray(object?.command) + ? object.command.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ExecAction): unknown { + const obj: any = {}; + if (message.command?.length) { + obj.command = message.command; + } + return obj; + }, + + create, I>>(base?: I): ExecAction { + return ExecAction.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecAction { + const message = createBaseExecAction(); + message.command = object.command?.map((e) => e) || []; + return message; + }, +}; + +function createBaseFCVolumeSource(): FCVolumeSource { + return { targetWWNs: [], lun: 0, fsType: '', readOnly: false, wwids: [] }; +} + +export const FCVolumeSource: MessageFns = { + encode(message: FCVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.targetWWNs) { + writer.uint32(10).string(v!); + } + if (message.lun !== undefined && message.lun !== 0) { + writer.uint32(16).int32(message.lun); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(26).string(message.fsType); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + for (const v of message.wwids) { + writer.uint32(42).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FCVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFCVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.targetWWNs.push(reader.string()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.lun = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.wwids.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FCVolumeSource { + return { + targetWWNs: globalThis.Array.isArray(object?.targetWWNs) + ? object.targetWWNs.map((e: any) => globalThis.String(e)) + : [], + lun: isSet(object.lun) ? globalThis.Number(object.lun) : 0, + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + wwids: globalThis.Array.isArray(object?.wwids) + ? object.wwids.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: FCVolumeSource): unknown { + const obj: any = {}; + if (message.targetWWNs?.length) { + obj.targetWWNs = message.targetWWNs; + } + if (message.lun !== undefined && message.lun !== 0) { + obj.lun = Math.round(message.lun); + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.wwids?.length) { + obj.wwids = message.wwids; + } + return obj; + }, + + create, I>>(base?: I): FCVolumeSource { + return FCVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FCVolumeSource { + const message = createBaseFCVolumeSource(); + message.targetWWNs = object.targetWWNs?.map((e) => e) || []; + message.lun = object.lun ?? 0; + message.fsType = object.fsType ?? ''; + message.readOnly = object.readOnly ?? false; + message.wwids = object.wwids?.map((e) => e) || []; + return message; + }, +}; + +function createBaseFileKeySelector(): FileKeySelector { + return { volumeName: '', path: '', key: '', optional: false }; +} + +export const FileKeySelector: MessageFns = { + encode(message: FileKeySelector, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.volumeName !== undefined && message.volumeName !== '') { + writer.uint32(10).string(message.volumeName); + } + if (message.path !== undefined && message.path !== '') { + writer.uint32(18).string(message.path); + } + if (message.key !== undefined && message.key !== '') { + writer.uint32(26).string(message.key); + } + if (message.optional !== undefined && message.optional !== false) { + writer.uint32(32).bool(message.optional); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileKeySelector { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileKeySelector(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.volumeName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.key = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.optional = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FileKeySelector { + return { + volumeName: isSet(object.volumeName) ? globalThis.String(object.volumeName) : '', + path: isSet(object.path) ? globalThis.String(object.path) : '', + key: isSet(object.key) ? globalThis.String(object.key) : '', + optional: isSet(object.optional) ? globalThis.Boolean(object.optional) : false, + }; + }, + + toJSON(message: FileKeySelector): unknown { + const obj: any = {}; + if (message.volumeName !== undefined && message.volumeName !== '') { + obj.volumeName = message.volumeName; + } + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.key !== undefined && message.key !== '') { + obj.key = message.key; + } + if (message.optional !== undefined && message.optional !== false) { + obj.optional = message.optional; + } + return obj; + }, + + create, I>>(base?: I): FileKeySelector { + return FileKeySelector.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FileKeySelector { + const message = createBaseFileKeySelector(); + message.volumeName = object.volumeName ?? ''; + message.path = object.path ?? ''; + message.key = object.key ?? ''; + message.optional = object.optional ?? false; + return message; + }, +}; + +function createBaseFlexPersistentVolumeSource(): FlexPersistentVolumeSource { + return { driver: '', fsType: '', secretRef: undefined, readOnly: false, options: {} }; +} + +export const FlexPersistentVolumeSource: MessageFns = { + encode(message: FlexPersistentVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.driver !== undefined && message.driver !== '') { + writer.uint32(10).string(message.driver); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(18).string(message.fsType); + } + if (message.secretRef !== undefined) { + SecretReference.encode(message.secretRef, writer.uint32(26).fork()).join(); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + globalThis.Object.entries(message.options).forEach(([key, value]: [string, string]) => { + FlexPersistentVolumeSource_OptionsEntry.encode( + { key: key as any, value }, + writer.uint32(42).fork(), + ).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlexPersistentVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlexPersistentVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.driver = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.secretRef = SecretReference.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + const entry5 = FlexPersistentVolumeSource_OptionsEntry.decode( + reader, + reader.uint32(), + ); + if (entry5.value !== undefined) { + message.options[entry5.key] = entry5.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FlexPersistentVolumeSource { + return { + driver: isSet(object.driver) ? globalThis.String(object.driver) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + secretRef: isSet(object.secretRef) ? SecretReference.fromJSON(object.secretRef) : undefined, + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + options: isObject(object.options) + ? (globalThis.Object.entries(object.options) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: FlexPersistentVolumeSource): unknown { + const obj: any = {}; + if (message.driver !== undefined && message.driver !== '') { + obj.driver = message.driver; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.secretRef !== undefined) { + obj.secretRef = SecretReference.toJSON(message.secretRef); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.options) { + const entries = globalThis.Object.entries(message.options) as [string, string][]; + if (entries.length > 0) { + obj.options = {}; + entries.forEach(([k, v]) => { + obj.options[k] = v; + }); + } + } + return obj; + }, + + create, I>>( + base?: I, + ): FlexPersistentVolumeSource { + return FlexPersistentVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FlexPersistentVolumeSource { + const message = createBaseFlexPersistentVolumeSource(); + message.driver = object.driver ?? ''; + message.fsType = object.fsType ?? ''; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? SecretReference.fromPartial(object.secretRef) + : undefined; + message.readOnly = object.readOnly ?? false; + message.options = (globalThis.Object.entries(object.options ?? {}) as [string, string][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseFlexPersistentVolumeSource_OptionsEntry(): FlexPersistentVolumeSource_OptionsEntry { + return { key: '', value: '' }; +} + +export const FlexPersistentVolumeSource_OptionsEntry: MessageFns = { + encode( + message: FlexPersistentVolumeSource_OptionsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlexPersistentVolumeSource_OptionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlexPersistentVolumeSource_OptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FlexPersistentVolumeSource_OptionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: FlexPersistentVolumeSource_OptionsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): FlexPersistentVolumeSource_OptionsEntry { + return FlexPersistentVolumeSource_OptionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FlexPersistentVolumeSource_OptionsEntry { + const message = createBaseFlexPersistentVolumeSource_OptionsEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBaseFlexVolumeSource(): FlexVolumeSource { + return { driver: '', fsType: '', secretRef: undefined, readOnly: false, options: {} }; +} + +export const FlexVolumeSource: MessageFns = { + encode(message: FlexVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.driver !== undefined && message.driver !== '') { + writer.uint32(10).string(message.driver); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(18).string(message.fsType); + } + if (message.secretRef !== undefined) { + LocalObjectReference.encode(message.secretRef, writer.uint32(26).fork()).join(); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + globalThis.Object.entries(message.options).forEach(([key, value]: [string, string]) => { + FlexVolumeSource_OptionsEntry.encode({ key: key as any, value }, writer.uint32(42).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlexVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlexVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.driver = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.secretRef = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + const entry5 = FlexVolumeSource_OptionsEntry.decode(reader, reader.uint32()); + if (entry5.value !== undefined) { + message.options[entry5.key] = entry5.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FlexVolumeSource { + return { + driver: isSet(object.driver) ? globalThis.String(object.driver) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + secretRef: isSet(object.secretRef) ? LocalObjectReference.fromJSON(object.secretRef) : undefined, + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + options: isObject(object.options) + ? (globalThis.Object.entries(object.options) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: FlexVolumeSource): unknown { + const obj: any = {}; + if (message.driver !== undefined && message.driver !== '') { + obj.driver = message.driver; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.secretRef !== undefined) { + obj.secretRef = LocalObjectReference.toJSON(message.secretRef); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.options) { + const entries = globalThis.Object.entries(message.options) as [string, string][]; + if (entries.length > 0) { + obj.options = {}; + entries.forEach(([k, v]) => { + obj.options[k] = v; + }); + } + } + return obj; + }, + + create, I>>(base?: I): FlexVolumeSource { + return FlexVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FlexVolumeSource { + const message = createBaseFlexVolumeSource(); + message.driver = object.driver ?? ''; + message.fsType = object.fsType ?? ''; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? LocalObjectReference.fromPartial(object.secretRef) + : undefined; + message.readOnly = object.readOnly ?? false; + message.options = (globalThis.Object.entries(object.options ?? {}) as [string, string][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseFlexVolumeSource_OptionsEntry(): FlexVolumeSource_OptionsEntry { + return { key: '', value: '' }; +} + +export const FlexVolumeSource_OptionsEntry: MessageFns = { + encode(message: FlexVolumeSource_OptionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlexVolumeSource_OptionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlexVolumeSource_OptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FlexVolumeSource_OptionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: FlexVolumeSource_OptionsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): FlexVolumeSource_OptionsEntry { + return FlexVolumeSource_OptionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FlexVolumeSource_OptionsEntry { + const message = createBaseFlexVolumeSource_OptionsEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBaseFlockerVolumeSource(): FlockerVolumeSource { + return { datasetName: '', datasetUUID: '' }; +} + +export const FlockerVolumeSource: MessageFns = { + encode(message: FlockerVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.datasetName !== undefined && message.datasetName !== '') { + writer.uint32(10).string(message.datasetName); + } + if (message.datasetUUID !== undefined && message.datasetUUID !== '') { + writer.uint32(18).string(message.datasetUUID); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlockerVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlockerVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.datasetName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.datasetUUID = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FlockerVolumeSource { + return { + datasetName: isSet(object.datasetName) ? globalThis.String(object.datasetName) : '', + datasetUUID: isSet(object.datasetUUID) ? globalThis.String(object.datasetUUID) : '', + }; + }, + + toJSON(message: FlockerVolumeSource): unknown { + const obj: any = {}; + if (message.datasetName !== undefined && message.datasetName !== '') { + obj.datasetName = message.datasetName; + } + if (message.datasetUUID !== undefined && message.datasetUUID !== '') { + obj.datasetUUID = message.datasetUUID; + } + return obj; + }, + + create, I>>(base?: I): FlockerVolumeSource { + return FlockerVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FlockerVolumeSource { + const message = createBaseFlockerVolumeSource(); + message.datasetName = object.datasetName ?? ''; + message.datasetUUID = object.datasetUUID ?? ''; + return message; + }, +}; + +function createBaseGCEPersistentDiskVolumeSource(): GCEPersistentDiskVolumeSource { + return { pdName: '', fsType: '', partition: 0, readOnly: false }; +} + +export const GCEPersistentDiskVolumeSource: MessageFns = { + encode(message: GCEPersistentDiskVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pdName !== undefined && message.pdName !== '') { + writer.uint32(10).string(message.pdName); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(18).string(message.fsType); + } + if (message.partition !== undefined && message.partition !== 0) { + writer.uint32(24).int32(message.partition); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GCEPersistentDiskVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGCEPersistentDiskVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.pdName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.partition = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GCEPersistentDiskVolumeSource { + return { + pdName: isSet(object.pdName) ? globalThis.String(object.pdName) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + partition: isSet(object.partition) ? globalThis.Number(object.partition) : 0, + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: GCEPersistentDiskVolumeSource): unknown { + const obj: any = {}; + if (message.pdName !== undefined && message.pdName !== '') { + obj.pdName = message.pdName; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.partition !== undefined && message.partition !== 0) { + obj.partition = Math.round(message.partition); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>( + base?: I, + ): GCEPersistentDiskVolumeSource { + return GCEPersistentDiskVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GCEPersistentDiskVolumeSource { + const message = createBaseGCEPersistentDiskVolumeSource(); + message.pdName = object.pdName ?? ''; + message.fsType = object.fsType ?? ''; + message.partition = object.partition ?? 0; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBaseGRPCAction(): GRPCAction { + return { port: 0, service: '', mode: '' }; +} + +export const GRPCAction: MessageFns = { + encode(message: GRPCAction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.port !== undefined && message.port !== 0) { + writer.uint32(8).int32(message.port); + } + if (message.service !== undefined && message.service !== '') { + writer.uint32(18).string(message.service); + } + if (message.mode !== undefined && message.mode !== '') { + writer.uint32(26).string(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GRPCAction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGRPCAction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.port = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.service = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.mode = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GRPCAction { + return { + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + service: isSet(object.service) ? globalThis.String(object.service) : '', + mode: isSet(object.mode) ? globalThis.String(object.mode) : '', + }; + }, + + toJSON(message: GRPCAction): unknown { + const obj: any = {}; + if (message.port !== undefined && message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.service !== undefined && message.service !== '') { + obj.service = message.service; + } + if (message.mode !== undefined && message.mode !== '') { + obj.mode = message.mode; + } + return obj; + }, + + create, I>>(base?: I): GRPCAction { + return GRPCAction.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GRPCAction { + const message = createBaseGRPCAction(); + message.port = object.port ?? 0; + message.service = object.service ?? ''; + message.mode = object.mode ?? ''; + return message; + }, +}; + +function createBaseGitRepoVolumeSource(): GitRepoVolumeSource { + return { repository: '', revision: '', directory: '' }; +} + +export const GitRepoVolumeSource: MessageFns = { + encode(message: GitRepoVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.repository !== undefined && message.repository !== '') { + writer.uint32(10).string(message.repository); + } + if (message.revision !== undefined && message.revision !== '') { + writer.uint32(18).string(message.revision); + } + if (message.directory !== undefined && message.directory !== '') { + writer.uint32(26).string(message.directory); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GitRepoVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGitRepoVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.repository = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.revision = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.directory = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GitRepoVolumeSource { + return { + repository: isSet(object.repository) ? globalThis.String(object.repository) : '', + revision: isSet(object.revision) ? globalThis.String(object.revision) : '', + directory: isSet(object.directory) ? globalThis.String(object.directory) : '', + }; + }, + + toJSON(message: GitRepoVolumeSource): unknown { + const obj: any = {}; + if (message.repository !== undefined && message.repository !== '') { + obj.repository = message.repository; + } + if (message.revision !== undefined && message.revision !== '') { + obj.revision = message.revision; + } + if (message.directory !== undefined && message.directory !== '') { + obj.directory = message.directory; + } + return obj; + }, + + create, I>>(base?: I): GitRepoVolumeSource { + return GitRepoVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GitRepoVolumeSource { + const message = createBaseGitRepoVolumeSource(); + message.repository = object.repository ?? ''; + message.revision = object.revision ?? ''; + message.directory = object.directory ?? ''; + return message; + }, +}; + +function createBaseGlusterfsPersistentVolumeSource(): GlusterfsPersistentVolumeSource { + return { endpoints: '', path: '', readOnly: false, endpointsNamespace: '' }; +} + +export const GlusterfsPersistentVolumeSource: MessageFns = { + encode( + message: GlusterfsPersistentVolumeSource, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.endpoints !== undefined && message.endpoints !== '') { + writer.uint32(10).string(message.endpoints); + } + if (message.path !== undefined && message.path !== '') { + writer.uint32(18).string(message.path); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(24).bool(message.readOnly); + } + if (message.endpointsNamespace !== undefined && message.endpointsNamespace !== '') { + writer.uint32(34).string(message.endpointsNamespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GlusterfsPersistentVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGlusterfsPersistentVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.endpoints = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.endpointsNamespace = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GlusterfsPersistentVolumeSource { + return { + endpoints: isSet(object.endpoints) ? globalThis.String(object.endpoints) : '', + path: isSet(object.path) ? globalThis.String(object.path) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + endpointsNamespace: isSet(object.endpointsNamespace) + ? globalThis.String(object.endpointsNamespace) + : '', + }; + }, + + toJSON(message: GlusterfsPersistentVolumeSource): unknown { + const obj: any = {}; + if (message.endpoints !== undefined && message.endpoints !== '') { + obj.endpoints = message.endpoints; + } + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.endpointsNamespace !== undefined && message.endpointsNamespace !== '') { + obj.endpointsNamespace = message.endpointsNamespace; + } + return obj; + }, + + create, I>>( + base?: I, + ): GlusterfsPersistentVolumeSource { + return GlusterfsPersistentVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GlusterfsPersistentVolumeSource { + const message = createBaseGlusterfsPersistentVolumeSource(); + message.endpoints = object.endpoints ?? ''; + message.path = object.path ?? ''; + message.readOnly = object.readOnly ?? false; + message.endpointsNamespace = object.endpointsNamespace ?? ''; + return message; + }, +}; + +function createBaseGlusterfsVolumeSource(): GlusterfsVolumeSource { + return { endpoints: '', path: '', readOnly: false }; +} + +export const GlusterfsVolumeSource: MessageFns = { + encode(message: GlusterfsVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.endpoints !== undefined && message.endpoints !== '') { + writer.uint32(10).string(message.endpoints); + } + if (message.path !== undefined && message.path !== '') { + writer.uint32(18).string(message.path); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(24).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GlusterfsVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGlusterfsVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.endpoints = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GlusterfsVolumeSource { + return { + endpoints: isSet(object.endpoints) ? globalThis.String(object.endpoints) : '', + path: isSet(object.path) ? globalThis.String(object.path) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: GlusterfsVolumeSource): unknown { + const obj: any = {}; + if (message.endpoints !== undefined && message.endpoints !== '') { + obj.endpoints = message.endpoints; + } + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>(base?: I): GlusterfsVolumeSource { + return GlusterfsVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GlusterfsVolumeSource { + const message = createBaseGlusterfsVolumeSource(); + message.endpoints = object.endpoints ?? ''; + message.path = object.path ?? ''; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBaseHTTPGetAction(): HTTPGetAction { + return { path: '', port: undefined, host: '', scheme: '', httpHeaders: [], protocol: '' }; +} + +export const HTTPGetAction: MessageFns = { + encode(message: HTTPGetAction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined && message.path !== '') { + writer.uint32(10).string(message.path); + } + if (message.port !== undefined) { + IntOrString.encode(message.port, writer.uint32(18).fork()).join(); + } + if (message.host !== undefined && message.host !== '') { + writer.uint32(26).string(message.host); + } + if (message.scheme !== undefined && message.scheme !== '') { + writer.uint32(34).string(message.scheme); + } + for (const v of message.httpHeaders) { + HTTPHeader.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.protocol !== undefined && message.protocol !== '') { + writer.uint32(50).string(message.protocol); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HTTPGetAction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHTTPGetAction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.port = IntOrString.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.host = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.scheme = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.httpHeaders.push(HTTPHeader.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.protocol = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HTTPGetAction { + return { + path: isSet(object.path) ? globalThis.String(object.path) : '', + port: isSet(object.port) ? IntOrString.fromJSON(object.port) : undefined, + host: isSet(object.host) ? globalThis.String(object.host) : '', + scheme: isSet(object.scheme) ? globalThis.String(object.scheme) : '', + httpHeaders: globalThis.Array.isArray(object?.httpHeaders) + ? object.httpHeaders.map((e: any) => HTTPHeader.fromJSON(e)) + : [], + protocol: isSet(object.protocol) ? globalThis.String(object.protocol) : '', + }; + }, + + toJSON(message: HTTPGetAction): unknown { + const obj: any = {}; + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.port !== undefined) { + obj.port = IntOrString.toJSON(message.port); + } + if (message.host !== undefined && message.host !== '') { + obj.host = message.host; + } + if (message.scheme !== undefined && message.scheme !== '') { + obj.scheme = message.scheme; + } + if (message.httpHeaders?.length) { + obj.httpHeaders = message.httpHeaders.map((e) => HTTPHeader.toJSON(e)); + } + if (message.protocol !== undefined && message.protocol !== '') { + obj.protocol = message.protocol; + } + return obj; + }, + + create, I>>(base?: I): HTTPGetAction { + return HTTPGetAction.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HTTPGetAction { + const message = createBaseHTTPGetAction(); + message.path = object.path ?? ''; + message.port = + object.port !== undefined && object.port !== null + ? IntOrString.fromPartial(object.port) + : undefined; + message.host = object.host ?? ''; + message.scheme = object.scheme ?? ''; + message.httpHeaders = object.httpHeaders?.map((e) => HTTPHeader.fromPartial(e)) || []; + message.protocol = object.protocol ?? ''; + return message; + }, +}; + +function createBaseHTTPHeader(): HTTPHeader { + return { name: '', value: '' }; +} + +export const HTTPHeader: MessageFns = { + encode(message: HTTPHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.value !== undefined && message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HTTPHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHTTPHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HTTPHeader { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: HTTPHeader): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.value !== undefined && message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): HTTPHeader { + return HTTPHeader.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HTTPHeader { + const message = createBaseHTTPHeader(); + message.name = object.name ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBaseHostAlias(): HostAlias { + return { ip: '', hostnames: [] }; +} + +export const HostAlias: MessageFns = { + encode(message: HostAlias, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ip !== undefined && message.ip !== '') { + writer.uint32(10).string(message.ip); + } + for (const v of message.hostnames) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HostAlias { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHostAlias(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ip = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hostnames.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HostAlias { + return { + ip: isSet(object.ip) ? globalThis.String(object.ip) : '', + hostnames: globalThis.Array.isArray(object?.hostnames) + ? object.hostnames.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: HostAlias): unknown { + const obj: any = {}; + if (message.ip !== undefined && message.ip !== '') { + obj.ip = message.ip; + } + if (message.hostnames?.length) { + obj.hostnames = message.hostnames; + } + return obj; + }, + + create, I>>(base?: I): HostAlias { + return HostAlias.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HostAlias { + const message = createBaseHostAlias(); + message.ip = object.ip ?? ''; + message.hostnames = object.hostnames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseHostIP(): HostIP { + return { ip: '' }; +} + +export const HostIP: MessageFns = { + encode(message: HostIP, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ip !== undefined && message.ip !== '') { + writer.uint32(10).string(message.ip); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HostIP { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHostIP(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ip = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HostIP { + return { ip: isSet(object.ip) ? globalThis.String(object.ip) : '' }; + }, + + toJSON(message: HostIP): unknown { + const obj: any = {}; + if (message.ip !== undefined && message.ip !== '') { + obj.ip = message.ip; + } + return obj; + }, + + create, I>>(base?: I): HostIP { + return HostIP.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HostIP { + const message = createBaseHostIP(); + message.ip = object.ip ?? ''; + return message; + }, +}; + +function createBaseHostPathVolumeSource(): HostPathVolumeSource { + return { path: '', type: '' }; +} + +export const HostPathVolumeSource: MessageFns = { + encode(message: HostPathVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined && message.path !== '') { + writer.uint32(10).string(message.path); + } + if (message.type !== undefined && message.type !== '') { + writer.uint32(18).string(message.type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HostPathVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHostPathVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.type = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HostPathVolumeSource { + return { + path: isSet(object.path) ? globalThis.String(object.path) : '', + type: isSet(object.type) ? globalThis.String(object.type) : '', + }; + }, + + toJSON(message: HostPathVolumeSource): unknown { + const obj: any = {}; + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + return obj; + }, + + create, I>>(base?: I): HostPathVolumeSource { + return HostPathVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HostPathVolumeSource { + const message = createBaseHostPathVolumeSource(); + message.path = object.path ?? ''; + message.type = object.type ?? ''; + return message; + }, +}; + +function createBaseISCSIPersistentVolumeSource(): ISCSIPersistentVolumeSource { + return { + targetPortal: '', + iqn: '', + lun: 0, + iscsiInterface: '', + fsType: '', + readOnly: false, + portals: [], + chapAuthDiscovery: false, + chapAuthSession: false, + secretRef: undefined, + initiatorName: '', + }; +} + +export const ISCSIPersistentVolumeSource: MessageFns = { + encode(message: ISCSIPersistentVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetPortal !== undefined && message.targetPortal !== '') { + writer.uint32(10).string(message.targetPortal); + } + if (message.iqn !== undefined && message.iqn !== '') { + writer.uint32(18).string(message.iqn); + } + if (message.lun !== undefined && message.lun !== 0) { + writer.uint32(24).int32(message.lun); + } + if (message.iscsiInterface !== undefined && message.iscsiInterface !== '') { + writer.uint32(34).string(message.iscsiInterface); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(42).string(message.fsType); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(48).bool(message.readOnly); + } + for (const v of message.portals) { + writer.uint32(58).string(v!); + } + if (message.chapAuthDiscovery !== undefined && message.chapAuthDiscovery !== false) { + writer.uint32(64).bool(message.chapAuthDiscovery); + } + if (message.chapAuthSession !== undefined && message.chapAuthSession !== false) { + writer.uint32(88).bool(message.chapAuthSession); + } + if (message.secretRef !== undefined) { + SecretReference.encode(message.secretRef, writer.uint32(82).fork()).join(); + } + if (message.initiatorName !== undefined && message.initiatorName !== '') { + writer.uint32(98).string(message.initiatorName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ISCSIPersistentVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseISCSIPersistentVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.targetPortal = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.iqn = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.lun = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.iscsiInterface = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.portals.push(reader.string()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.chapAuthDiscovery = reader.bool(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + + message.chapAuthSession = reader.bool(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.secretRef = SecretReference.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.initiatorName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ISCSIPersistentVolumeSource { + return { + targetPortal: isSet(object.targetPortal) ? globalThis.String(object.targetPortal) : '', + iqn: isSet(object.iqn) ? globalThis.String(object.iqn) : '', + lun: isSet(object.lun) ? globalThis.Number(object.lun) : 0, + iscsiInterface: isSet(object.iscsiInterface) ? globalThis.String(object.iscsiInterface) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + portals: globalThis.Array.isArray(object?.portals) + ? object.portals.map((e: any) => globalThis.String(e)) + : [], + chapAuthDiscovery: isSet(object.chapAuthDiscovery) + ? globalThis.Boolean(object.chapAuthDiscovery) + : false, + chapAuthSession: isSet(object.chapAuthSession) + ? globalThis.Boolean(object.chapAuthSession) + : false, + secretRef: isSet(object.secretRef) ? SecretReference.fromJSON(object.secretRef) : undefined, + initiatorName: isSet(object.initiatorName) ? globalThis.String(object.initiatorName) : '', + }; + }, + + toJSON(message: ISCSIPersistentVolumeSource): unknown { + const obj: any = {}; + if (message.targetPortal !== undefined && message.targetPortal !== '') { + obj.targetPortal = message.targetPortal; + } + if (message.iqn !== undefined && message.iqn !== '') { + obj.iqn = message.iqn; + } + if (message.lun !== undefined && message.lun !== 0) { + obj.lun = Math.round(message.lun); + } + if (message.iscsiInterface !== undefined && message.iscsiInterface !== '') { + obj.iscsiInterface = message.iscsiInterface; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.portals?.length) { + obj.portals = message.portals; + } + if (message.chapAuthDiscovery !== undefined && message.chapAuthDiscovery !== false) { + obj.chapAuthDiscovery = message.chapAuthDiscovery; + } + if (message.chapAuthSession !== undefined && message.chapAuthSession !== false) { + obj.chapAuthSession = message.chapAuthSession; + } + if (message.secretRef !== undefined) { + obj.secretRef = SecretReference.toJSON(message.secretRef); + } + if (message.initiatorName !== undefined && message.initiatorName !== '') { + obj.initiatorName = message.initiatorName; + } + return obj; + }, + + create, I>>( + base?: I, + ): ISCSIPersistentVolumeSource { + return ISCSIPersistentVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ISCSIPersistentVolumeSource { + const message = createBaseISCSIPersistentVolumeSource(); + message.targetPortal = object.targetPortal ?? ''; + message.iqn = object.iqn ?? ''; + message.lun = object.lun ?? 0; + message.iscsiInterface = object.iscsiInterface ?? ''; + message.fsType = object.fsType ?? ''; + message.readOnly = object.readOnly ?? false; + message.portals = object.portals?.map((e) => e) || []; + message.chapAuthDiscovery = object.chapAuthDiscovery ?? false; + message.chapAuthSession = object.chapAuthSession ?? false; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? SecretReference.fromPartial(object.secretRef) + : undefined; + message.initiatorName = object.initiatorName ?? ''; + return message; + }, +}; + +function createBaseISCSIVolumeSource(): ISCSIVolumeSource { + return { + targetPortal: '', + iqn: '', + lun: 0, + iscsiInterface: '', + fsType: '', + readOnly: false, + portals: [], + chapAuthDiscovery: false, + chapAuthSession: false, + secretRef: undefined, + initiatorName: '', + }; +} + +export const ISCSIVolumeSource: MessageFns = { + encode(message: ISCSIVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.targetPortal !== undefined && message.targetPortal !== '') { + writer.uint32(10).string(message.targetPortal); + } + if (message.iqn !== undefined && message.iqn !== '') { + writer.uint32(18).string(message.iqn); + } + if (message.lun !== undefined && message.lun !== 0) { + writer.uint32(24).int32(message.lun); + } + if (message.iscsiInterface !== undefined && message.iscsiInterface !== '') { + writer.uint32(34).string(message.iscsiInterface); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(42).string(message.fsType); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(48).bool(message.readOnly); + } + for (const v of message.portals) { + writer.uint32(58).string(v!); + } + if (message.chapAuthDiscovery !== undefined && message.chapAuthDiscovery !== false) { + writer.uint32(64).bool(message.chapAuthDiscovery); + } + if (message.chapAuthSession !== undefined && message.chapAuthSession !== false) { + writer.uint32(88).bool(message.chapAuthSession); + } + if (message.secretRef !== undefined) { + LocalObjectReference.encode(message.secretRef, writer.uint32(82).fork()).join(); + } + if (message.initiatorName !== undefined && message.initiatorName !== '') { + writer.uint32(98).string(message.initiatorName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ISCSIVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseISCSIVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.targetPortal = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.iqn = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.lun = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.iscsiInterface = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.portals.push(reader.string()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.chapAuthDiscovery = reader.bool(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + + message.chapAuthSession = reader.bool(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.secretRef = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.initiatorName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ISCSIVolumeSource { + return { + targetPortal: isSet(object.targetPortal) ? globalThis.String(object.targetPortal) : '', + iqn: isSet(object.iqn) ? globalThis.String(object.iqn) : '', + lun: isSet(object.lun) ? globalThis.Number(object.lun) : 0, + iscsiInterface: isSet(object.iscsiInterface) ? globalThis.String(object.iscsiInterface) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + portals: globalThis.Array.isArray(object?.portals) + ? object.portals.map((e: any) => globalThis.String(e)) + : [], + chapAuthDiscovery: isSet(object.chapAuthDiscovery) + ? globalThis.Boolean(object.chapAuthDiscovery) + : false, + chapAuthSession: isSet(object.chapAuthSession) + ? globalThis.Boolean(object.chapAuthSession) + : false, + secretRef: isSet(object.secretRef) ? LocalObjectReference.fromJSON(object.secretRef) : undefined, + initiatorName: isSet(object.initiatorName) ? globalThis.String(object.initiatorName) : '', + }; + }, + + toJSON(message: ISCSIVolumeSource): unknown { + const obj: any = {}; + if (message.targetPortal !== undefined && message.targetPortal !== '') { + obj.targetPortal = message.targetPortal; + } + if (message.iqn !== undefined && message.iqn !== '') { + obj.iqn = message.iqn; + } + if (message.lun !== undefined && message.lun !== 0) { + obj.lun = Math.round(message.lun); + } + if (message.iscsiInterface !== undefined && message.iscsiInterface !== '') { + obj.iscsiInterface = message.iscsiInterface; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.portals?.length) { + obj.portals = message.portals; + } + if (message.chapAuthDiscovery !== undefined && message.chapAuthDiscovery !== false) { + obj.chapAuthDiscovery = message.chapAuthDiscovery; + } + if (message.chapAuthSession !== undefined && message.chapAuthSession !== false) { + obj.chapAuthSession = message.chapAuthSession; + } + if (message.secretRef !== undefined) { + obj.secretRef = LocalObjectReference.toJSON(message.secretRef); + } + if (message.initiatorName !== undefined && message.initiatorName !== '') { + obj.initiatorName = message.initiatorName; + } + return obj; + }, + + create, I>>(base?: I): ISCSIVolumeSource { + return ISCSIVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ISCSIVolumeSource { + const message = createBaseISCSIVolumeSource(); + message.targetPortal = object.targetPortal ?? ''; + message.iqn = object.iqn ?? ''; + message.lun = object.lun ?? 0; + message.iscsiInterface = object.iscsiInterface ?? ''; + message.fsType = object.fsType ?? ''; + message.readOnly = object.readOnly ?? false; + message.portals = object.portals?.map((e) => e) || []; + message.chapAuthDiscovery = object.chapAuthDiscovery ?? false; + message.chapAuthSession = object.chapAuthSession ?? false; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? LocalObjectReference.fromPartial(object.secretRef) + : undefined; + message.initiatorName = object.initiatorName ?? ''; + return message; + }, +}; + +function createBaseImageVolumeSource(): ImageVolumeSource { + return { reference: '', pullPolicy: '' }; +} + +export const ImageVolumeSource: MessageFns = { + encode(message: ImageVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reference !== undefined && message.reference !== '') { + writer.uint32(10).string(message.reference); + } + if (message.pullPolicy !== undefined && message.pullPolicy !== '') { + writer.uint32(18).string(message.pullPolicy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ImageVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseImageVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.reference = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.pullPolicy = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ImageVolumeSource { + return { + reference: isSet(object.reference) ? globalThis.String(object.reference) : '', + pullPolicy: isSet(object.pullPolicy) ? globalThis.String(object.pullPolicy) : '', + }; + }, + + toJSON(message: ImageVolumeSource): unknown { + const obj: any = {}; + if (message.reference !== undefined && message.reference !== '') { + obj.reference = message.reference; + } + if (message.pullPolicy !== undefined && message.pullPolicy !== '') { + obj.pullPolicy = message.pullPolicy; + } + return obj; + }, + + create, I>>(base?: I): ImageVolumeSource { + return ImageVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ImageVolumeSource { + const message = createBaseImageVolumeSource(); + message.reference = object.reference ?? ''; + message.pullPolicy = object.pullPolicy ?? ''; + return message; + }, +}; + +function createBaseImageVolumeStatus(): ImageVolumeStatus { + return { imageRef: '' }; +} + +export const ImageVolumeStatus: MessageFns = { + encode(message: ImageVolumeStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.imageRef !== undefined && message.imageRef !== '') { + writer.uint32(10).string(message.imageRef); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ImageVolumeStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseImageVolumeStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.imageRef = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ImageVolumeStatus { + return { imageRef: isSet(object.imageRef) ? globalThis.String(object.imageRef) : '' }; + }, + + toJSON(message: ImageVolumeStatus): unknown { + const obj: any = {}; + if (message.imageRef !== undefined && message.imageRef !== '') { + obj.imageRef = message.imageRef; + } + return obj; + }, + + create, I>>(base?: I): ImageVolumeStatus { + return ImageVolumeStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ImageVolumeStatus { + const message = createBaseImageVolumeStatus(); + message.imageRef = object.imageRef ?? ''; + return message; + }, +}; + +function createBaseKeyToPath(): KeyToPath { + return { key: '', path: '', mode: 0, user: 0 }; +} + +export const KeyToPath: MessageFns = { + encode(message: KeyToPath, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined && message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.path !== undefined && message.path !== '') { + writer.uint32(18).string(message.path); + } + if (message.mode !== undefined && message.mode !== 0) { + writer.uint32(24).int32(message.mode); + } + if (message.user !== undefined && message.user !== 0) { + writer.uint32(32).int64(message.user); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeyToPath { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyToPath(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.mode = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.user = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): KeyToPath { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + path: isSet(object.path) ? globalThis.String(object.path) : '', + mode: isSet(object.mode) ? globalThis.Number(object.mode) : 0, + user: isSet(object.user) ? globalThis.Number(object.user) : 0, + }; + }, + + toJSON(message: KeyToPath): unknown { + const obj: any = {}; + if (message.key !== undefined && message.key !== '') { + obj.key = message.key; + } + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.mode !== undefined && message.mode !== 0) { + obj.mode = Math.round(message.mode); + } + if (message.user !== undefined && message.user !== 0) { + obj.user = Math.round(message.user); + } + return obj; + }, + + create, I>>(base?: I): KeyToPath { + return KeyToPath.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeyToPath { + const message = createBaseKeyToPath(); + message.key = object.key ?? ''; + message.path = object.path ?? ''; + message.mode = object.mode ?? 0; + message.user = object.user ?? 0; + return message; + }, +}; + +function createBaseLifecycle(): Lifecycle { + return { postStart: undefined, preStop: undefined, stopSignal: '' }; +} + +export const Lifecycle: MessageFns = { + encode(message: Lifecycle, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.postStart !== undefined) { + LifecycleHandler.encode(message.postStart, writer.uint32(10).fork()).join(); + } + if (message.preStop !== undefined) { + LifecycleHandler.encode(message.preStop, writer.uint32(18).fork()).join(); + } + if (message.stopSignal !== undefined && message.stopSignal !== '') { + writer.uint32(26).string(message.stopSignal); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Lifecycle { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLifecycle(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.postStart = LifecycleHandler.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.preStop = LifecycleHandler.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.stopSignal = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Lifecycle { + return { + postStart: isSet(object.postStart) ? LifecycleHandler.fromJSON(object.postStart) : undefined, + preStop: isSet(object.preStop) ? LifecycleHandler.fromJSON(object.preStop) : undefined, + stopSignal: isSet(object.stopSignal) ? globalThis.String(object.stopSignal) : '', + }; + }, + + toJSON(message: Lifecycle): unknown { + const obj: any = {}; + if (message.postStart !== undefined) { + obj.postStart = LifecycleHandler.toJSON(message.postStart); + } + if (message.preStop !== undefined) { + obj.preStop = LifecycleHandler.toJSON(message.preStop); + } + if (message.stopSignal !== undefined && message.stopSignal !== '') { + obj.stopSignal = message.stopSignal; + } + return obj; + }, + + create, I>>(base?: I): Lifecycle { + return Lifecycle.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Lifecycle { + const message = createBaseLifecycle(); + message.postStart = + object.postStart !== undefined && object.postStart !== null + ? LifecycleHandler.fromPartial(object.postStart) + : undefined; + message.preStop = + object.preStop !== undefined && object.preStop !== null + ? LifecycleHandler.fromPartial(object.preStop) + : undefined; + message.stopSignal = object.stopSignal ?? ''; + return message; + }, +}; + +function createBaseLifecycleHandler(): LifecycleHandler { + return { exec: undefined, httpGet: undefined, tcpSocket: undefined, sleep: undefined }; +} + +export const LifecycleHandler: MessageFns = { + encode(message: LifecycleHandler, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exec !== undefined) { + ExecAction.encode(message.exec, writer.uint32(10).fork()).join(); + } + if (message.httpGet !== undefined) { + HTTPGetAction.encode(message.httpGet, writer.uint32(18).fork()).join(); + } + if (message.tcpSocket !== undefined) { + TCPSocketAction.encode(message.tcpSocket, writer.uint32(26).fork()).join(); + } + if (message.sleep !== undefined) { + SleepAction.encode(message.sleep, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LifecycleHandler { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLifecycleHandler(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.exec = ExecAction.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.httpGet = HTTPGetAction.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.tcpSocket = TCPSocketAction.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.sleep = SleepAction.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LifecycleHandler { + return { + exec: isSet(object.exec) ? ExecAction.fromJSON(object.exec) : undefined, + httpGet: isSet(object.httpGet) ? HTTPGetAction.fromJSON(object.httpGet) : undefined, + tcpSocket: isSet(object.tcpSocket) ? TCPSocketAction.fromJSON(object.tcpSocket) : undefined, + sleep: isSet(object.sleep) ? SleepAction.fromJSON(object.sleep) : undefined, + }; + }, + + toJSON(message: LifecycleHandler): unknown { + const obj: any = {}; + if (message.exec !== undefined) { + obj.exec = ExecAction.toJSON(message.exec); + } + if (message.httpGet !== undefined) { + obj.httpGet = HTTPGetAction.toJSON(message.httpGet); + } + if (message.tcpSocket !== undefined) { + obj.tcpSocket = TCPSocketAction.toJSON(message.tcpSocket); + } + if (message.sleep !== undefined) { + obj.sleep = SleepAction.toJSON(message.sleep); + } + return obj; + }, + + create, I>>(base?: I): LifecycleHandler { + return LifecycleHandler.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LifecycleHandler { + const message = createBaseLifecycleHandler(); + message.exec = + object.exec !== undefined && object.exec !== null + ? ExecAction.fromPartial(object.exec) + : undefined; + message.httpGet = + object.httpGet !== undefined && object.httpGet !== null + ? HTTPGetAction.fromPartial(object.httpGet) + : undefined; + message.tcpSocket = + object.tcpSocket !== undefined && object.tcpSocket !== null + ? TCPSocketAction.fromPartial(object.tcpSocket) + : undefined; + message.sleep = + object.sleep !== undefined && object.sleep !== null + ? SleepAction.fromPartial(object.sleep) + : undefined; + return message; + }, +}; + +function createBaseLimitRange(): LimitRange { + return { metadata: undefined, spec: undefined }; +} + +export const LimitRange: MessageFns = { + encode(message: LimitRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + LimitRangeSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LimitRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = LimitRangeSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LimitRange { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? LimitRangeSpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: LimitRange): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = LimitRangeSpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>(base?: I): LimitRange { + return LimitRange.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LimitRange { + const message = createBaseLimitRange(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? LimitRangeSpec.fromPartial(object.spec) + : undefined; + return message; + }, +}; + +function createBaseLimitRangeItem(): LimitRangeItem { + return { type: '', max: {}, min: {}, default: {}, defaultRequest: {}, maxLimitRequestRatio: {} }; +} + +export const LimitRangeItem: MessageFns = { + encode(message: LimitRangeItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + globalThis.Object.entries(message.max).forEach(([key, value]: [string, Quantity]) => { + LimitRangeItem_MaxEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); + }); + globalThis.Object.entries(message.min).forEach(([key, value]: [string, Quantity]) => { + LimitRangeItem_MinEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); + }); + globalThis.Object.entries(message.default).forEach(([key, value]: [string, Quantity]) => { + LimitRangeItem_DefaultEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join(); + }); + globalThis.Object.entries(message.defaultRequest).forEach(([key, value]: [string, Quantity]) => { + LimitRangeItem_DefaultRequestEntry.encode( + { key: key as any, value }, + writer.uint32(42).fork(), + ).join(); + }); + globalThis.Object.entries(message.maxLimitRequestRatio).forEach( + ([key, value]: [string, Quantity]) => { + LimitRangeItem_MaxLimitRequestRatioEntry.encode( + { key: key as any, value }, + writer.uint32(50).fork(), + ).join(); + }, + ); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LimitRangeItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitRangeItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = LimitRangeItem_MaxEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.max[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + const entry3 = LimitRangeItem_MinEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.min[entry3.key] = entry3.value; + } + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + const entry4 = LimitRangeItem_DefaultEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.default[entry4.key] = entry4.value; + } + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + const entry5 = LimitRangeItem_DefaultRequestEntry.decode(reader, reader.uint32()); + if (entry5.value !== undefined) { + message.defaultRequest[entry5.key] = entry5.value; + } + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + const entry6 = LimitRangeItem_MaxLimitRequestRatioEntry.decode( + reader, + reader.uint32(), + ); + if (entry6.value !== undefined) { + message.maxLimitRequestRatio[entry6.key] = entry6.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LimitRangeItem { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + max: isObject(object.max) + ? (globalThis.Object.entries(object.max) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + min: isObject(object.min) + ? (globalThis.Object.entries(object.min) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + default: isObject(object.default) + ? (globalThis.Object.entries(object.default) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + defaultRequest: isObject(object.defaultRequest) + ? (globalThis.Object.entries(object.defaultRequest) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + maxLimitRequestRatio: isObject(object.maxLimitRequestRatio) + ? (globalThis.Object.entries(object.maxLimitRequestRatio) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: LimitRangeItem): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.max) { + const entries = globalThis.Object.entries(message.max) as [string, Quantity][]; + if (entries.length > 0) { + obj.max = {}; + entries.forEach(([k, v]) => { + obj.max[k] = Quantity.toJSON(v); + }); + } + } + if (message.min) { + const entries = globalThis.Object.entries(message.min) as [string, Quantity][]; + if (entries.length > 0) { + obj.min = {}; + entries.forEach(([k, v]) => { + obj.min[k] = Quantity.toJSON(v); + }); + } + } + if (message.default) { + const entries = globalThis.Object.entries(message.default) as [string, Quantity][]; + if (entries.length > 0) { + obj.default = {}; + entries.forEach(([k, v]) => { + obj.default[k] = Quantity.toJSON(v); + }); + } + } + if (message.defaultRequest) { + const entries = globalThis.Object.entries(message.defaultRequest) as [string, Quantity][]; + if (entries.length > 0) { + obj.defaultRequest = {}; + entries.forEach(([k, v]) => { + obj.defaultRequest[k] = Quantity.toJSON(v); + }); + } + } + if (message.maxLimitRequestRatio) { + const entries = globalThis.Object.entries(message.maxLimitRequestRatio) as [string, Quantity][]; + if (entries.length > 0) { + obj.maxLimitRequestRatio = {}; + entries.forEach(([k, v]) => { + obj.maxLimitRequestRatio[k] = Quantity.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): LimitRangeItem { + return LimitRangeItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LimitRangeItem { + const message = createBaseLimitRangeItem(); + message.type = object.type ?? ''; + message.max = (globalThis.Object.entries(object.max ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + message.min = (globalThis.Object.entries(object.min ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + message.default = (globalThis.Object.entries(object.default ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + message.defaultRequest = ( + globalThis.Object.entries(object.defaultRequest ?? {}) as [string, Quantity][] + ).reduce((acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, {}); + message.maxLimitRequestRatio = ( + globalThis.Object.entries(object.maxLimitRequestRatio ?? {}) as [string, Quantity][] + ).reduce((acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseLimitRangeItem_MaxEntry(): LimitRangeItem_MaxEntry { + return { key: '', value: undefined }; +} + +export const LimitRangeItem_MaxEntry: MessageFns = { + encode(message: LimitRangeItem_MaxEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LimitRangeItem_MaxEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitRangeItem_MaxEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LimitRangeItem_MaxEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: LimitRangeItem_MaxEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): LimitRangeItem_MaxEntry { + return LimitRangeItem_MaxEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): LimitRangeItem_MaxEntry { + const message = createBaseLimitRangeItem_MaxEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseLimitRangeItem_MinEntry(): LimitRangeItem_MinEntry { + return { key: '', value: undefined }; +} + +export const LimitRangeItem_MinEntry: MessageFns = { + encode(message: LimitRangeItem_MinEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LimitRangeItem_MinEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitRangeItem_MinEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LimitRangeItem_MinEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: LimitRangeItem_MinEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): LimitRangeItem_MinEntry { + return LimitRangeItem_MinEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): LimitRangeItem_MinEntry { + const message = createBaseLimitRangeItem_MinEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseLimitRangeItem_DefaultEntry(): LimitRangeItem_DefaultEntry { + return { key: '', value: undefined }; +} + +export const LimitRangeItem_DefaultEntry: MessageFns = { + encode(message: LimitRangeItem_DefaultEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LimitRangeItem_DefaultEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitRangeItem_DefaultEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LimitRangeItem_DefaultEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: LimitRangeItem_DefaultEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): LimitRangeItem_DefaultEntry { + return LimitRangeItem_DefaultEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): LimitRangeItem_DefaultEntry { + const message = createBaseLimitRangeItem_DefaultEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseLimitRangeItem_DefaultRequestEntry(): LimitRangeItem_DefaultRequestEntry { + return { key: '', value: undefined }; +} + +export const LimitRangeItem_DefaultRequestEntry: MessageFns = { + encode( + message: LimitRangeItem_DefaultRequestEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LimitRangeItem_DefaultRequestEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitRangeItem_DefaultRequestEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LimitRangeItem_DefaultRequestEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: LimitRangeItem_DefaultRequestEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): LimitRangeItem_DefaultRequestEntry { + return LimitRangeItem_DefaultRequestEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): LimitRangeItem_DefaultRequestEntry { + const message = createBaseLimitRangeItem_DefaultRequestEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseLimitRangeItem_MaxLimitRequestRatioEntry(): LimitRangeItem_MaxLimitRequestRatioEntry { + return { key: '', value: undefined }; +} + +export const LimitRangeItem_MaxLimitRequestRatioEntry: MessageFns = + { + encode( + message: LimitRangeItem_MaxLimitRequestRatioEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LimitRangeItem_MaxLimitRequestRatioEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitRangeItem_MaxLimitRequestRatioEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LimitRangeItem_MaxLimitRequestRatioEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: LimitRangeItem_MaxLimitRequestRatioEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): LimitRangeItem_MaxLimitRequestRatioEntry { + return LimitRangeItem_MaxLimitRequestRatioEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): LimitRangeItem_MaxLimitRequestRatioEntry { + const message = createBaseLimitRangeItem_MaxLimitRequestRatioEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, + }; + +function createBaseLimitRangeList(): LimitRangeList { + return { metadata: undefined, items: [] }; +} + +export const LimitRangeList: MessageFns = { + encode(message: LimitRangeList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + LimitRange.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LimitRangeList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitRangeList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(LimitRange.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LimitRangeList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => LimitRange.fromJSON(e)) + : [], + }; + }, + + toJSON(message: LimitRangeList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => LimitRange.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LimitRangeList { + return LimitRangeList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LimitRangeList { + const message = createBaseLimitRangeList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => LimitRange.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseLimitRangeSpec(): LimitRangeSpec { + return { limits: [] }; +} + +export const LimitRangeSpec: MessageFns = { + encode(message: LimitRangeSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.limits) { + LimitRangeItem.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LimitRangeSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitRangeSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.limits.push(LimitRangeItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LimitRangeSpec { + return { + limits: globalThis.Array.isArray(object?.limits) + ? object.limits.map((e: any) => LimitRangeItem.fromJSON(e)) + : [], + }; + }, + + toJSON(message: LimitRangeSpec): unknown { + const obj: any = {}; + if (message.limits?.length) { + obj.limits = message.limits.map((e) => LimitRangeItem.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LimitRangeSpec { + return LimitRangeSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LimitRangeSpec { + const message = createBaseLimitRangeSpec(); + message.limits = object.limits?.map((e) => LimitRangeItem.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseLinuxContainerUser(): LinuxContainerUser { + return { uid: 0, gid: 0, supplementalGroups: [] }; +} + +export const LinuxContainerUser: MessageFns = { + encode(message: LinuxContainerUser, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.uid !== undefined && message.uid !== 0) { + writer.uint32(8).int64(message.uid); + } + if (message.gid !== undefined && message.gid !== 0) { + writer.uint32(16).int64(message.gid); + } + for (const v of message.supplementalGroups) { + writer.uint32(24).int64(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LinuxContainerUser { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLinuxContainerUser(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.uid = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.gid = longToNumber(reader.int64()); + continue; + } + case 3: { + if (tag === 24) { + message.supplementalGroups.push(longToNumber(reader.int64())); + + continue; + } + + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supplementalGroups.push(longToNumber(reader.int64())); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LinuxContainerUser { + return { + uid: isSet(object.uid) ? globalThis.Number(object.uid) : 0, + gid: isSet(object.gid) ? globalThis.Number(object.gid) : 0, + supplementalGroups: globalThis.Array.isArray(object?.supplementalGroups) + ? object.supplementalGroups.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: LinuxContainerUser): unknown { + const obj: any = {}; + if (message.uid !== undefined && message.uid !== 0) { + obj.uid = Math.round(message.uid); + } + if (message.gid !== undefined && message.gid !== 0) { + obj.gid = Math.round(message.gid); + } + if (message.supplementalGroups?.length) { + obj.supplementalGroups = message.supplementalGroups.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): LinuxContainerUser { + return LinuxContainerUser.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LinuxContainerUser { + const message = createBaseLinuxContainerUser(); + message.uid = object.uid ?? 0; + message.gid = object.gid ?? 0; + message.supplementalGroups = object.supplementalGroups?.map((e) => e) || []; + return message; + }, +}; + +function createBaseList(): List { + return { metadata: undefined, items: [] }; +} + +export const List: MessageFns = { + encode(message: List, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + RawExtension.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): List { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(RawExtension.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): List { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => RawExtension.fromJSON(e)) + : [], + }; + }, + + toJSON(message: List): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => RawExtension.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): List { + return List.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): List { + const message = createBaseList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => RawExtension.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseLoadBalancerIngress(): LoadBalancerIngress { + return { ip: '', hostname: '', ipMode: '', ports: [] }; +} + +export const LoadBalancerIngress: MessageFns = { + encode(message: LoadBalancerIngress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ip !== undefined && message.ip !== '') { + writer.uint32(10).string(message.ip); + } + if (message.hostname !== undefined && message.hostname !== '') { + writer.uint32(18).string(message.hostname); + } + if (message.ipMode !== undefined && message.ipMode !== '') { + writer.uint32(26).string(message.ipMode); + } + for (const v of message.ports) { + PortStatus.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LoadBalancerIngress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLoadBalancerIngress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ip = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hostname = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.ipMode = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.ports.push(PortStatus.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LoadBalancerIngress { + return { + ip: isSet(object.ip) ? globalThis.String(object.ip) : '', + hostname: isSet(object.hostname) ? globalThis.String(object.hostname) : '', + ipMode: isSet(object.ipMode) ? globalThis.String(object.ipMode) : '', + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => PortStatus.fromJSON(e)) + : [], + }; + }, + + toJSON(message: LoadBalancerIngress): unknown { + const obj: any = {}; + if (message.ip !== undefined && message.ip !== '') { + obj.ip = message.ip; + } + if (message.hostname !== undefined && message.hostname !== '') { + obj.hostname = message.hostname; + } + if (message.ipMode !== undefined && message.ipMode !== '') { + obj.ipMode = message.ipMode; + } + if (message.ports?.length) { + obj.ports = message.ports.map((e) => PortStatus.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LoadBalancerIngress { + return LoadBalancerIngress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LoadBalancerIngress { + const message = createBaseLoadBalancerIngress(); + message.ip = object.ip ?? ''; + message.hostname = object.hostname ?? ''; + message.ipMode = object.ipMode ?? ''; + message.ports = object.ports?.map((e) => PortStatus.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseLoadBalancerStatus(): LoadBalancerStatus { + return { ingress: [] }; +} + +export const LoadBalancerStatus: MessageFns = { + encode(message: LoadBalancerStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ingress) { + LoadBalancerIngress.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LoadBalancerStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLoadBalancerStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ingress.push(LoadBalancerIngress.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LoadBalancerStatus { + return { + ingress: globalThis.Array.isArray(object?.ingress) + ? object.ingress.map((e: any) => LoadBalancerIngress.fromJSON(e)) + : [], + }; + }, + + toJSON(message: LoadBalancerStatus): unknown { + const obj: any = {}; + if (message.ingress?.length) { + obj.ingress = message.ingress.map((e) => LoadBalancerIngress.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LoadBalancerStatus { + return LoadBalancerStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LoadBalancerStatus { + const message = createBaseLoadBalancerStatus(); + message.ingress = object.ingress?.map((e) => LoadBalancerIngress.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseLocalObjectReference(): LocalObjectReference { + return { name: '' }; +} + +export const LocalObjectReference: MessageFns = { + encode(message: LocalObjectReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LocalObjectReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLocalObjectReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LocalObjectReference { + return { name: isSet(object.name) ? globalThis.String(object.name) : '' }; + }, + + toJSON(message: LocalObjectReference): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): LocalObjectReference { + return LocalObjectReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LocalObjectReference { + const message = createBaseLocalObjectReference(); + message.name = object.name ?? ''; + return message; + }, +}; + +function createBaseLocalVolumeSource(): LocalVolumeSource { + return { path: '', fsType: '' }; +} + +export const LocalVolumeSource: MessageFns = { + encode(message: LocalVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined && message.path !== '') { + writer.uint32(10).string(message.path); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(18).string(message.fsType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LocalVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLocalVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fsType = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LocalVolumeSource { + return { + path: isSet(object.path) ? globalThis.String(object.path) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + }; + }, + + toJSON(message: LocalVolumeSource): unknown { + const obj: any = {}; + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + return obj; + }, + + create, I>>(base?: I): LocalVolumeSource { + return LocalVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LocalVolumeSource { + const message = createBaseLocalVolumeSource(); + message.path = object.path ?? ''; + message.fsType = object.fsType ?? ''; + return message; + }, +}; + +function createBaseModifyVolumeStatus(): ModifyVolumeStatus { + return { targetVolumeAttributesClassName: '', status: '' }; +} + +export const ModifyVolumeStatus: MessageFns = { + encode(message: ModifyVolumeStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if ( + message.targetVolumeAttributesClassName !== undefined && + message.targetVolumeAttributesClassName !== '' + ) { + writer.uint32(10).string(message.targetVolumeAttributesClassName); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModifyVolumeStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModifyVolumeStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.targetVolumeAttributesClassName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ModifyVolumeStatus { + return { + targetVolumeAttributesClassName: isSet(object.targetVolumeAttributesClassName) + ? globalThis.String(object.targetVolumeAttributesClassName) + : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + }; + }, + + toJSON(message: ModifyVolumeStatus): unknown { + const obj: any = {}; + if ( + message.targetVolumeAttributesClassName !== undefined && + message.targetVolumeAttributesClassName !== '' + ) { + obj.targetVolumeAttributesClassName = message.targetVolumeAttributesClassName; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + return obj; + }, + + create, I>>(base?: I): ModifyVolumeStatus { + return ModifyVolumeStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModifyVolumeStatus { + const message = createBaseModifyVolumeStatus(); + message.targetVolumeAttributesClassName = object.targetVolumeAttributesClassName ?? ''; + message.status = object.status ?? ''; + return message; + }, +}; + +function createBaseNFSVolumeSource(): NFSVolumeSource { + return { server: '', path: '', readOnly: false }; +} + +export const NFSVolumeSource: MessageFns = { + encode(message: NFSVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.server !== undefined && message.server !== '') { + writer.uint32(10).string(message.server); + } + if (message.path !== undefined && message.path !== '') { + writer.uint32(18).string(message.path); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(24).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NFSVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNFSVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.server = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NFSVolumeSource { + return { + server: isSet(object.server) ? globalThis.String(object.server) : '', + path: isSet(object.path) ? globalThis.String(object.path) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: NFSVolumeSource): unknown { + const obj: any = {}; + if (message.server !== undefined && message.server !== '') { + obj.server = message.server; + } + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>(base?: I): NFSVolumeSource { + return NFSVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NFSVolumeSource { + const message = createBaseNFSVolumeSource(); + message.server = object.server ?? ''; + message.path = object.path ?? ''; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBaseNamespace(): Namespace { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const Namespace: MessageFns = { + encode(message: Namespace, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + NamespaceSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + NamespaceStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Namespace { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNamespace(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = NamespaceSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = NamespaceStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Namespace { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? NamespaceSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? NamespaceStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: Namespace): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = NamespaceSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = NamespaceStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): Namespace { + return Namespace.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Namespace { + const message = createBaseNamespace(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? NamespaceSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? NamespaceStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseNamespaceCondition(): NamespaceCondition { + return { type: '', status: '', lastTransitionTime: undefined, reason: '', message: '' }; +} + +export const NamespaceCondition: MessageFns = { + encode(message: NamespaceCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(34).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(42).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(50).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NamespaceCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNamespaceCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.reason = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NamespaceCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: NamespaceCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): NamespaceCondition { + return NamespaceCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NamespaceCondition { + const message = createBaseNamespaceCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseNamespaceList(): NamespaceList { + return { metadata: undefined, items: [] }; +} + +export const NamespaceList: MessageFns = { + encode(message: NamespaceList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Namespace.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NamespaceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNamespaceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Namespace.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NamespaceList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Namespace.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NamespaceList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Namespace.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): NamespaceList { + return NamespaceList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NamespaceList { + const message = createBaseNamespaceList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Namespace.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNamespaceSpec(): NamespaceSpec { + return { finalizers: [] }; +} + +export const NamespaceSpec: MessageFns = { + encode(message: NamespaceSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.finalizers) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NamespaceSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNamespaceSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.finalizers.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NamespaceSpec { + return { + finalizers: globalThis.Array.isArray(object?.finalizers) + ? object.finalizers.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: NamespaceSpec): unknown { + const obj: any = {}; + if (message.finalizers?.length) { + obj.finalizers = message.finalizers; + } + return obj; + }, + + create, I>>(base?: I): NamespaceSpec { + return NamespaceSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NamespaceSpec { + const message = createBaseNamespaceSpec(); + message.finalizers = object.finalizers?.map((e) => e) || []; + return message; + }, +}; + +function createBaseNamespaceStatus(): NamespaceStatus { + return { phase: '', conditions: [] }; +} + +export const NamespaceStatus: MessageFns = { + encode(message: NamespaceStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.phase !== undefined && message.phase !== '') { + writer.uint32(10).string(message.phase); + } + for (const v of message.conditions) { + NamespaceCondition.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NamespaceStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNamespaceStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.phase = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.conditions.push(NamespaceCondition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NamespaceStatus { + return { + phase: isSet(object.phase) ? globalThis.String(object.phase) : '', + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => NamespaceCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NamespaceStatus): unknown { + const obj: any = {}; + if (message.phase !== undefined && message.phase !== '') { + obj.phase = message.phase; + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => NamespaceCondition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): NamespaceStatus { + return NamespaceStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NamespaceStatus { + const message = createBaseNamespaceStatus(); + message.phase = object.phase ?? ''; + message.conditions = object.conditions?.map((e) => NamespaceCondition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNode(): Node { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const Node: MessageFns = { + encode(message: Node, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + NodeSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + NodeStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Node { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = NodeSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = NodeStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Node { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? NodeSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? NodeStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: Node): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = NodeSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = NodeStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): Node { + return Node.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Node { + const message = createBaseNode(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null ? NodeSpec.fromPartial(object.spec) : undefined; + message.status = + object.status !== undefined && object.status !== null + ? NodeStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseNodeAddress(): NodeAddress { + return { type: '', address: '' }; +} + +export const NodeAddress: MessageFns = { + encode(message: NodeAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.address !== undefined && message.address !== '') { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.address = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeAddress { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + address: isSet(object.address) ? globalThis.String(object.address) : '', + }; + }, + + toJSON(message: NodeAddress): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.address !== undefined && message.address !== '') { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): NodeAddress { + return NodeAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeAddress { + const message = createBaseNodeAddress(); + message.type = object.type ?? ''; + message.address = object.address ?? ''; + return message; + }, +}; + +function createBaseNodeAffinity(): NodeAffinity { + return { + requiredDuringSchedulingIgnoredDuringExecution: undefined, + preferredDuringSchedulingIgnoredDuringExecution: [], + }; +} + +export const NodeAffinity: MessageFns = { + encode(message: NodeAffinity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.requiredDuringSchedulingIgnoredDuringExecution !== undefined) { + NodeSelector.encode( + message.requiredDuringSchedulingIgnoredDuringExecution, + writer.uint32(10).fork(), + ).join(); + } + for (const v of message.preferredDuringSchedulingIgnoredDuringExecution) { + PreferredSchedulingTerm.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeAffinity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeAffinity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.requiredDuringSchedulingIgnoredDuringExecution = NodeSelector.decode( + reader, + reader.uint32(), + ); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.preferredDuringSchedulingIgnoredDuringExecution.push( + PreferredSchedulingTerm.decode(reader, reader.uint32()), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeAffinity { + return { + requiredDuringSchedulingIgnoredDuringExecution: isSet( + object.requiredDuringSchedulingIgnoredDuringExecution, + ) + ? NodeSelector.fromJSON(object.requiredDuringSchedulingIgnoredDuringExecution) + : undefined, + preferredDuringSchedulingIgnoredDuringExecution: globalThis.Array.isArray( + object?.preferredDuringSchedulingIgnoredDuringExecution, + ) + ? object.preferredDuringSchedulingIgnoredDuringExecution.map((e: any) => + PreferredSchedulingTerm.fromJSON(e), + ) + : [], + }; + }, + + toJSON(message: NodeAffinity): unknown { + const obj: any = {}; + if (message.requiredDuringSchedulingIgnoredDuringExecution !== undefined) { + obj.requiredDuringSchedulingIgnoredDuringExecution = NodeSelector.toJSON( + message.requiredDuringSchedulingIgnoredDuringExecution, + ); + } + if (message.preferredDuringSchedulingIgnoredDuringExecution?.length) { + obj.preferredDuringSchedulingIgnoredDuringExecution = + message.preferredDuringSchedulingIgnoredDuringExecution.map((e) => + PreferredSchedulingTerm.toJSON(e), + ); + } + return obj; + }, + + create, I>>(base?: I): NodeAffinity { + return NodeAffinity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeAffinity { + const message = createBaseNodeAffinity(); + message.requiredDuringSchedulingIgnoredDuringExecution = + object.requiredDuringSchedulingIgnoredDuringExecution !== undefined && + object.requiredDuringSchedulingIgnoredDuringExecution !== null + ? NodeSelector.fromPartial(object.requiredDuringSchedulingIgnoredDuringExecution) + : undefined; + message.preferredDuringSchedulingIgnoredDuringExecution = + object.preferredDuringSchedulingIgnoredDuringExecution?.map((e) => + PreferredSchedulingTerm.fromPartial(e), + ) || []; + return message; + }, +}; + +function createBaseNodeAllocatableMappedResources(): NodeAllocatableMappedResources { + return { name: '', quantity: undefined }; +} + +export const NodeAllocatableMappedResources: MessageFns = { + encode(message: NodeAllocatableMappedResources, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.quantity !== undefined) { + Quantity.encode(message.quantity, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeAllocatableMappedResources { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeAllocatableMappedResources(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.quantity = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeAllocatableMappedResources { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + quantity: isSet(object.quantity) ? Quantity.fromJSON(object.quantity) : undefined, + }; + }, + + toJSON(message: NodeAllocatableMappedResources): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.quantity !== undefined) { + obj.quantity = Quantity.toJSON(message.quantity); + } + return obj; + }, + + create, I>>( + base?: I, + ): NodeAllocatableMappedResources { + return NodeAllocatableMappedResources.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NodeAllocatableMappedResources { + const message = createBaseNodeAllocatableMappedResources(); + message.name = object.name ?? ''; + message.quantity = + object.quantity !== undefined && object.quantity !== null + ? Quantity.fromPartial(object.quantity) + : undefined; + return message; + }, +}; + +function createBaseNodeAllocatableOverheadResources(): NodeAllocatableOverheadResources { + return { name: '', perPod: undefined, perContainer: undefined }; +} + +export const NodeAllocatableOverheadResources: MessageFns = { + encode( + message: NodeAllocatableOverheadResources, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.perPod !== undefined) { + Quantity.encode(message.perPod, writer.uint32(18).fork()).join(); + } + if (message.perContainer !== undefined) { + Quantity.encode(message.perContainer, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeAllocatableOverheadResources { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeAllocatableOverheadResources(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.perPod = Quantity.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.perContainer = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeAllocatableOverheadResources { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + perPod: isSet(object.perPod) ? Quantity.fromJSON(object.perPod) : undefined, + perContainer: isSet(object.perContainer) ? Quantity.fromJSON(object.perContainer) : undefined, + }; + }, + + toJSON(message: NodeAllocatableOverheadResources): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.perPod !== undefined) { + obj.perPod = Quantity.toJSON(message.perPod); + } + if (message.perContainer !== undefined) { + obj.perContainer = Quantity.toJSON(message.perContainer); + } + return obj; + }, + + create, I>>( + base?: I, + ): NodeAllocatableOverheadResources { + return NodeAllocatableOverheadResources.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NodeAllocatableOverheadResources { + const message = createBaseNodeAllocatableOverheadResources(); + message.name = object.name ?? ''; + message.perPod = + object.perPod !== undefined && object.perPod !== null + ? Quantity.fromPartial(object.perPod) + : undefined; + message.perContainer = + object.perContainer !== undefined && object.perContainer !== null + ? Quantity.fromPartial(object.perContainer) + : undefined; + return message; + }, +}; + +function createBaseNodeAllocatableResourceClaimStatus(): NodeAllocatableResourceClaimStatus { + return { resourceClaimName: '', containers: [], mapping: [], overhead: [] }; +} + +export const NodeAllocatableResourceClaimStatus: MessageFns = { + encode( + message: NodeAllocatableResourceClaimStatus, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.resourceClaimName !== undefined && message.resourceClaimName !== '') { + writer.uint32(10).string(message.resourceClaimName); + } + for (const v of message.containers) { + writer.uint32(18).string(v!); + } + for (const v of message.mapping) { + NodeAllocatableMappedResources.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.overhead) { + NodeAllocatableOverheadResources.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeAllocatableResourceClaimStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeAllocatableResourceClaimStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resourceClaimName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.containers.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.mapping.push(NodeAllocatableMappedResources.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.overhead.push( + NodeAllocatableOverheadResources.decode(reader, reader.uint32()), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeAllocatableResourceClaimStatus { + return { + resourceClaimName: isSet(object.resourceClaimName) + ? globalThis.String(object.resourceClaimName) + : '', + containers: globalThis.Array.isArray(object?.containers) + ? object.containers.map((e: any) => globalThis.String(e)) + : [], + mapping: globalThis.Array.isArray(object?.mapping) + ? object.mapping.map((e: any) => NodeAllocatableMappedResources.fromJSON(e)) + : [], + overhead: globalThis.Array.isArray(object?.overhead) + ? object.overhead.map((e: any) => NodeAllocatableOverheadResources.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NodeAllocatableResourceClaimStatus): unknown { + const obj: any = {}; + if (message.resourceClaimName !== undefined && message.resourceClaimName !== '') { + obj.resourceClaimName = message.resourceClaimName; + } + if (message.containers?.length) { + obj.containers = message.containers; + } + if (message.mapping?.length) { + obj.mapping = message.mapping.map((e) => NodeAllocatableMappedResources.toJSON(e)); + } + if (message.overhead?.length) { + obj.overhead = message.overhead.map((e) => NodeAllocatableOverheadResources.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): NodeAllocatableResourceClaimStatus { + return NodeAllocatableResourceClaimStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NodeAllocatableResourceClaimStatus { + const message = createBaseNodeAllocatableResourceClaimStatus(); + message.resourceClaimName = object.resourceClaimName ?? ''; + message.containers = object.containers?.map((e) => e) || []; + message.mapping = object.mapping?.map((e) => NodeAllocatableMappedResources.fromPartial(e)) || []; + message.overhead = object.overhead?.map((e) => NodeAllocatableOverheadResources.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNodeCondition(): NodeCondition { + return { + type: '', + status: '', + lastHeartbeatTime: undefined, + lastTransitionTime: undefined, + reason: '', + message: '', + }; +} + +export const NodeCondition: MessageFns = { + encode(message: NodeCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastHeartbeatTime !== undefined) { + Time.encode(message.lastHeartbeatTime, writer.uint32(26).fork()).join(); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(34).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(42).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(50).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastHeartbeatTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.reason = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastHeartbeatTime: isSet(object.lastHeartbeatTime) + ? Time.fromJSON(object.lastHeartbeatTime) + : undefined, + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: NodeCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastHeartbeatTime !== undefined) { + obj.lastHeartbeatTime = Time.toJSON(message.lastHeartbeatTime); + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): NodeCondition { + return NodeCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeCondition { + const message = createBaseNodeCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastHeartbeatTime = + object.lastHeartbeatTime !== undefined && object.lastHeartbeatTime !== null + ? Time.fromPartial(object.lastHeartbeatTime) + : undefined; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseNodeConfigSource(): NodeConfigSource { + return { configMap: undefined }; +} + +export const NodeConfigSource: MessageFns = { + encode(message: NodeConfigSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.configMap !== undefined) { + ConfigMapNodeConfigSource.encode(message.configMap, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeConfigSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeConfigSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + + message.configMap = ConfigMapNodeConfigSource.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeConfigSource { + return { + configMap: isSet(object.configMap) + ? ConfigMapNodeConfigSource.fromJSON(object.configMap) + : undefined, + }; + }, + + toJSON(message: NodeConfigSource): unknown { + const obj: any = {}; + if (message.configMap !== undefined) { + obj.configMap = ConfigMapNodeConfigSource.toJSON(message.configMap); + } + return obj; + }, + + create, I>>(base?: I): NodeConfigSource { + return NodeConfigSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeConfigSource { + const message = createBaseNodeConfigSource(); + message.configMap = + object.configMap !== undefined && object.configMap !== null + ? ConfigMapNodeConfigSource.fromPartial(object.configMap) + : undefined; + return message; + }, +}; + +function createBaseNodeConfigStatus(): NodeConfigStatus { + return { assigned: undefined, active: undefined, lastKnownGood: undefined, error: '' }; +} + +export const NodeConfigStatus: MessageFns = { + encode(message: NodeConfigStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.assigned !== undefined) { + NodeConfigSource.encode(message.assigned, writer.uint32(10).fork()).join(); + } + if (message.active !== undefined) { + NodeConfigSource.encode(message.active, writer.uint32(18).fork()).join(); + } + if (message.lastKnownGood !== undefined) { + NodeConfigSource.encode(message.lastKnownGood, writer.uint32(26).fork()).join(); + } + if (message.error !== undefined && message.error !== '') { + writer.uint32(34).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeConfigStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeConfigStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.assigned = NodeConfigSource.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.active = NodeConfigSource.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastKnownGood = NodeConfigSource.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.error = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeConfigStatus { + return { + assigned: isSet(object.assigned) ? NodeConfigSource.fromJSON(object.assigned) : undefined, + active: isSet(object.active) ? NodeConfigSource.fromJSON(object.active) : undefined, + lastKnownGood: isSet(object.lastKnownGood) + ? NodeConfigSource.fromJSON(object.lastKnownGood) + : undefined, + error: isSet(object.error) ? globalThis.String(object.error) : '', + }; + }, + + toJSON(message: NodeConfigStatus): unknown { + const obj: any = {}; + if (message.assigned !== undefined) { + obj.assigned = NodeConfigSource.toJSON(message.assigned); + } + if (message.active !== undefined) { + obj.active = NodeConfigSource.toJSON(message.active); + } + if (message.lastKnownGood !== undefined) { + obj.lastKnownGood = NodeConfigSource.toJSON(message.lastKnownGood); + } + if (message.error !== undefined && message.error !== '') { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): NodeConfigStatus { + return NodeConfigStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeConfigStatus { + const message = createBaseNodeConfigStatus(); + message.assigned = + object.assigned !== undefined && object.assigned !== null + ? NodeConfigSource.fromPartial(object.assigned) + : undefined; + message.active = + object.active !== undefined && object.active !== null + ? NodeConfigSource.fromPartial(object.active) + : undefined; + message.lastKnownGood = + object.lastKnownGood !== undefined && object.lastKnownGood !== null + ? NodeConfigSource.fromPartial(object.lastKnownGood) + : undefined; + message.error = object.error ?? ''; + return message; + }, +}; + +function createBaseNodeDaemonEndpoints(): NodeDaemonEndpoints { + return { kubeletEndpoint: undefined }; +} + +export const NodeDaemonEndpoints: MessageFns = { + encode(message: NodeDaemonEndpoints, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kubeletEndpoint !== undefined) { + DaemonEndpoint.encode(message.kubeletEndpoint, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeDaemonEndpoints { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeDaemonEndpoints(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.kubeletEndpoint = DaemonEndpoint.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeDaemonEndpoints { + return { + kubeletEndpoint: isSet(object.kubeletEndpoint) + ? DaemonEndpoint.fromJSON(object.kubeletEndpoint) + : undefined, + }; + }, + + toJSON(message: NodeDaemonEndpoints): unknown { + const obj: any = {}; + if (message.kubeletEndpoint !== undefined) { + obj.kubeletEndpoint = DaemonEndpoint.toJSON(message.kubeletEndpoint); + } + return obj; + }, + + create, I>>(base?: I): NodeDaemonEndpoints { + return NodeDaemonEndpoints.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeDaemonEndpoints { + const message = createBaseNodeDaemonEndpoints(); + message.kubeletEndpoint = + object.kubeletEndpoint !== undefined && object.kubeletEndpoint !== null + ? DaemonEndpoint.fromPartial(object.kubeletEndpoint) + : undefined; + return message; + }, +}; + +function createBaseNodeFeatures(): NodeFeatures { + return { supplementalGroupsPolicy: false }; +} + +export const NodeFeatures: MessageFns = { + encode(message: NodeFeatures, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.supplementalGroupsPolicy !== undefined && message.supplementalGroupsPolicy !== false) { + writer.uint32(8).bool(message.supplementalGroupsPolicy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeFeatures { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeFeatures(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.supplementalGroupsPolicy = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeFeatures { + return { + supplementalGroupsPolicy: isSet(object.supplementalGroupsPolicy) + ? globalThis.Boolean(object.supplementalGroupsPolicy) + : false, + }; + }, + + toJSON(message: NodeFeatures): unknown { + const obj: any = {}; + if (message.supplementalGroupsPolicy !== undefined && message.supplementalGroupsPolicy !== false) { + obj.supplementalGroupsPolicy = message.supplementalGroupsPolicy; + } + return obj; + }, + + create, I>>(base?: I): NodeFeatures { + return NodeFeatures.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeFeatures { + const message = createBaseNodeFeatures(); + message.supplementalGroupsPolicy = object.supplementalGroupsPolicy ?? false; + return message; + }, +}; + +function createBaseNodeList(): NodeList { + return { metadata: undefined, items: [] }; +} + +export const NodeList: MessageFns = { + encode(message: NodeList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Node.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Node.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NodeList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Node.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): NodeList { + return NodeList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeList { + const message = createBaseNodeList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNodePodPreemptionPolicy(): NodePodPreemptionPolicy { + return { disableResizePreemption: [] }; +} + +export const NodePodPreemptionPolicy: MessageFns = { + encode(message: NodePodPreemptionPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.disableResizePreemption) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodePodPreemptionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodePodPreemptionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.disableResizePreemption.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodePodPreemptionPolicy { + return { + disableResizePreemption: globalThis.Array.isArray(object?.disableResizePreemption) + ? object.disableResizePreemption.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: NodePodPreemptionPolicy): unknown { + const obj: any = {}; + if (message.disableResizePreemption?.length) { + obj.disableResizePreemption = message.disableResizePreemption; + } + return obj; + }, + + create, I>>(base?: I): NodePodPreemptionPolicy { + return NodePodPreemptionPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NodePodPreemptionPolicy { + const message = createBaseNodePodPreemptionPolicy(); + message.disableResizePreemption = object.disableResizePreemption?.map((e) => e) || []; + return message; + }, +}; + +function createBaseNodeProxyOptions(): NodeProxyOptions { + return { path: '' }; +} + +export const NodeProxyOptions: MessageFns = { + encode(message: NodeProxyOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined && message.path !== '') { + writer.uint32(10).string(message.path); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeProxyOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeProxyOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeProxyOptions { + return { path: isSet(object.path) ? globalThis.String(object.path) : '' }; + }, + + toJSON(message: NodeProxyOptions): unknown { + const obj: any = {}; + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + return obj; + }, + + create, I>>(base?: I): NodeProxyOptions { + return NodeProxyOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeProxyOptions { + const message = createBaseNodeProxyOptions(); + message.path = object.path ?? ''; + return message; + }, +}; + +function createBaseNodeRuntimeHandler(): NodeRuntimeHandler { + return { name: '', features: undefined }; +} + +export const NodeRuntimeHandler: MessageFns = { + encode(message: NodeRuntimeHandler, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.features !== undefined) { + NodeRuntimeHandlerFeatures.encode(message.features, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeRuntimeHandler { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeRuntimeHandler(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.features = NodeRuntimeHandlerFeatures.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeRuntimeHandler { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + features: isSet(object.features) + ? NodeRuntimeHandlerFeatures.fromJSON(object.features) + : undefined, + }; + }, + + toJSON(message: NodeRuntimeHandler): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.features !== undefined) { + obj.features = NodeRuntimeHandlerFeatures.toJSON(message.features); + } + return obj; + }, + + create, I>>(base?: I): NodeRuntimeHandler { + return NodeRuntimeHandler.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeRuntimeHandler { + const message = createBaseNodeRuntimeHandler(); + message.name = object.name ?? ''; + message.features = + object.features !== undefined && object.features !== null + ? NodeRuntimeHandlerFeatures.fromPartial(object.features) + : undefined; + return message; + }, +}; + +function createBaseNodeRuntimeHandlerFeatures(): NodeRuntimeHandlerFeatures { + return { recursiveReadOnlyMounts: false, userNamespaces: false }; +} + +export const NodeRuntimeHandlerFeatures: MessageFns = { + encode(message: NodeRuntimeHandlerFeatures, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.recursiveReadOnlyMounts !== undefined && message.recursiveReadOnlyMounts !== false) { + writer.uint32(8).bool(message.recursiveReadOnlyMounts); + } + if (message.userNamespaces !== undefined && message.userNamespaces !== false) { + writer.uint32(16).bool(message.userNamespaces); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeRuntimeHandlerFeatures { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeRuntimeHandlerFeatures(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.recursiveReadOnlyMounts = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.userNamespaces = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeRuntimeHandlerFeatures { + return { + recursiveReadOnlyMounts: isSet(object.recursiveReadOnlyMounts) + ? globalThis.Boolean(object.recursiveReadOnlyMounts) + : false, + userNamespaces: isSet(object.userNamespaces) ? globalThis.Boolean(object.userNamespaces) : false, + }; + }, + + toJSON(message: NodeRuntimeHandlerFeatures): unknown { + const obj: any = {}; + if (message.recursiveReadOnlyMounts !== undefined && message.recursiveReadOnlyMounts !== false) { + obj.recursiveReadOnlyMounts = message.recursiveReadOnlyMounts; + } + if (message.userNamespaces !== undefined && message.userNamespaces !== false) { + obj.userNamespaces = message.userNamespaces; + } + return obj; + }, + + create, I>>( + base?: I, + ): NodeRuntimeHandlerFeatures { + return NodeRuntimeHandlerFeatures.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NodeRuntimeHandlerFeatures { + const message = createBaseNodeRuntimeHandlerFeatures(); + message.recursiveReadOnlyMounts = object.recursiveReadOnlyMounts ?? false; + message.userNamespaces = object.userNamespaces ?? false; + return message; + }, +}; + +function createBaseNodeSelector(): NodeSelector { + return { nodeSelectorTerms: [] }; +} + +export const NodeSelector: MessageFns = { + encode(message: NodeSelector, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.nodeSelectorTerms) { + NodeSelectorTerm.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeSelector { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeSelector(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.nodeSelectorTerms.push(NodeSelectorTerm.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeSelector { + return { + nodeSelectorTerms: globalThis.Array.isArray(object?.nodeSelectorTerms) + ? object.nodeSelectorTerms.map((e: any) => NodeSelectorTerm.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NodeSelector): unknown { + const obj: any = {}; + if (message.nodeSelectorTerms?.length) { + obj.nodeSelectorTerms = message.nodeSelectorTerms.map((e) => NodeSelectorTerm.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): NodeSelector { + return NodeSelector.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeSelector { + const message = createBaseNodeSelector(); + message.nodeSelectorTerms = + object.nodeSelectorTerms?.map((e) => NodeSelectorTerm.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNodeSelectorRequirement(): NodeSelectorRequirement { + return { key: '', operator: '', values: [] }; +} + +export const NodeSelectorRequirement: MessageFns = { + encode(message: NodeSelectorRequirement, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined && message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.operator !== undefined && message.operator !== '') { + writer.uint32(18).string(message.operator); + } + for (const v of message.values) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeSelectorRequirement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeSelectorRequirement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.operator = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.values.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeSelectorRequirement { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + operator: isSet(object.operator) ? globalThis.String(object.operator) : '', + values: globalThis.Array.isArray(object?.values) + ? object.values.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: NodeSelectorRequirement): unknown { + const obj: any = {}; + if (message.key !== undefined && message.key !== '') { + obj.key = message.key; + } + if (message.operator !== undefined && message.operator !== '') { + obj.operator = message.operator; + } + if (message.values?.length) { + obj.values = message.values; + } + return obj; + }, + + create, I>>(base?: I): NodeSelectorRequirement { + return NodeSelectorRequirement.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NodeSelectorRequirement { + const message = createBaseNodeSelectorRequirement(); + message.key = object.key ?? ''; + message.operator = object.operator ?? ''; + message.values = object.values?.map((e) => e) || []; + return message; + }, +}; + +function createBaseNodeSelectorTerm(): NodeSelectorTerm { + return { matchExpressions: [], matchFields: [] }; +} + +export const NodeSelectorTerm: MessageFns = { + encode(message: NodeSelectorTerm, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.matchExpressions) { + NodeSelectorRequirement.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.matchFields) { + NodeSelectorRequirement.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeSelectorTerm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeSelectorTerm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.matchExpressions.push( + NodeSelectorRequirement.decode(reader, reader.uint32()), + ); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.matchFields.push(NodeSelectorRequirement.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeSelectorTerm { + return { + matchExpressions: globalThis.Array.isArray(object?.matchExpressions) + ? object.matchExpressions.map((e: any) => NodeSelectorRequirement.fromJSON(e)) + : [], + matchFields: globalThis.Array.isArray(object?.matchFields) + ? object.matchFields.map((e: any) => NodeSelectorRequirement.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NodeSelectorTerm): unknown { + const obj: any = {}; + if (message.matchExpressions?.length) { + obj.matchExpressions = message.matchExpressions.map((e) => NodeSelectorRequirement.toJSON(e)); + } + if (message.matchFields?.length) { + obj.matchFields = message.matchFields.map((e) => NodeSelectorRequirement.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): NodeSelectorTerm { + return NodeSelectorTerm.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeSelectorTerm { + const message = createBaseNodeSelectorTerm(); + message.matchExpressions = + object.matchExpressions?.map((e) => NodeSelectorRequirement.fromPartial(e)) || []; + message.matchFields = object.matchFields?.map((e) => NodeSelectorRequirement.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNodeSpec(): NodeSpec { + return { + podCIDR: '', + podCIDRs: [], + providerID: '', + unschedulable: false, + taints: [], + configSource: undefined, + externalID: '', + podPreemptionPolicy: undefined, + }; +} + +export const NodeSpec: MessageFns = { + encode(message: NodeSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.podCIDR !== undefined && message.podCIDR !== '') { + writer.uint32(10).string(message.podCIDR); + } + for (const v of message.podCIDRs) { + writer.uint32(58).string(v!); + } + if (message.providerID !== undefined && message.providerID !== '') { + writer.uint32(26).string(message.providerID); + } + if (message.unschedulable !== undefined && message.unschedulable !== false) { + writer.uint32(32).bool(message.unschedulable); + } + for (const v of message.taints) { + Taint.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.configSource !== undefined) { + NodeConfigSource.encode(message.configSource, writer.uint32(50).fork()).join(); + } + if (message.externalID !== undefined && message.externalID !== '') { + writer.uint32(18).string(message.externalID); + } + if (message.podPreemptionPolicy !== undefined) { + NodePodPreemptionPolicy.encode(message.podPreemptionPolicy, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.podCIDR = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.podCIDRs.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.providerID = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.unschedulable = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.taints.push(Taint.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.configSource = NodeConfigSource.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.externalID = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.podPreemptionPolicy = NodePodPreemptionPolicy.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeSpec { + return { + podCIDR: isSet(object.podCIDR) ? globalThis.String(object.podCIDR) : '', + podCIDRs: globalThis.Array.isArray(object?.podCIDRs) + ? object.podCIDRs.map((e: any) => globalThis.String(e)) + : [], + providerID: isSet(object.providerID) ? globalThis.String(object.providerID) : '', + unschedulable: isSet(object.unschedulable) ? globalThis.Boolean(object.unschedulable) : false, + taints: globalThis.Array.isArray(object?.taints) + ? object.taints.map((e: any) => Taint.fromJSON(e)) + : [], + configSource: isSet(object.configSource) + ? NodeConfigSource.fromJSON(object.configSource) + : undefined, + externalID: isSet(object.externalID) ? globalThis.String(object.externalID) : '', + podPreemptionPolicy: isSet(object.podPreemptionPolicy) + ? NodePodPreemptionPolicy.fromJSON(object.podPreemptionPolicy) + : undefined, + }; + }, + + toJSON(message: NodeSpec): unknown { + const obj: any = {}; + if (message.podCIDR !== undefined && message.podCIDR !== '') { + obj.podCIDR = message.podCIDR; + } + if (message.podCIDRs?.length) { + obj.podCIDRs = message.podCIDRs; + } + if (message.providerID !== undefined && message.providerID !== '') { + obj.providerID = message.providerID; + } + if (message.unschedulable !== undefined && message.unschedulable !== false) { + obj.unschedulable = message.unschedulable; + } + if (message.taints?.length) { + obj.taints = message.taints.map((e) => Taint.toJSON(e)); + } + if (message.configSource !== undefined) { + obj.configSource = NodeConfigSource.toJSON(message.configSource); + } + if (message.externalID !== undefined && message.externalID !== '') { + obj.externalID = message.externalID; + } + if (message.podPreemptionPolicy !== undefined) { + obj.podPreemptionPolicy = NodePodPreemptionPolicy.toJSON(message.podPreemptionPolicy); + } + return obj; + }, + + create, I>>(base?: I): NodeSpec { + return NodeSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeSpec { + const message = createBaseNodeSpec(); + message.podCIDR = object.podCIDR ?? ''; + message.podCIDRs = object.podCIDRs?.map((e) => e) || []; + message.providerID = object.providerID ?? ''; + message.unschedulable = object.unschedulable ?? false; + message.taints = object.taints?.map((e) => Taint.fromPartial(e)) || []; + message.configSource = + object.configSource !== undefined && object.configSource !== null + ? NodeConfigSource.fromPartial(object.configSource) + : undefined; + message.externalID = object.externalID ?? ''; + message.podPreemptionPolicy = + object.podPreemptionPolicy !== undefined && object.podPreemptionPolicy !== null + ? NodePodPreemptionPolicy.fromPartial(object.podPreemptionPolicy) + : undefined; + return message; + }, +}; + +function createBaseNodeStatus(): NodeStatus { + return { + capacity: {}, + allocatable: {}, + phase: '', + conditions: [], + addresses: [], + daemonEndpoints: undefined, + nodeInfo: undefined, + images: [], + volumesInUse: [], + volumesAttached: [], + config: undefined, + runtimeHandlers: [], + features: undefined, + declaredFeatures: [], + }; +} + +export const NodeStatus: MessageFns = { + encode(message: NodeStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + globalThis.Object.entries(message.capacity).forEach(([key, value]: [string, Quantity]) => { + NodeStatus_CapacityEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + globalThis.Object.entries(message.allocatable).forEach(([key, value]: [string, Quantity]) => { + NodeStatus_AllocatableEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); + }); + if (message.phase !== undefined && message.phase !== '') { + writer.uint32(26).string(message.phase); + } + for (const v of message.conditions) { + NodeCondition.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.addresses) { + NodeAddress.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.daemonEndpoints !== undefined) { + NodeDaemonEndpoints.encode(message.daemonEndpoints, writer.uint32(50).fork()).join(); + } + if (message.nodeInfo !== undefined) { + NodeSystemInfo.encode(message.nodeInfo, writer.uint32(58).fork()).join(); + } + for (const v of message.images) { + ContainerImage.encode(v!, writer.uint32(66).fork()).join(); + } + for (const v of message.volumesInUse) { + writer.uint32(74).string(v!); + } + for (const v of message.volumesAttached) { + AttachedVolume.encode(v!, writer.uint32(82).fork()).join(); + } + if (message.config !== undefined) { + NodeConfigStatus.encode(message.config, writer.uint32(90).fork()).join(); + } + for (const v of message.runtimeHandlers) { + NodeRuntimeHandler.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.features !== undefined) { + NodeFeatures.encode(message.features, writer.uint32(106).fork()).join(); + } + for (const v of message.declaredFeatures) { + writer.uint32(114).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + const entry1 = NodeStatus_CapacityEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.capacity[entry1.key] = entry1.value; + } + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = NodeStatus_AllocatableEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.allocatable[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.phase = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.conditions.push(NodeCondition.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.addresses.push(NodeAddress.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.daemonEndpoints = NodeDaemonEndpoints.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.nodeInfo = NodeSystemInfo.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.images.push(ContainerImage.decode(reader, reader.uint32())); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.volumesInUse.push(reader.string()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.volumesAttached.push(AttachedVolume.decode(reader, reader.uint32())); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.config = NodeConfigStatus.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.runtimeHandlers.push(NodeRuntimeHandler.decode(reader, reader.uint32())); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.features = NodeFeatures.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.declaredFeatures.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeStatus { + return { + capacity: isObject(object.capacity) + ? (globalThis.Object.entries(object.capacity) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + allocatable: isObject(object.allocatable) + ? (globalThis.Object.entries(object.allocatable) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + phase: isSet(object.phase) ? globalThis.String(object.phase) : '', + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => NodeCondition.fromJSON(e)) + : [], + addresses: globalThis.Array.isArray(object?.addresses) + ? object.addresses.map((e: any) => NodeAddress.fromJSON(e)) + : [], + daemonEndpoints: isSet(object.daemonEndpoints) + ? NodeDaemonEndpoints.fromJSON(object.daemonEndpoints) + : undefined, + nodeInfo: isSet(object.nodeInfo) ? NodeSystemInfo.fromJSON(object.nodeInfo) : undefined, + images: globalThis.Array.isArray(object?.images) + ? object.images.map((e: any) => ContainerImage.fromJSON(e)) + : [], + volumesInUse: globalThis.Array.isArray(object?.volumesInUse) + ? object.volumesInUse.map((e: any) => globalThis.String(e)) + : [], + volumesAttached: globalThis.Array.isArray(object?.volumesAttached) + ? object.volumesAttached.map((e: any) => AttachedVolume.fromJSON(e)) + : [], + config: isSet(object.config) ? NodeConfigStatus.fromJSON(object.config) : undefined, + runtimeHandlers: globalThis.Array.isArray(object?.runtimeHandlers) + ? object.runtimeHandlers.map((e: any) => NodeRuntimeHandler.fromJSON(e)) + : [], + features: isSet(object.features) ? NodeFeatures.fromJSON(object.features) : undefined, + declaredFeatures: globalThis.Array.isArray(object?.declaredFeatures) + ? object.declaredFeatures.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: NodeStatus): unknown { + const obj: any = {}; + if (message.capacity) { + const entries = globalThis.Object.entries(message.capacity) as [string, Quantity][]; + if (entries.length > 0) { + obj.capacity = {}; + entries.forEach(([k, v]) => { + obj.capacity[k] = Quantity.toJSON(v); + }); + } + } + if (message.allocatable) { + const entries = globalThis.Object.entries(message.allocatable) as [string, Quantity][]; + if (entries.length > 0) { + obj.allocatable = {}; + entries.forEach(([k, v]) => { + obj.allocatable[k] = Quantity.toJSON(v); + }); + } + } + if (message.phase !== undefined && message.phase !== '') { + obj.phase = message.phase; + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => NodeCondition.toJSON(e)); + } + if (message.addresses?.length) { + obj.addresses = message.addresses.map((e) => NodeAddress.toJSON(e)); + } + if (message.daemonEndpoints !== undefined) { + obj.daemonEndpoints = NodeDaemonEndpoints.toJSON(message.daemonEndpoints); + } + if (message.nodeInfo !== undefined) { + obj.nodeInfo = NodeSystemInfo.toJSON(message.nodeInfo); + } + if (message.images?.length) { + obj.images = message.images.map((e) => ContainerImage.toJSON(e)); + } + if (message.volumesInUse?.length) { + obj.volumesInUse = message.volumesInUse; + } + if (message.volumesAttached?.length) { + obj.volumesAttached = message.volumesAttached.map((e) => AttachedVolume.toJSON(e)); + } + if (message.config !== undefined) { + obj.config = NodeConfigStatus.toJSON(message.config); + } + if (message.runtimeHandlers?.length) { + obj.runtimeHandlers = message.runtimeHandlers.map((e) => NodeRuntimeHandler.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = NodeFeatures.toJSON(message.features); + } + if (message.declaredFeatures?.length) { + obj.declaredFeatures = message.declaredFeatures; + } + return obj; + }, + + create, I>>(base?: I): NodeStatus { + return NodeStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeStatus { + const message = createBaseNodeStatus(); + message.capacity = (globalThis.Object.entries(object.capacity ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + message.allocatable = ( + globalThis.Object.entries(object.allocatable ?? {}) as [string, Quantity][] + ).reduce((acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, {}); + message.phase = object.phase ?? ''; + message.conditions = object.conditions?.map((e) => NodeCondition.fromPartial(e)) || []; + message.addresses = object.addresses?.map((e) => NodeAddress.fromPartial(e)) || []; + message.daemonEndpoints = + object.daemonEndpoints !== undefined && object.daemonEndpoints !== null + ? NodeDaemonEndpoints.fromPartial(object.daemonEndpoints) + : undefined; + message.nodeInfo = + object.nodeInfo !== undefined && object.nodeInfo !== null + ? NodeSystemInfo.fromPartial(object.nodeInfo) + : undefined; + message.images = object.images?.map((e) => ContainerImage.fromPartial(e)) || []; + message.volumesInUse = object.volumesInUse?.map((e) => e) || []; + message.volumesAttached = object.volumesAttached?.map((e) => AttachedVolume.fromPartial(e)) || []; + message.config = + object.config !== undefined && object.config !== null + ? NodeConfigStatus.fromPartial(object.config) + : undefined; + message.runtimeHandlers = object.runtimeHandlers?.map((e) => NodeRuntimeHandler.fromPartial(e)) || []; + message.features = + object.features !== undefined && object.features !== null + ? NodeFeatures.fromPartial(object.features) + : undefined; + message.declaredFeatures = object.declaredFeatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseNodeStatus_CapacityEntry(): NodeStatus_CapacityEntry { + return { key: '', value: undefined }; +} + +export const NodeStatus_CapacityEntry: MessageFns = { + encode(message: NodeStatus_CapacityEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeStatus_CapacityEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeStatus_CapacityEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeStatus_CapacityEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: NodeStatus_CapacityEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): NodeStatus_CapacityEntry { + return NodeStatus_CapacityEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NodeStatus_CapacityEntry { + const message = createBaseNodeStatus_CapacityEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseNodeStatus_AllocatableEntry(): NodeStatus_AllocatableEntry { + return { key: '', value: undefined }; +} + +export const NodeStatus_AllocatableEntry: MessageFns = { + encode(message: NodeStatus_AllocatableEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeStatus_AllocatableEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeStatus_AllocatableEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeStatus_AllocatableEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: NodeStatus_AllocatableEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): NodeStatus_AllocatableEntry { + return NodeStatus_AllocatableEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NodeStatus_AllocatableEntry { + const message = createBaseNodeStatus_AllocatableEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseNodeSwapStatus(): NodeSwapStatus { + return { capacity: 0 }; +} + +export const NodeSwapStatus: MessageFns = { + encode(message: NodeSwapStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.capacity !== undefined && message.capacity !== 0) { + writer.uint32(8).int64(message.capacity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeSwapStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeSwapStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.capacity = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeSwapStatus { + return { capacity: isSet(object.capacity) ? globalThis.Number(object.capacity) : 0 }; + }, + + toJSON(message: NodeSwapStatus): unknown { + const obj: any = {}; + if (message.capacity !== undefined && message.capacity !== 0) { + obj.capacity = Math.round(message.capacity); + } + return obj; + }, + + create, I>>(base?: I): NodeSwapStatus { + return NodeSwapStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeSwapStatus { + const message = createBaseNodeSwapStatus(); + message.capacity = object.capacity ?? 0; + return message; + }, +}; + +function createBaseNodeSystemInfo(): NodeSystemInfo { + return { + machineID: '', + systemUUID: '', + bootID: '', + kernelVersion: '', + osImage: '', + containerRuntimeVersion: '', + kubeletVersion: '', + kubeProxyVersion: '', + operatingSystem: '', + architecture: '', + swap: undefined, + runningInUserNamespace: false, + }; +} + +export const NodeSystemInfo: MessageFns = { + encode(message: NodeSystemInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.machineID !== undefined && message.machineID !== '') { + writer.uint32(10).string(message.machineID); + } + if (message.systemUUID !== undefined && message.systemUUID !== '') { + writer.uint32(18).string(message.systemUUID); + } + if (message.bootID !== undefined && message.bootID !== '') { + writer.uint32(26).string(message.bootID); + } + if (message.kernelVersion !== undefined && message.kernelVersion !== '') { + writer.uint32(34).string(message.kernelVersion); + } + if (message.osImage !== undefined && message.osImage !== '') { + writer.uint32(42).string(message.osImage); + } + if (message.containerRuntimeVersion !== undefined && message.containerRuntimeVersion !== '') { + writer.uint32(50).string(message.containerRuntimeVersion); + } + if (message.kubeletVersion !== undefined && message.kubeletVersion !== '') { + writer.uint32(58).string(message.kubeletVersion); + } + if (message.kubeProxyVersion !== undefined && message.kubeProxyVersion !== '') { + writer.uint32(66).string(message.kubeProxyVersion); + } + if (message.operatingSystem !== undefined && message.operatingSystem !== '') { + writer.uint32(74).string(message.operatingSystem); + } + if (message.architecture !== undefined && message.architecture !== '') { + writer.uint32(82).string(message.architecture); + } + if (message.swap !== undefined) { + NodeSwapStatus.encode(message.swap, writer.uint32(90).fork()).join(); + } + if (message.runningInUserNamespace !== undefined && message.runningInUserNamespace !== false) { + writer.uint32(96).bool(message.runningInUserNamespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeSystemInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeSystemInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.machineID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.systemUUID = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.bootID = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.kernelVersion = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.osImage = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.containerRuntimeVersion = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.kubeletVersion = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.kubeProxyVersion = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.operatingSystem = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.architecture = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.swap = NodeSwapStatus.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + + message.runningInUserNamespace = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NodeSystemInfo { + return { + machineID: isSet(object.machineID) ? globalThis.String(object.machineID) : '', + systemUUID: isSet(object.systemUUID) ? globalThis.String(object.systemUUID) : '', + bootID: isSet(object.bootID) ? globalThis.String(object.bootID) : '', + kernelVersion: isSet(object.kernelVersion) ? globalThis.String(object.kernelVersion) : '', + osImage: isSet(object.osImage) ? globalThis.String(object.osImage) : '', + containerRuntimeVersion: isSet(object.containerRuntimeVersion) + ? globalThis.String(object.containerRuntimeVersion) + : '', + kubeletVersion: isSet(object.kubeletVersion) ? globalThis.String(object.kubeletVersion) : '', + kubeProxyVersion: isSet(object.kubeProxyVersion) + ? globalThis.String(object.kubeProxyVersion) + : '', + operatingSystem: isSet(object.operatingSystem) ? globalThis.String(object.operatingSystem) : '', + architecture: isSet(object.architecture) ? globalThis.String(object.architecture) : '', + swap: isSet(object.swap) ? NodeSwapStatus.fromJSON(object.swap) : undefined, + runningInUserNamespace: isSet(object.runningInUserNamespace) + ? globalThis.Boolean(object.runningInUserNamespace) + : false, + }; + }, + + toJSON(message: NodeSystemInfo): unknown { + const obj: any = {}; + if (message.machineID !== undefined && message.machineID !== '') { + obj.machineID = message.machineID; + } + if (message.systemUUID !== undefined && message.systemUUID !== '') { + obj.systemUUID = message.systemUUID; + } + if (message.bootID !== undefined && message.bootID !== '') { + obj.bootID = message.bootID; + } + if (message.kernelVersion !== undefined && message.kernelVersion !== '') { + obj.kernelVersion = message.kernelVersion; + } + if (message.osImage !== undefined && message.osImage !== '') { + obj.osImage = message.osImage; + } + if (message.containerRuntimeVersion !== undefined && message.containerRuntimeVersion !== '') { + obj.containerRuntimeVersion = message.containerRuntimeVersion; + } + if (message.kubeletVersion !== undefined && message.kubeletVersion !== '') { + obj.kubeletVersion = message.kubeletVersion; + } + if (message.kubeProxyVersion !== undefined && message.kubeProxyVersion !== '') { + obj.kubeProxyVersion = message.kubeProxyVersion; + } + if (message.operatingSystem !== undefined && message.operatingSystem !== '') { + obj.operatingSystem = message.operatingSystem; + } + if (message.architecture !== undefined && message.architecture !== '') { + obj.architecture = message.architecture; + } + if (message.swap !== undefined) { + obj.swap = NodeSwapStatus.toJSON(message.swap); + } + if (message.runningInUserNamespace !== undefined && message.runningInUserNamespace !== false) { + obj.runningInUserNamespace = message.runningInUserNamespace; + } + return obj; + }, + + create, I>>(base?: I): NodeSystemInfo { + return NodeSystemInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeSystemInfo { + const message = createBaseNodeSystemInfo(); + message.machineID = object.machineID ?? ''; + message.systemUUID = object.systemUUID ?? ''; + message.bootID = object.bootID ?? ''; + message.kernelVersion = object.kernelVersion ?? ''; + message.osImage = object.osImage ?? ''; + message.containerRuntimeVersion = object.containerRuntimeVersion ?? ''; + message.kubeletVersion = object.kubeletVersion ?? ''; + message.kubeProxyVersion = object.kubeProxyVersion ?? ''; + message.operatingSystem = object.operatingSystem ?? ''; + message.architecture = object.architecture ?? ''; + message.swap = + object.swap !== undefined && object.swap !== null + ? NodeSwapStatus.fromPartial(object.swap) + : undefined; + message.runningInUserNamespace = object.runningInUserNamespace ?? false; + return message; + }, +}; + +function createBaseObjectFieldSelector(): ObjectFieldSelector { + return { apiVersion: '', fieldPath: '' }; +} + +export const ObjectFieldSelector: MessageFns = { + encode(message: ObjectFieldSelector, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.apiVersion !== undefined && message.apiVersion !== '') { + writer.uint32(10).string(message.apiVersion); + } + if (message.fieldPath !== undefined && message.fieldPath !== '') { + writer.uint32(18).string(message.fieldPath); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ObjectFieldSelector { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseObjectFieldSelector(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.apiVersion = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fieldPath = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ObjectFieldSelector { + return { + apiVersion: isSet(object.apiVersion) ? globalThis.String(object.apiVersion) : '', + fieldPath: isSet(object.fieldPath) ? globalThis.String(object.fieldPath) : '', + }; + }, + + toJSON(message: ObjectFieldSelector): unknown { + const obj: any = {}; + if (message.apiVersion !== undefined && message.apiVersion !== '') { + obj.apiVersion = message.apiVersion; + } + if (message.fieldPath !== undefined && message.fieldPath !== '') { + obj.fieldPath = message.fieldPath; + } + return obj; + }, + + create, I>>(base?: I): ObjectFieldSelector { + return ObjectFieldSelector.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ObjectFieldSelector { + const message = createBaseObjectFieldSelector(); + message.apiVersion = object.apiVersion ?? ''; + message.fieldPath = object.fieldPath ?? ''; + return message; + }, +}; + +function createBaseObjectReference(): ObjectReference { + return { kind: '', namespace: '', name: '', uid: '', apiVersion: '', resourceVersion: '', fieldPath: '' }; +} + +export const ObjectReference: MessageFns = { + encode(message: ObjectReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kind !== undefined && message.kind !== '') { + writer.uint32(10).string(message.kind); + } + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(18).string(message.namespace); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(26).string(message.name); + } + if (message.uid !== undefined && message.uid !== '') { + writer.uint32(34).string(message.uid); + } + if (message.apiVersion !== undefined && message.apiVersion !== '') { + writer.uint32(42).string(message.apiVersion); + } + if (message.resourceVersion !== undefined && message.resourceVersion !== '') { + writer.uint32(50).string(message.resourceVersion); + } + if (message.fieldPath !== undefined && message.fieldPath !== '') { + writer.uint32(58).string(message.fieldPath); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ObjectReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseObjectReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.namespace = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.uid = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.apiVersion = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.resourceVersion = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.fieldPath = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ObjectReference { + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : '', + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + uid: isSet(object.uid) ? globalThis.String(object.uid) : '', + apiVersion: isSet(object.apiVersion) ? globalThis.String(object.apiVersion) : '', + resourceVersion: isSet(object.resourceVersion) ? globalThis.String(object.resourceVersion) : '', + fieldPath: isSet(object.fieldPath) ? globalThis.String(object.fieldPath) : '', + }; + }, + + toJSON(message: ObjectReference): unknown { + const obj: any = {}; + if (message.kind !== undefined && message.kind !== '') { + obj.kind = message.kind; + } + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.uid !== undefined && message.uid !== '') { + obj.uid = message.uid; + } + if (message.apiVersion !== undefined && message.apiVersion !== '') { + obj.apiVersion = message.apiVersion; + } + if (message.resourceVersion !== undefined && message.resourceVersion !== '') { + obj.resourceVersion = message.resourceVersion; + } + if (message.fieldPath !== undefined && message.fieldPath !== '') { + obj.fieldPath = message.fieldPath; + } + return obj; + }, + + create, I>>(base?: I): ObjectReference { + return ObjectReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ObjectReference { + const message = createBaseObjectReference(); + message.kind = object.kind ?? ''; + message.namespace = object.namespace ?? ''; + message.name = object.name ?? ''; + message.uid = object.uid ?? ''; + message.apiVersion = object.apiVersion ?? ''; + message.resourceVersion = object.resourceVersion ?? ''; + message.fieldPath = object.fieldPath ?? ''; + return message; + }, +}; + +function createBasePersistentVolume(): PersistentVolume { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const PersistentVolume: MessageFns = { + encode(message: PersistentVolume, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + PersistentVolumeSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + PersistentVolumeStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolume { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolume(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = PersistentVolumeSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = PersistentVolumeStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolume { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? PersistentVolumeSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? PersistentVolumeStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: PersistentVolume): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = PersistentVolumeSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = PersistentVolumeStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): PersistentVolume { + return PersistentVolume.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PersistentVolume { + const message = createBasePersistentVolume(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? PersistentVolumeSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? PersistentVolumeStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBasePersistentVolumeClaim(): PersistentVolumeClaim { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const PersistentVolumeClaim: MessageFns = { + encode(message: PersistentVolumeClaim, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + PersistentVolumeClaimSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + PersistentVolumeClaimStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeClaim { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeClaim(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = PersistentVolumeClaimSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = PersistentVolumeClaimStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeClaim { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? PersistentVolumeClaimSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? PersistentVolumeClaimStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: PersistentVolumeClaim): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = PersistentVolumeClaimSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = PersistentVolumeClaimStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): PersistentVolumeClaim { + return PersistentVolumeClaim.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PersistentVolumeClaim { + const message = createBasePersistentVolumeClaim(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? PersistentVolumeClaimSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? PersistentVolumeClaimStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBasePersistentVolumeClaimCondition(): PersistentVolumeClaimCondition { + return { + type: '', + status: '', + lastProbeTime: undefined, + lastTransitionTime: undefined, + reason: '', + message: '', + }; +} + +export const PersistentVolumeClaimCondition: MessageFns = { + encode(message: PersistentVolumeClaimCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastProbeTime !== undefined) { + Time.encode(message.lastProbeTime, writer.uint32(26).fork()).join(); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(34).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(42).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(50).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeClaimCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeClaimCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastProbeTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.reason = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeClaimCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastProbeTime: isSet(object.lastProbeTime) ? Time.fromJSON(object.lastProbeTime) : undefined, + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: PersistentVolumeClaimCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastProbeTime !== undefined) { + obj.lastProbeTime = Time.toJSON(message.lastProbeTime); + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>( + base?: I, + ): PersistentVolumeClaimCondition { + return PersistentVolumeClaimCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PersistentVolumeClaimCondition { + const message = createBasePersistentVolumeClaimCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastProbeTime = + object.lastProbeTime !== undefined && object.lastProbeTime !== null + ? Time.fromPartial(object.lastProbeTime) + : undefined; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBasePersistentVolumeClaimList(): PersistentVolumeClaimList { + return { metadata: undefined, items: [] }; +} + +export const PersistentVolumeClaimList: MessageFns = { + encode(message: PersistentVolumeClaimList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + PersistentVolumeClaim.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeClaimList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeClaimList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(PersistentVolumeClaim.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeClaimList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => PersistentVolumeClaim.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PersistentVolumeClaimList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => PersistentVolumeClaim.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PersistentVolumeClaimList { + return PersistentVolumeClaimList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PersistentVolumeClaimList { + const message = createBasePersistentVolumeClaimList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => PersistentVolumeClaim.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePersistentVolumeClaimSpec(): PersistentVolumeClaimSpec { + return { + accessModes: [], + selector: undefined, + resources: undefined, + volumeName: '', + storageClassName: '', + volumeMode: '', + dataSource: undefined, + dataSourceRef: undefined, + volumeAttributesClassName: '', + }; +} + +export const PersistentVolumeClaimSpec: MessageFns = { + encode(message: PersistentVolumeClaimSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accessModes) { + writer.uint32(10).string(v!); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(34).fork()).join(); + } + if (message.resources !== undefined) { + VolumeResourceRequirements.encode(message.resources, writer.uint32(18).fork()).join(); + } + if (message.volumeName !== undefined && message.volumeName !== '') { + writer.uint32(26).string(message.volumeName); + } + if (message.storageClassName !== undefined && message.storageClassName !== '') { + writer.uint32(42).string(message.storageClassName); + } + if (message.volumeMode !== undefined && message.volumeMode !== '') { + writer.uint32(50).string(message.volumeMode); + } + if (message.dataSource !== undefined) { + TypedLocalObjectReference.encode(message.dataSource, writer.uint32(58).fork()).join(); + } + if (message.dataSourceRef !== undefined) { + TypedObjectReference.encode(message.dataSourceRef, writer.uint32(66).fork()).join(); + } + if (message.volumeAttributesClassName !== undefined && message.volumeAttributesClassName !== '') { + writer.uint32(74).string(message.volumeAttributesClassName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeClaimSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeClaimSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.accessModes.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resources = VolumeResourceRequirements.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.volumeName = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.storageClassName = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.volumeMode = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.dataSource = TypedLocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.dataSourceRef = TypedObjectReference.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.volumeAttributesClassName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeClaimSpec { + return { + accessModes: globalThis.Array.isArray(object?.accessModes) + ? object.accessModes.map((e: any) => globalThis.String(e)) + : [], + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + resources: isSet(object.resources) + ? VolumeResourceRequirements.fromJSON(object.resources) + : undefined, + volumeName: isSet(object.volumeName) ? globalThis.String(object.volumeName) : '', + storageClassName: isSet(object.storageClassName) + ? globalThis.String(object.storageClassName) + : '', + volumeMode: isSet(object.volumeMode) ? globalThis.String(object.volumeMode) : '', + dataSource: isSet(object.dataSource) + ? TypedLocalObjectReference.fromJSON(object.dataSource) + : undefined, + dataSourceRef: isSet(object.dataSourceRef) + ? TypedObjectReference.fromJSON(object.dataSourceRef) + : undefined, + volumeAttributesClassName: isSet(object.volumeAttributesClassName) + ? globalThis.String(object.volumeAttributesClassName) + : '', + }; + }, + + toJSON(message: PersistentVolumeClaimSpec): unknown { + const obj: any = {}; + if (message.accessModes?.length) { + obj.accessModes = message.accessModes; + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.resources !== undefined) { + obj.resources = VolumeResourceRequirements.toJSON(message.resources); + } + if (message.volumeName !== undefined && message.volumeName !== '') { + obj.volumeName = message.volumeName; + } + if (message.storageClassName !== undefined && message.storageClassName !== '') { + obj.storageClassName = message.storageClassName; + } + if (message.volumeMode !== undefined && message.volumeMode !== '') { + obj.volumeMode = message.volumeMode; + } + if (message.dataSource !== undefined) { + obj.dataSource = TypedLocalObjectReference.toJSON(message.dataSource); + } + if (message.dataSourceRef !== undefined) { + obj.dataSourceRef = TypedObjectReference.toJSON(message.dataSourceRef); + } + if (message.volumeAttributesClassName !== undefined && message.volumeAttributesClassName !== '') { + obj.volumeAttributesClassName = message.volumeAttributesClassName; + } + return obj; + }, + + create, I>>(base?: I): PersistentVolumeClaimSpec { + return PersistentVolumeClaimSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PersistentVolumeClaimSpec { + const message = createBasePersistentVolumeClaimSpec(); + message.accessModes = object.accessModes?.map((e) => e) || []; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.resources = + object.resources !== undefined && object.resources !== null + ? VolumeResourceRequirements.fromPartial(object.resources) + : undefined; + message.volumeName = object.volumeName ?? ''; + message.storageClassName = object.storageClassName ?? ''; + message.volumeMode = object.volumeMode ?? ''; + message.dataSource = + object.dataSource !== undefined && object.dataSource !== null + ? TypedLocalObjectReference.fromPartial(object.dataSource) + : undefined; + message.dataSourceRef = + object.dataSourceRef !== undefined && object.dataSourceRef !== null + ? TypedObjectReference.fromPartial(object.dataSourceRef) + : undefined; + message.volumeAttributesClassName = object.volumeAttributesClassName ?? ''; + return message; + }, +}; + +function createBasePersistentVolumeClaimStatus(): PersistentVolumeClaimStatus { + return { + phase: '', + accessModes: [], + capacity: {}, + conditions: [], + allocatedResources: {}, + allocatedResourceStatuses: {}, + currentVolumeAttributesClassName: '', + modifyVolumeStatus: undefined, + healthStatus: undefined, + }; +} + +export const PersistentVolumeClaimStatus: MessageFns = { + encode(message: PersistentVolumeClaimStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.phase !== undefined && message.phase !== '') { + writer.uint32(10).string(message.phase); + } + for (const v of message.accessModes) { + writer.uint32(18).string(v!); + } + globalThis.Object.entries(message.capacity).forEach(([key, value]: [string, Quantity]) => { + PersistentVolumeClaimStatus_CapacityEntry.encode( + { key: key as any, value }, + writer.uint32(26).fork(), + ).join(); + }); + for (const v of message.conditions) { + PersistentVolumeClaimCondition.encode(v!, writer.uint32(34).fork()).join(); + } + globalThis.Object.entries(message.allocatedResources).forEach(([key, value]: [string, Quantity]) => { + PersistentVolumeClaimStatus_AllocatedResourcesEntry.encode( + { key: key as any, value }, + writer.uint32(42).fork(), + ).join(); + }); + globalThis.Object.entries(message.allocatedResourceStatuses).forEach( + ([key, value]: [string, string]) => { + PersistentVolumeClaimStatus_AllocatedResourceStatusesEntry.encode( + { key: key as any, value }, + writer.uint32(58).fork(), + ).join(); + }, + ); + if ( + message.currentVolumeAttributesClassName !== undefined && + message.currentVolumeAttributesClassName !== '' + ) { + writer.uint32(66).string(message.currentVolumeAttributesClassName); + } + if (message.modifyVolumeStatus !== undefined) { + ModifyVolumeStatus.encode(message.modifyVolumeStatus, writer.uint32(74).fork()).join(); + } + if (message.healthStatus !== undefined) { + VolumeHealthStatus.encode(message.healthStatus, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeClaimStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeClaimStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.phase = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.accessModes.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + const entry3 = PersistentVolumeClaimStatus_CapacityEntry.decode( + reader, + reader.uint32(), + ); + if (entry3.value !== undefined) { + message.capacity[entry3.key] = entry3.value; + } + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.conditions.push( + PersistentVolumeClaimCondition.decode(reader, reader.uint32()), + ); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + const entry5 = PersistentVolumeClaimStatus_AllocatedResourcesEntry.decode( + reader, + reader.uint32(), + ); + if (entry5.value !== undefined) { + message.allocatedResources[entry5.key] = entry5.value; + } + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + const entry7 = PersistentVolumeClaimStatus_AllocatedResourceStatusesEntry.decode( + reader, + reader.uint32(), + ); + if (entry7.value !== undefined) { + message.allocatedResourceStatuses[entry7.key] = entry7.value; + } + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.currentVolumeAttributesClassName = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.modifyVolumeStatus = ModifyVolumeStatus.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.healthStatus = VolumeHealthStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeClaimStatus { + return { + phase: isSet(object.phase) ? globalThis.String(object.phase) : '', + accessModes: globalThis.Array.isArray(object?.accessModes) + ? object.accessModes.map((e: any) => globalThis.String(e)) + : [], + capacity: isObject(object.capacity) + ? (globalThis.Object.entries(object.capacity) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => PersistentVolumeClaimCondition.fromJSON(e)) + : [], + allocatedResources: isObject(object.allocatedResources) + ? (globalThis.Object.entries(object.allocatedResources) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + allocatedResourceStatuses: isObject(object.allocatedResourceStatuses) + ? (globalThis.Object.entries(object.allocatedResourceStatuses) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + currentVolumeAttributesClassName: isSet(object.currentVolumeAttributesClassName) + ? globalThis.String(object.currentVolumeAttributesClassName) + : '', + modifyVolumeStatus: isSet(object.modifyVolumeStatus) + ? ModifyVolumeStatus.fromJSON(object.modifyVolumeStatus) + : undefined, + healthStatus: isSet(object.healthStatus) + ? VolumeHealthStatus.fromJSON(object.healthStatus) + : undefined, + }; + }, + + toJSON(message: PersistentVolumeClaimStatus): unknown { + const obj: any = {}; + if (message.phase !== undefined && message.phase !== '') { + obj.phase = message.phase; + } + if (message.accessModes?.length) { + obj.accessModes = message.accessModes; + } + if (message.capacity) { + const entries = globalThis.Object.entries(message.capacity) as [string, Quantity][]; + if (entries.length > 0) { + obj.capacity = {}; + entries.forEach(([k, v]) => { + obj.capacity[k] = Quantity.toJSON(v); + }); + } + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => PersistentVolumeClaimCondition.toJSON(e)); + } + if (message.allocatedResources) { + const entries = globalThis.Object.entries(message.allocatedResources) as [string, Quantity][]; + if (entries.length > 0) { + obj.allocatedResources = {}; + entries.forEach(([k, v]) => { + obj.allocatedResources[k] = Quantity.toJSON(v); + }); + } + } + if (message.allocatedResourceStatuses) { + const entries = globalThis.Object.entries(message.allocatedResourceStatuses) as [ + string, + string, + ][]; + if (entries.length > 0) { + obj.allocatedResourceStatuses = {}; + entries.forEach(([k, v]) => { + obj.allocatedResourceStatuses[k] = v; + }); + } + } + if ( + message.currentVolumeAttributesClassName !== undefined && + message.currentVolumeAttributesClassName !== '' + ) { + obj.currentVolumeAttributesClassName = message.currentVolumeAttributesClassName; + } + if (message.modifyVolumeStatus !== undefined) { + obj.modifyVolumeStatus = ModifyVolumeStatus.toJSON(message.modifyVolumeStatus); + } + if (message.healthStatus !== undefined) { + obj.healthStatus = VolumeHealthStatus.toJSON(message.healthStatus); + } + return obj; + }, + + create, I>>( + base?: I, + ): PersistentVolumeClaimStatus { + return PersistentVolumeClaimStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PersistentVolumeClaimStatus { + const message = createBasePersistentVolumeClaimStatus(); + message.phase = object.phase ?? ''; + message.accessModes = object.accessModes?.map((e) => e) || []; + message.capacity = (globalThis.Object.entries(object.capacity ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + message.conditions = + object.conditions?.map((e) => PersistentVolumeClaimCondition.fromPartial(e)) || []; + message.allocatedResources = ( + globalThis.Object.entries(object.allocatedResources ?? {}) as [string, Quantity][] + ).reduce((acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, {}); + message.allocatedResourceStatuses = ( + globalThis.Object.entries(object.allocatedResourceStatuses ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.currentVolumeAttributesClassName = object.currentVolumeAttributesClassName ?? ''; + message.modifyVolumeStatus = + object.modifyVolumeStatus !== undefined && object.modifyVolumeStatus !== null + ? ModifyVolumeStatus.fromPartial(object.modifyVolumeStatus) + : undefined; + message.healthStatus = + object.healthStatus !== undefined && object.healthStatus !== null + ? VolumeHealthStatus.fromPartial(object.healthStatus) + : undefined; + return message; + }, +}; + +function createBasePersistentVolumeClaimStatus_CapacityEntry(): PersistentVolumeClaimStatus_CapacityEntry { + return { key: '', value: undefined }; +} + +export const PersistentVolumeClaimStatus_CapacityEntry: MessageFns = + { + encode( + message: PersistentVolumeClaimStatus_CapacityEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeClaimStatus_CapacityEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeClaimStatus_CapacityEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeClaimStatus_CapacityEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: PersistentVolumeClaimStatus_CapacityEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): PersistentVolumeClaimStatus_CapacityEntry { + return PersistentVolumeClaimStatus_CapacityEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PersistentVolumeClaimStatus_CapacityEntry { + const message = createBasePersistentVolumeClaimStatus_CapacityEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, + }; + +function createBasePersistentVolumeClaimStatus_AllocatedResourcesEntry(): PersistentVolumeClaimStatus_AllocatedResourcesEntry { + return { key: '', value: undefined }; +} + +export const PersistentVolumeClaimStatus_AllocatedResourcesEntry: MessageFns = + { + encode( + message: PersistentVolumeClaimStatus_AllocatedResourcesEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): PersistentVolumeClaimStatus_AllocatedResourcesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeClaimStatus_AllocatedResourcesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeClaimStatus_AllocatedResourcesEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: PersistentVolumeClaimStatus_AllocatedResourcesEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): PersistentVolumeClaimStatus_AllocatedResourcesEntry { + return PersistentVolumeClaimStatus_AllocatedResourcesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PersistentVolumeClaimStatus_AllocatedResourcesEntry { + const message = createBasePersistentVolumeClaimStatus_AllocatedResourcesEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, + }; + +function createBasePersistentVolumeClaimStatus_AllocatedResourceStatusesEntry(): PersistentVolumeClaimStatus_AllocatedResourceStatusesEntry { + return { key: '', value: '' }; +} + +export const PersistentVolumeClaimStatus_AllocatedResourceStatusesEntry: MessageFns = + { + encode( + message: PersistentVolumeClaimStatus_AllocatedResourceStatusesEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): PersistentVolumeClaimStatus_AllocatedResourceStatusesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeClaimStatus_AllocatedResourceStatusesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeClaimStatus_AllocatedResourceStatusesEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: PersistentVolumeClaimStatus_AllocatedResourceStatusesEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): PersistentVolumeClaimStatus_AllocatedResourceStatusesEntry { + return PersistentVolumeClaimStatus_AllocatedResourceStatusesEntry.fromPartial( + base ?? ({} as any), + ); + }, + fromPartial< + I extends Exact, I>, + >(object: I): PersistentVolumeClaimStatus_AllocatedResourceStatusesEntry { + const message = createBasePersistentVolumeClaimStatus_AllocatedResourceStatusesEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, + }; + +function createBasePersistentVolumeClaimTemplate(): PersistentVolumeClaimTemplate { + return { metadata: undefined, spec: undefined }; +} + +export const PersistentVolumeClaimTemplate: MessageFns = { + encode(message: PersistentVolumeClaimTemplate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + PersistentVolumeClaimSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeClaimTemplate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeClaimTemplate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = PersistentVolumeClaimSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeClaimTemplate { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? PersistentVolumeClaimSpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: PersistentVolumeClaimTemplate): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = PersistentVolumeClaimSpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>( + base?: I, + ): PersistentVolumeClaimTemplate { + return PersistentVolumeClaimTemplate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PersistentVolumeClaimTemplate { + const message = createBasePersistentVolumeClaimTemplate(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? PersistentVolumeClaimSpec.fromPartial(object.spec) + : undefined; + return message; + }, +}; + +function createBasePersistentVolumeClaimVolumeSource(): PersistentVolumeClaimVolumeSource { + return { claimName: '', readOnly: false }; +} + +export const PersistentVolumeClaimVolumeSource: MessageFns = { + encode( + message: PersistentVolumeClaimVolumeSource, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.claimName !== undefined && message.claimName !== '') { + writer.uint32(10).string(message.claimName); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(16).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeClaimVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeClaimVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.claimName = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeClaimVolumeSource { + return { + claimName: isSet(object.claimName) ? globalThis.String(object.claimName) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: PersistentVolumeClaimVolumeSource): unknown { + const obj: any = {}; + if (message.claimName !== undefined && message.claimName !== '') { + obj.claimName = message.claimName; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>( + base?: I, + ): PersistentVolumeClaimVolumeSource { + return PersistentVolumeClaimVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PersistentVolumeClaimVolumeSource { + const message = createBasePersistentVolumeClaimVolumeSource(); + message.claimName = object.claimName ?? ''; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBasePersistentVolumeList(): PersistentVolumeList { + return { metadata: undefined, items: [] }; +} + +export const PersistentVolumeList: MessageFns = { + encode(message: PersistentVolumeList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + PersistentVolume.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(PersistentVolume.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => PersistentVolume.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PersistentVolumeList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => PersistentVolume.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PersistentVolumeList { + return PersistentVolumeList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PersistentVolumeList { + const message = createBasePersistentVolumeList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => PersistentVolume.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePersistentVolumeSource(): PersistentVolumeSource { + return { + gcePersistentDisk: undefined, + awsElasticBlockStore: undefined, + hostPath: undefined, + glusterfs: undefined, + nfs: undefined, + rbd: undefined, + iscsi: undefined, + cinder: undefined, + cephfs: undefined, + fc: undefined, + flocker: undefined, + flexVolume: undefined, + azureFile: undefined, + vsphereVolume: undefined, + quobyte: undefined, + azureDisk: undefined, + photonPersistentDisk: undefined, + portworxVolume: undefined, + scaleIO: undefined, + local: undefined, + storageos: undefined, + csi: undefined, + }; +} + +export const PersistentVolumeSource: MessageFns = { + encode(message: PersistentVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gcePersistentDisk !== undefined) { + GCEPersistentDiskVolumeSource.encode(message.gcePersistentDisk, writer.uint32(10).fork()).join(); + } + if (message.awsElasticBlockStore !== undefined) { + AWSElasticBlockStoreVolumeSource.encode( + message.awsElasticBlockStore, + writer.uint32(18).fork(), + ).join(); + } + if (message.hostPath !== undefined) { + HostPathVolumeSource.encode(message.hostPath, writer.uint32(26).fork()).join(); + } + if (message.glusterfs !== undefined) { + GlusterfsPersistentVolumeSource.encode(message.glusterfs, writer.uint32(34).fork()).join(); + } + if (message.nfs !== undefined) { + NFSVolumeSource.encode(message.nfs, writer.uint32(42).fork()).join(); + } + if (message.rbd !== undefined) { + RBDPersistentVolumeSource.encode(message.rbd, writer.uint32(50).fork()).join(); + } + if (message.iscsi !== undefined) { + ISCSIPersistentVolumeSource.encode(message.iscsi, writer.uint32(58).fork()).join(); + } + if (message.cinder !== undefined) { + CinderPersistentVolumeSource.encode(message.cinder, writer.uint32(66).fork()).join(); + } + if (message.cephfs !== undefined) { + CephFSPersistentVolumeSource.encode(message.cephfs, writer.uint32(74).fork()).join(); + } + if (message.fc !== undefined) { + FCVolumeSource.encode(message.fc, writer.uint32(82).fork()).join(); + } + if (message.flocker !== undefined) { + FlockerVolumeSource.encode(message.flocker, writer.uint32(90).fork()).join(); + } + if (message.flexVolume !== undefined) { + FlexPersistentVolumeSource.encode(message.flexVolume, writer.uint32(98).fork()).join(); + } + if (message.azureFile !== undefined) { + AzureFilePersistentVolumeSource.encode(message.azureFile, writer.uint32(106).fork()).join(); + } + if (message.vsphereVolume !== undefined) { + VsphereVirtualDiskVolumeSource.encode(message.vsphereVolume, writer.uint32(114).fork()).join(); + } + if (message.quobyte !== undefined) { + QuobyteVolumeSource.encode(message.quobyte, writer.uint32(122).fork()).join(); + } + if (message.azureDisk !== undefined) { + AzureDiskVolumeSource.encode(message.azureDisk, writer.uint32(130).fork()).join(); + } + if (message.photonPersistentDisk !== undefined) { + PhotonPersistentDiskVolumeSource.encode( + message.photonPersistentDisk, + writer.uint32(138).fork(), + ).join(); + } + if (message.portworxVolume !== undefined) { + PortworxVolumeSource.encode(message.portworxVolume, writer.uint32(146).fork()).join(); + } + if (message.scaleIO !== undefined) { + ScaleIOPersistentVolumeSource.encode(message.scaleIO, writer.uint32(154).fork()).join(); + } + if (message.local !== undefined) { + LocalVolumeSource.encode(message.local, writer.uint32(162).fork()).join(); + } + if (message.storageos !== undefined) { + StorageOSPersistentVolumeSource.encode(message.storageos, writer.uint32(170).fork()).join(); + } + if (message.csi !== undefined) { + CSIPersistentVolumeSource.encode(message.csi, writer.uint32(178).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.gcePersistentDisk = GCEPersistentDiskVolumeSource.decode( + reader, + reader.uint32(), + ); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.awsElasticBlockStore = AWSElasticBlockStoreVolumeSource.decode( + reader, + reader.uint32(), + ); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.hostPath = HostPathVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.glusterfs = GlusterfsPersistentVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.nfs = NFSVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.rbd = RBDPersistentVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.iscsi = ISCSIPersistentVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.cinder = CinderPersistentVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.cephfs = CephFSPersistentVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.fc = FCVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.flocker = FlockerVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.flexVolume = FlexPersistentVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.azureFile = AzureFilePersistentVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.vsphereVolume = VsphereVirtualDiskVolumeSource.decode( + reader, + reader.uint32(), + ); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.quobyte = QuobyteVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + + message.azureDisk = AzureDiskVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + + message.photonPersistentDisk = PhotonPersistentDiskVolumeSource.decode( + reader, + reader.uint32(), + ); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + + message.portworxVolume = PortworxVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + + message.scaleIO = ScaleIOPersistentVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + + message.local = LocalVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + + message.storageos = StorageOSPersistentVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + + message.csi = CSIPersistentVolumeSource.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeSource { + return { + gcePersistentDisk: isSet(object.gcePersistentDisk) + ? GCEPersistentDiskVolumeSource.fromJSON(object.gcePersistentDisk) + : undefined, + awsElasticBlockStore: isSet(object.awsElasticBlockStore) + ? AWSElasticBlockStoreVolumeSource.fromJSON(object.awsElasticBlockStore) + : undefined, + hostPath: isSet(object.hostPath) ? HostPathVolumeSource.fromJSON(object.hostPath) : undefined, + glusterfs: isSet(object.glusterfs) + ? GlusterfsPersistentVolumeSource.fromJSON(object.glusterfs) + : undefined, + nfs: isSet(object.nfs) ? NFSVolumeSource.fromJSON(object.nfs) : undefined, + rbd: isSet(object.rbd) ? RBDPersistentVolumeSource.fromJSON(object.rbd) : undefined, + iscsi: isSet(object.iscsi) ? ISCSIPersistentVolumeSource.fromJSON(object.iscsi) : undefined, + cinder: isSet(object.cinder) ? CinderPersistentVolumeSource.fromJSON(object.cinder) : undefined, + cephfs: isSet(object.cephfs) ? CephFSPersistentVolumeSource.fromJSON(object.cephfs) : undefined, + fc: isSet(object.fc) ? FCVolumeSource.fromJSON(object.fc) : undefined, + flocker: isSet(object.flocker) ? FlockerVolumeSource.fromJSON(object.flocker) : undefined, + flexVolume: isSet(object.flexVolume) + ? FlexPersistentVolumeSource.fromJSON(object.flexVolume) + : undefined, + azureFile: isSet(object.azureFile) + ? AzureFilePersistentVolumeSource.fromJSON(object.azureFile) + : undefined, + vsphereVolume: isSet(object.vsphereVolume) + ? VsphereVirtualDiskVolumeSource.fromJSON(object.vsphereVolume) + : undefined, + quobyte: isSet(object.quobyte) ? QuobyteVolumeSource.fromJSON(object.quobyte) : undefined, + azureDisk: isSet(object.azureDisk) ? AzureDiskVolumeSource.fromJSON(object.azureDisk) : undefined, + photonPersistentDisk: isSet(object.photonPersistentDisk) + ? PhotonPersistentDiskVolumeSource.fromJSON(object.photonPersistentDisk) + : undefined, + portworxVolume: isSet(object.portworxVolume) + ? PortworxVolumeSource.fromJSON(object.portworxVolume) + : undefined, + scaleIO: isSet(object.scaleIO) + ? ScaleIOPersistentVolumeSource.fromJSON(object.scaleIO) + : undefined, + local: isSet(object.local) ? LocalVolumeSource.fromJSON(object.local) : undefined, + storageos: isSet(object.storageos) + ? StorageOSPersistentVolumeSource.fromJSON(object.storageos) + : undefined, + csi: isSet(object.csi) ? CSIPersistentVolumeSource.fromJSON(object.csi) : undefined, + }; + }, + + toJSON(message: PersistentVolumeSource): unknown { + const obj: any = {}; + if (message.gcePersistentDisk !== undefined) { + obj.gcePersistentDisk = GCEPersistentDiskVolumeSource.toJSON(message.gcePersistentDisk); + } + if (message.awsElasticBlockStore !== undefined) { + obj.awsElasticBlockStore = AWSElasticBlockStoreVolumeSource.toJSON(message.awsElasticBlockStore); + } + if (message.hostPath !== undefined) { + obj.hostPath = HostPathVolumeSource.toJSON(message.hostPath); + } + if (message.glusterfs !== undefined) { + obj.glusterfs = GlusterfsPersistentVolumeSource.toJSON(message.glusterfs); + } + if (message.nfs !== undefined) { + obj.nfs = NFSVolumeSource.toJSON(message.nfs); + } + if (message.rbd !== undefined) { + obj.rbd = RBDPersistentVolumeSource.toJSON(message.rbd); + } + if (message.iscsi !== undefined) { + obj.iscsi = ISCSIPersistentVolumeSource.toJSON(message.iscsi); + } + if (message.cinder !== undefined) { + obj.cinder = CinderPersistentVolumeSource.toJSON(message.cinder); + } + if (message.cephfs !== undefined) { + obj.cephfs = CephFSPersistentVolumeSource.toJSON(message.cephfs); + } + if (message.fc !== undefined) { + obj.fc = FCVolumeSource.toJSON(message.fc); + } + if (message.flocker !== undefined) { + obj.flocker = FlockerVolumeSource.toJSON(message.flocker); + } + if (message.flexVolume !== undefined) { + obj.flexVolume = FlexPersistentVolumeSource.toJSON(message.flexVolume); + } + if (message.azureFile !== undefined) { + obj.azureFile = AzureFilePersistentVolumeSource.toJSON(message.azureFile); + } + if (message.vsphereVolume !== undefined) { + obj.vsphereVolume = VsphereVirtualDiskVolumeSource.toJSON(message.vsphereVolume); + } + if (message.quobyte !== undefined) { + obj.quobyte = QuobyteVolumeSource.toJSON(message.quobyte); + } + if (message.azureDisk !== undefined) { + obj.azureDisk = AzureDiskVolumeSource.toJSON(message.azureDisk); + } + if (message.photonPersistentDisk !== undefined) { + obj.photonPersistentDisk = PhotonPersistentDiskVolumeSource.toJSON(message.photonPersistentDisk); + } + if (message.portworxVolume !== undefined) { + obj.portworxVolume = PortworxVolumeSource.toJSON(message.portworxVolume); + } + if (message.scaleIO !== undefined) { + obj.scaleIO = ScaleIOPersistentVolumeSource.toJSON(message.scaleIO); + } + if (message.local !== undefined) { + obj.local = LocalVolumeSource.toJSON(message.local); + } + if (message.storageos !== undefined) { + obj.storageos = StorageOSPersistentVolumeSource.toJSON(message.storageos); + } + if (message.csi !== undefined) { + obj.csi = CSIPersistentVolumeSource.toJSON(message.csi); + } + return obj; + }, + + create, I>>(base?: I): PersistentVolumeSource { + return PersistentVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PersistentVolumeSource { + const message = createBasePersistentVolumeSource(); + message.gcePersistentDisk = + object.gcePersistentDisk !== undefined && object.gcePersistentDisk !== null + ? GCEPersistentDiskVolumeSource.fromPartial(object.gcePersistentDisk) + : undefined; + message.awsElasticBlockStore = + object.awsElasticBlockStore !== undefined && object.awsElasticBlockStore !== null + ? AWSElasticBlockStoreVolumeSource.fromPartial(object.awsElasticBlockStore) + : undefined; + message.hostPath = + object.hostPath !== undefined && object.hostPath !== null + ? HostPathVolumeSource.fromPartial(object.hostPath) + : undefined; + message.glusterfs = + object.glusterfs !== undefined && object.glusterfs !== null + ? GlusterfsPersistentVolumeSource.fromPartial(object.glusterfs) + : undefined; + message.nfs = + object.nfs !== undefined && object.nfs !== null + ? NFSVolumeSource.fromPartial(object.nfs) + : undefined; + message.rbd = + object.rbd !== undefined && object.rbd !== null + ? RBDPersistentVolumeSource.fromPartial(object.rbd) + : undefined; + message.iscsi = + object.iscsi !== undefined && object.iscsi !== null + ? ISCSIPersistentVolumeSource.fromPartial(object.iscsi) + : undefined; + message.cinder = + object.cinder !== undefined && object.cinder !== null + ? CinderPersistentVolumeSource.fromPartial(object.cinder) + : undefined; + message.cephfs = + object.cephfs !== undefined && object.cephfs !== null + ? CephFSPersistentVolumeSource.fromPartial(object.cephfs) + : undefined; + message.fc = + object.fc !== undefined && object.fc !== null ? FCVolumeSource.fromPartial(object.fc) : undefined; + message.flocker = + object.flocker !== undefined && object.flocker !== null + ? FlockerVolumeSource.fromPartial(object.flocker) + : undefined; + message.flexVolume = + object.flexVolume !== undefined && object.flexVolume !== null + ? FlexPersistentVolumeSource.fromPartial(object.flexVolume) + : undefined; + message.azureFile = + object.azureFile !== undefined && object.azureFile !== null + ? AzureFilePersistentVolumeSource.fromPartial(object.azureFile) + : undefined; + message.vsphereVolume = + object.vsphereVolume !== undefined && object.vsphereVolume !== null + ? VsphereVirtualDiskVolumeSource.fromPartial(object.vsphereVolume) + : undefined; + message.quobyte = + object.quobyte !== undefined && object.quobyte !== null + ? QuobyteVolumeSource.fromPartial(object.quobyte) + : undefined; + message.azureDisk = + object.azureDisk !== undefined && object.azureDisk !== null + ? AzureDiskVolumeSource.fromPartial(object.azureDisk) + : undefined; + message.photonPersistentDisk = + object.photonPersistentDisk !== undefined && object.photonPersistentDisk !== null + ? PhotonPersistentDiskVolumeSource.fromPartial(object.photonPersistentDisk) + : undefined; + message.portworxVolume = + object.portworxVolume !== undefined && object.portworxVolume !== null + ? PortworxVolumeSource.fromPartial(object.portworxVolume) + : undefined; + message.scaleIO = + object.scaleIO !== undefined && object.scaleIO !== null + ? ScaleIOPersistentVolumeSource.fromPartial(object.scaleIO) + : undefined; + message.local = + object.local !== undefined && object.local !== null + ? LocalVolumeSource.fromPartial(object.local) + : undefined; + message.storageos = + object.storageos !== undefined && object.storageos !== null + ? StorageOSPersistentVolumeSource.fromPartial(object.storageos) + : undefined; + message.csi = + object.csi !== undefined && object.csi !== null + ? CSIPersistentVolumeSource.fromPartial(object.csi) + : undefined; + return message; + }, +}; + +function createBasePersistentVolumeSpec(): PersistentVolumeSpec { + return { + capacity: {}, + persistentVolumeSource: undefined, + accessModes: [], + claimRef: undefined, + persistentVolumeReclaimPolicy: '', + storageClassName: '', + mountOptions: [], + volumeMode: '', + nodeAffinity: undefined, + volumeAttributesClassName: '', + }; +} + +export const PersistentVolumeSpec: MessageFns = { + encode(message: PersistentVolumeSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + globalThis.Object.entries(message.capacity).forEach(([key, value]: [string, Quantity]) => { + PersistentVolumeSpec_CapacityEntry.encode( + { key: key as any, value }, + writer.uint32(10).fork(), + ).join(); + }); + if (message.persistentVolumeSource !== undefined) { + PersistentVolumeSource.encode(message.persistentVolumeSource, writer.uint32(18).fork()).join(); + } + for (const v of message.accessModes) { + writer.uint32(26).string(v!); + } + if (message.claimRef !== undefined) { + ObjectReference.encode(message.claimRef, writer.uint32(34).fork()).join(); + } + if ( + message.persistentVolumeReclaimPolicy !== undefined && + message.persistentVolumeReclaimPolicy !== '' + ) { + writer.uint32(42).string(message.persistentVolumeReclaimPolicy); + } + if (message.storageClassName !== undefined && message.storageClassName !== '') { + writer.uint32(50).string(message.storageClassName); + } + for (const v of message.mountOptions) { + writer.uint32(58).string(v!); + } + if (message.volumeMode !== undefined && message.volumeMode !== '') { + writer.uint32(66).string(message.volumeMode); + } + if (message.nodeAffinity !== undefined) { + VolumeNodeAffinity.encode(message.nodeAffinity, writer.uint32(74).fork()).join(); + } + if (message.volumeAttributesClassName !== undefined && message.volumeAttributesClassName !== '') { + writer.uint32(82).string(message.volumeAttributesClassName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + const entry1 = PersistentVolumeSpec_CapacityEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.capacity[entry1.key] = entry1.value; + } + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.persistentVolumeSource = PersistentVolumeSource.decode( + reader, + reader.uint32(), + ); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.accessModes.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.claimRef = ObjectReference.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.persistentVolumeReclaimPolicy = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.storageClassName = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.mountOptions.push(reader.string()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.volumeMode = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.nodeAffinity = VolumeNodeAffinity.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.volumeAttributesClassName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeSpec { + return { + capacity: isObject(object.capacity) + ? (globalThis.Object.entries(object.capacity) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + persistentVolumeSource: isSet(object.persistentVolumeSource) + ? PersistentVolumeSource.fromJSON(object.persistentVolumeSource) + : undefined, + accessModes: globalThis.Array.isArray(object?.accessModes) + ? object.accessModes.map((e: any) => globalThis.String(e)) + : [], + claimRef: isSet(object.claimRef) ? ObjectReference.fromJSON(object.claimRef) : undefined, + persistentVolumeReclaimPolicy: isSet(object.persistentVolumeReclaimPolicy) + ? globalThis.String(object.persistentVolumeReclaimPolicy) + : '', + storageClassName: isSet(object.storageClassName) + ? globalThis.String(object.storageClassName) + : '', + mountOptions: globalThis.Array.isArray(object?.mountOptions) + ? object.mountOptions.map((e: any) => globalThis.String(e)) + : [], + volumeMode: isSet(object.volumeMode) ? globalThis.String(object.volumeMode) : '', + nodeAffinity: isSet(object.nodeAffinity) + ? VolumeNodeAffinity.fromJSON(object.nodeAffinity) + : undefined, + volumeAttributesClassName: isSet(object.volumeAttributesClassName) + ? globalThis.String(object.volumeAttributesClassName) + : '', + }; + }, + + toJSON(message: PersistentVolumeSpec): unknown { + const obj: any = {}; + if (message.capacity) { + const entries = globalThis.Object.entries(message.capacity) as [string, Quantity][]; + if (entries.length > 0) { + obj.capacity = {}; + entries.forEach(([k, v]) => { + obj.capacity[k] = Quantity.toJSON(v); + }); + } + } + if (message.persistentVolumeSource !== undefined) { + obj.persistentVolumeSource = PersistentVolumeSource.toJSON(message.persistentVolumeSource); + } + if (message.accessModes?.length) { + obj.accessModes = message.accessModes; + } + if (message.claimRef !== undefined) { + obj.claimRef = ObjectReference.toJSON(message.claimRef); + } + if ( + message.persistentVolumeReclaimPolicy !== undefined && + message.persistentVolumeReclaimPolicy !== '' + ) { + obj.persistentVolumeReclaimPolicy = message.persistentVolumeReclaimPolicy; + } + if (message.storageClassName !== undefined && message.storageClassName !== '') { + obj.storageClassName = message.storageClassName; + } + if (message.mountOptions?.length) { + obj.mountOptions = message.mountOptions; + } + if (message.volumeMode !== undefined && message.volumeMode !== '') { + obj.volumeMode = message.volumeMode; + } + if (message.nodeAffinity !== undefined) { + obj.nodeAffinity = VolumeNodeAffinity.toJSON(message.nodeAffinity); + } + if (message.volumeAttributesClassName !== undefined && message.volumeAttributesClassName !== '') { + obj.volumeAttributesClassName = message.volumeAttributesClassName; + } + return obj; + }, + + create, I>>(base?: I): PersistentVolumeSpec { + return PersistentVolumeSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PersistentVolumeSpec { + const message = createBasePersistentVolumeSpec(); + message.capacity = (globalThis.Object.entries(object.capacity ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + message.persistentVolumeSource = + object.persistentVolumeSource !== undefined && object.persistentVolumeSource !== null + ? PersistentVolumeSource.fromPartial(object.persistentVolumeSource) + : undefined; + message.accessModes = object.accessModes?.map((e) => e) || []; + message.claimRef = + object.claimRef !== undefined && object.claimRef !== null + ? ObjectReference.fromPartial(object.claimRef) + : undefined; + message.persistentVolumeReclaimPolicy = object.persistentVolumeReclaimPolicy ?? ''; + message.storageClassName = object.storageClassName ?? ''; + message.mountOptions = object.mountOptions?.map((e) => e) || []; + message.volumeMode = object.volumeMode ?? ''; + message.nodeAffinity = + object.nodeAffinity !== undefined && object.nodeAffinity !== null + ? VolumeNodeAffinity.fromPartial(object.nodeAffinity) + : undefined; + message.volumeAttributesClassName = object.volumeAttributesClassName ?? ''; + return message; + }, +}; + +function createBasePersistentVolumeSpec_CapacityEntry(): PersistentVolumeSpec_CapacityEntry { + return { key: '', value: undefined }; +} + +export const PersistentVolumeSpec_CapacityEntry: MessageFns = { + encode( + message: PersistentVolumeSpec_CapacityEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeSpec_CapacityEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeSpec_CapacityEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeSpec_CapacityEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: PersistentVolumeSpec_CapacityEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): PersistentVolumeSpec_CapacityEntry { + return PersistentVolumeSpec_CapacityEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PersistentVolumeSpec_CapacityEntry { + const message = createBasePersistentVolumeSpec_CapacityEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBasePersistentVolumeStatus(): PersistentVolumeStatus { + return { phase: '', message: '', reason: '', lastPhaseTransitionTime: undefined }; +} + +export const PersistentVolumeStatus: MessageFns = { + encode(message: PersistentVolumeStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.phase !== undefined && message.phase !== '') { + writer.uint32(10).string(message.phase); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(18).string(message.message); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(26).string(message.reason); + } + if (message.lastPhaseTransitionTime !== undefined) { + Time.encode(message.lastPhaseTransitionTime, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersistentVolumeStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersistentVolumeStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.phase = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.reason = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lastPhaseTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PersistentVolumeStatus { + return { + phase: isSet(object.phase) ? globalThis.String(object.phase) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + lastPhaseTransitionTime: isSet(object.lastPhaseTransitionTime) + ? Time.fromJSON(object.lastPhaseTransitionTime) + : undefined, + }; + }, + + toJSON(message: PersistentVolumeStatus): unknown { + const obj: any = {}; + if (message.phase !== undefined && message.phase !== '') { + obj.phase = message.phase; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.lastPhaseTransitionTime !== undefined) { + obj.lastPhaseTransitionTime = Time.toJSON(message.lastPhaseTransitionTime); + } + return obj; + }, + + create, I>>(base?: I): PersistentVolumeStatus { + return PersistentVolumeStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PersistentVolumeStatus { + const message = createBasePersistentVolumeStatus(); + message.phase = object.phase ?? ''; + message.message = object.message ?? ''; + message.reason = object.reason ?? ''; + message.lastPhaseTransitionTime = + object.lastPhaseTransitionTime !== undefined && object.lastPhaseTransitionTime !== null + ? Time.fromPartial(object.lastPhaseTransitionTime) + : undefined; + return message; + }, +}; + +function createBasePhotonPersistentDiskVolumeSource(): PhotonPersistentDiskVolumeSource { + return { pdID: '', fsType: '' }; +} + +export const PhotonPersistentDiskVolumeSource: MessageFns = { + encode( + message: PhotonPersistentDiskVolumeSource, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.pdID !== undefined && message.pdID !== '') { + writer.uint32(10).string(message.pdID); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(18).string(message.fsType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PhotonPersistentDiskVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePhotonPersistentDiskVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.pdID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fsType = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PhotonPersistentDiskVolumeSource { + return { + pdID: isSet(object.pdID) ? globalThis.String(object.pdID) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + }; + }, + + toJSON(message: PhotonPersistentDiskVolumeSource): unknown { + const obj: any = {}; + if (message.pdID !== undefined && message.pdID !== '') { + obj.pdID = message.pdID; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + return obj; + }, + + create, I>>( + base?: I, + ): PhotonPersistentDiskVolumeSource { + return PhotonPersistentDiskVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PhotonPersistentDiskVolumeSource { + const message = createBasePhotonPersistentDiskVolumeSource(); + message.pdID = object.pdID ?? ''; + message.fsType = object.fsType ?? ''; + return message; + }, +}; + +function createBasePod(): Pod { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const Pod: MessageFns = { + encode(message: Pod, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + PodSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + PodStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pod { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = PodSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = PodStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Pod { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? PodSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? PodStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: Pod): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = PodSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = PodStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): Pod { + return Pod.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pod { + const message = createBasePod(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null ? PodSpec.fromPartial(object.spec) : undefined; + message.status = + object.status !== undefined && object.status !== null + ? PodStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBasePodAffinity(): PodAffinity { + return { + requiredDuringSchedulingIgnoredDuringExecution: [], + preferredDuringSchedulingIgnoredDuringExecution: [], + }; +} + +export const PodAffinity: MessageFns = { + encode(message: PodAffinity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requiredDuringSchedulingIgnoredDuringExecution) { + PodAffinityTerm.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.preferredDuringSchedulingIgnoredDuringExecution) { + WeightedPodAffinityTerm.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodAffinity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodAffinity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.requiredDuringSchedulingIgnoredDuringExecution.push( + PodAffinityTerm.decode(reader, reader.uint32()), + ); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.preferredDuringSchedulingIgnoredDuringExecution.push( + WeightedPodAffinityTerm.decode(reader, reader.uint32()), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodAffinity { + return { + requiredDuringSchedulingIgnoredDuringExecution: globalThis.Array.isArray( + object?.requiredDuringSchedulingIgnoredDuringExecution, + ) + ? object.requiredDuringSchedulingIgnoredDuringExecution.map((e: any) => + PodAffinityTerm.fromJSON(e), + ) + : [], + preferredDuringSchedulingIgnoredDuringExecution: globalThis.Array.isArray( + object?.preferredDuringSchedulingIgnoredDuringExecution, + ) + ? object.preferredDuringSchedulingIgnoredDuringExecution.map((e: any) => + WeightedPodAffinityTerm.fromJSON(e), + ) + : [], + }; + }, + + toJSON(message: PodAffinity): unknown { + const obj: any = {}; + if (message.requiredDuringSchedulingIgnoredDuringExecution?.length) { + obj.requiredDuringSchedulingIgnoredDuringExecution = + message.requiredDuringSchedulingIgnoredDuringExecution.map((e) => PodAffinityTerm.toJSON(e)); + } + if (message.preferredDuringSchedulingIgnoredDuringExecution?.length) { + obj.preferredDuringSchedulingIgnoredDuringExecution = + message.preferredDuringSchedulingIgnoredDuringExecution.map((e) => + WeightedPodAffinityTerm.toJSON(e), + ); + } + return obj; + }, + + create, I>>(base?: I): PodAffinity { + return PodAffinity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodAffinity { + const message = createBasePodAffinity(); + message.requiredDuringSchedulingIgnoredDuringExecution = + object.requiredDuringSchedulingIgnoredDuringExecution?.map((e) => + PodAffinityTerm.fromPartial(e), + ) || []; + message.preferredDuringSchedulingIgnoredDuringExecution = + object.preferredDuringSchedulingIgnoredDuringExecution?.map((e) => + WeightedPodAffinityTerm.fromPartial(e), + ) || []; + return message; + }, +}; + +function createBasePodAffinityTerm(): PodAffinityTerm { + return { + labelSelector: undefined, + namespaces: [], + topologyKey: '', + namespaceSelector: undefined, + matchLabelKeys: [], + mismatchLabelKeys: [], + }; +} + +export const PodAffinityTerm: MessageFns = { + encode(message: PodAffinityTerm, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.labelSelector !== undefined) { + LabelSelector.encode(message.labelSelector, writer.uint32(10).fork()).join(); + } + for (const v of message.namespaces) { + writer.uint32(18).string(v!); + } + if (message.topologyKey !== undefined && message.topologyKey !== '') { + writer.uint32(26).string(message.topologyKey); + } + if (message.namespaceSelector !== undefined) { + LabelSelector.encode(message.namespaceSelector, writer.uint32(34).fork()).join(); + } + for (const v of message.matchLabelKeys) { + writer.uint32(42).string(v!); + } + for (const v of message.mismatchLabelKeys) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodAffinityTerm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodAffinityTerm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.labelSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.namespaces.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.topologyKey = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.namespaceSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.matchLabelKeys.push(reader.string()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.mismatchLabelKeys.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodAffinityTerm { + return { + labelSelector: isSet(object.labelSelector) + ? LabelSelector.fromJSON(object.labelSelector) + : undefined, + namespaces: globalThis.Array.isArray(object?.namespaces) + ? object.namespaces.map((e: any) => globalThis.String(e)) + : [], + topologyKey: isSet(object.topologyKey) ? globalThis.String(object.topologyKey) : '', + namespaceSelector: isSet(object.namespaceSelector) + ? LabelSelector.fromJSON(object.namespaceSelector) + : undefined, + matchLabelKeys: globalThis.Array.isArray(object?.matchLabelKeys) + ? object.matchLabelKeys.map((e: any) => globalThis.String(e)) + : [], + mismatchLabelKeys: globalThis.Array.isArray(object?.mismatchLabelKeys) + ? object.mismatchLabelKeys.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: PodAffinityTerm): unknown { + const obj: any = {}; + if (message.labelSelector !== undefined) { + obj.labelSelector = LabelSelector.toJSON(message.labelSelector); + } + if (message.namespaces?.length) { + obj.namespaces = message.namespaces; + } + if (message.topologyKey !== undefined && message.topologyKey !== '') { + obj.topologyKey = message.topologyKey; + } + if (message.namespaceSelector !== undefined) { + obj.namespaceSelector = LabelSelector.toJSON(message.namespaceSelector); + } + if (message.matchLabelKeys?.length) { + obj.matchLabelKeys = message.matchLabelKeys; + } + if (message.mismatchLabelKeys?.length) { + obj.mismatchLabelKeys = message.mismatchLabelKeys; + } + return obj; + }, + + create, I>>(base?: I): PodAffinityTerm { + return PodAffinityTerm.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodAffinityTerm { + const message = createBasePodAffinityTerm(); + message.labelSelector = + object.labelSelector !== undefined && object.labelSelector !== null + ? LabelSelector.fromPartial(object.labelSelector) + : undefined; + message.namespaces = object.namespaces?.map((e) => e) || []; + message.topologyKey = object.topologyKey ?? ''; + message.namespaceSelector = + object.namespaceSelector !== undefined && object.namespaceSelector !== null + ? LabelSelector.fromPartial(object.namespaceSelector) + : undefined; + message.matchLabelKeys = object.matchLabelKeys?.map((e) => e) || []; + message.mismatchLabelKeys = object.mismatchLabelKeys?.map((e) => e) || []; + return message; + }, +}; + +function createBasePodAntiAffinity(): PodAntiAffinity { + return { + requiredDuringSchedulingIgnoredDuringExecution: [], + preferredDuringSchedulingIgnoredDuringExecution: [], + }; +} + +export const PodAntiAffinity: MessageFns = { + encode(message: PodAntiAffinity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requiredDuringSchedulingIgnoredDuringExecution) { + PodAffinityTerm.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.preferredDuringSchedulingIgnoredDuringExecution) { + WeightedPodAffinityTerm.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodAntiAffinity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodAntiAffinity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.requiredDuringSchedulingIgnoredDuringExecution.push( + PodAffinityTerm.decode(reader, reader.uint32()), + ); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.preferredDuringSchedulingIgnoredDuringExecution.push( + WeightedPodAffinityTerm.decode(reader, reader.uint32()), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodAntiAffinity { + return { + requiredDuringSchedulingIgnoredDuringExecution: globalThis.Array.isArray( + object?.requiredDuringSchedulingIgnoredDuringExecution, + ) + ? object.requiredDuringSchedulingIgnoredDuringExecution.map((e: any) => + PodAffinityTerm.fromJSON(e), + ) + : [], + preferredDuringSchedulingIgnoredDuringExecution: globalThis.Array.isArray( + object?.preferredDuringSchedulingIgnoredDuringExecution, + ) + ? object.preferredDuringSchedulingIgnoredDuringExecution.map((e: any) => + WeightedPodAffinityTerm.fromJSON(e), + ) + : [], + }; + }, + + toJSON(message: PodAntiAffinity): unknown { + const obj: any = {}; + if (message.requiredDuringSchedulingIgnoredDuringExecution?.length) { + obj.requiredDuringSchedulingIgnoredDuringExecution = + message.requiredDuringSchedulingIgnoredDuringExecution.map((e) => PodAffinityTerm.toJSON(e)); + } + if (message.preferredDuringSchedulingIgnoredDuringExecution?.length) { + obj.preferredDuringSchedulingIgnoredDuringExecution = + message.preferredDuringSchedulingIgnoredDuringExecution.map((e) => + WeightedPodAffinityTerm.toJSON(e), + ); + } + return obj; + }, + + create, I>>(base?: I): PodAntiAffinity { + return PodAntiAffinity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodAntiAffinity { + const message = createBasePodAntiAffinity(); + message.requiredDuringSchedulingIgnoredDuringExecution = + object.requiredDuringSchedulingIgnoredDuringExecution?.map((e) => + PodAffinityTerm.fromPartial(e), + ) || []; + message.preferredDuringSchedulingIgnoredDuringExecution = + object.preferredDuringSchedulingIgnoredDuringExecution?.map((e) => + WeightedPodAffinityTerm.fromPartial(e), + ) || []; + return message; + }, +}; + +function createBasePodAttachOptions(): PodAttachOptions { + return { stdin: false, stdout: false, stderr: false, tty: false, container: '' }; +} + +export const PodAttachOptions: MessageFns = { + encode(message: PodAttachOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stdin !== undefined && message.stdin !== false) { + writer.uint32(8).bool(message.stdin); + } + if (message.stdout !== undefined && message.stdout !== false) { + writer.uint32(16).bool(message.stdout); + } + if (message.stderr !== undefined && message.stderr !== false) { + writer.uint32(24).bool(message.stderr); + } + if (message.tty !== undefined && message.tty !== false) { + writer.uint32(32).bool(message.tty); + } + if (message.container !== undefined && message.container !== '') { + writer.uint32(42).string(message.container); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodAttachOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodAttachOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.stdin = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.stdout = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.stderr = reader.bool(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.tty = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.container = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodAttachOptions { + return { + stdin: isSet(object.stdin) ? globalThis.Boolean(object.stdin) : false, + stdout: isSet(object.stdout) ? globalThis.Boolean(object.stdout) : false, + stderr: isSet(object.stderr) ? globalThis.Boolean(object.stderr) : false, + tty: isSet(object.tty) ? globalThis.Boolean(object.tty) : false, + container: isSet(object.container) ? globalThis.String(object.container) : '', + }; + }, + + toJSON(message: PodAttachOptions): unknown { + const obj: any = {}; + if (message.stdin !== undefined && message.stdin !== false) { + obj.stdin = message.stdin; + } + if (message.stdout !== undefined && message.stdout !== false) { + obj.stdout = message.stdout; + } + if (message.stderr !== undefined && message.stderr !== false) { + obj.stderr = message.stderr; + } + if (message.tty !== undefined && message.tty !== false) { + obj.tty = message.tty; + } + if (message.container !== undefined && message.container !== '') { + obj.container = message.container; + } + return obj; + }, + + create, I>>(base?: I): PodAttachOptions { + return PodAttachOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodAttachOptions { + const message = createBasePodAttachOptions(); + message.stdin = object.stdin ?? false; + message.stdout = object.stdout ?? false; + message.stderr = object.stderr ?? false; + message.tty = object.tty ?? false; + message.container = object.container ?? ''; + return message; + }, +}; + +function createBasePodCertificateProjection(): PodCertificateProjection { + return { + signerName: '', + keyType: '', + maxExpirationSeconds: 0, + credentialBundlePath: '', + keyPath: '', + certificateChainPath: '', + userAnnotations: {}, + user: 0, + }; +} + +export const PodCertificateProjection: MessageFns = { + encode(message: PodCertificateProjection, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signerName !== undefined && message.signerName !== '') { + writer.uint32(10).string(message.signerName); + } + if (message.keyType !== undefined && message.keyType !== '') { + writer.uint32(18).string(message.keyType); + } + if (message.maxExpirationSeconds !== undefined && message.maxExpirationSeconds !== 0) { + writer.uint32(24).int32(message.maxExpirationSeconds); + } + if (message.credentialBundlePath !== undefined && message.credentialBundlePath !== '') { + writer.uint32(34).string(message.credentialBundlePath); + } + if (message.keyPath !== undefined && message.keyPath !== '') { + writer.uint32(42).string(message.keyPath); + } + if (message.certificateChainPath !== undefined && message.certificateChainPath !== '') { + writer.uint32(50).string(message.certificateChainPath); + } + globalThis.Object.entries(message.userAnnotations).forEach(([key, value]: [string, string]) => { + PodCertificateProjection_UserAnnotationsEntry.encode( + { key: key as any, value }, + writer.uint32(58).fork(), + ).join(); + }); + if (message.user !== undefined && message.user !== 0) { + writer.uint32(64).int64(message.user); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodCertificateProjection { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodCertificateProjection(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.signerName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.keyType = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxExpirationSeconds = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.credentialBundlePath = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.keyPath = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.certificateChainPath = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + const entry7 = PodCertificateProjection_UserAnnotationsEntry.decode( + reader, + reader.uint32(), + ); + if (entry7.value !== undefined) { + message.userAnnotations[entry7.key] = entry7.value; + } + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.user = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodCertificateProjection { + return { + signerName: isSet(object.signerName) ? globalThis.String(object.signerName) : '', + keyType: isSet(object.keyType) ? globalThis.String(object.keyType) : '', + maxExpirationSeconds: isSet(object.maxExpirationSeconds) + ? globalThis.Number(object.maxExpirationSeconds) + : 0, + credentialBundlePath: isSet(object.credentialBundlePath) + ? globalThis.String(object.credentialBundlePath) + : '', + keyPath: isSet(object.keyPath) ? globalThis.String(object.keyPath) : '', + certificateChainPath: isSet(object.certificateChainPath) + ? globalThis.String(object.certificateChainPath) + : '', + userAnnotations: isObject(object.userAnnotations) + ? (globalThis.Object.entries(object.userAnnotations) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + user: isSet(object.user) ? globalThis.Number(object.user) : 0, + }; + }, + + toJSON(message: PodCertificateProjection): unknown { + const obj: any = {}; + if (message.signerName !== undefined && message.signerName !== '') { + obj.signerName = message.signerName; + } + if (message.keyType !== undefined && message.keyType !== '') { + obj.keyType = message.keyType; + } + if (message.maxExpirationSeconds !== undefined && message.maxExpirationSeconds !== 0) { + obj.maxExpirationSeconds = Math.round(message.maxExpirationSeconds); + } + if (message.credentialBundlePath !== undefined && message.credentialBundlePath !== '') { + obj.credentialBundlePath = message.credentialBundlePath; + } + if (message.keyPath !== undefined && message.keyPath !== '') { + obj.keyPath = message.keyPath; + } + if (message.certificateChainPath !== undefined && message.certificateChainPath !== '') { + obj.certificateChainPath = message.certificateChainPath; + } + if (message.userAnnotations) { + const entries = globalThis.Object.entries(message.userAnnotations) as [string, string][]; + if (entries.length > 0) { + obj.userAnnotations = {}; + entries.forEach(([k, v]) => { + obj.userAnnotations[k] = v; + }); + } + } + if (message.user !== undefined && message.user !== 0) { + obj.user = Math.round(message.user); + } + return obj; + }, + + create, I>>(base?: I): PodCertificateProjection { + return PodCertificateProjection.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodCertificateProjection { + const message = createBasePodCertificateProjection(); + message.signerName = object.signerName ?? ''; + message.keyType = object.keyType ?? ''; + message.maxExpirationSeconds = object.maxExpirationSeconds ?? 0; + message.credentialBundlePath = object.credentialBundlePath ?? ''; + message.keyPath = object.keyPath ?? ''; + message.certificateChainPath = object.certificateChainPath ?? ''; + message.userAnnotations = ( + globalThis.Object.entries(object.userAnnotations ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.user = object.user ?? 0; + return message; + }, +}; + +function createBasePodCertificateProjection_UserAnnotationsEntry(): PodCertificateProjection_UserAnnotationsEntry { + return { key: '', value: '' }; +} + +export const PodCertificateProjection_UserAnnotationsEntry: MessageFns = + { + encode( + message: PodCertificateProjection_UserAnnotationsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): PodCertificateProjection_UserAnnotationsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodCertificateProjection_UserAnnotationsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodCertificateProjection_UserAnnotationsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: PodCertificateProjection_UserAnnotationsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): PodCertificateProjection_UserAnnotationsEntry { + return PodCertificateProjection_UserAnnotationsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodCertificateProjection_UserAnnotationsEntry { + const message = createBasePodCertificateProjection_UserAnnotationsEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, + }; + +function createBasePodCondition(): PodCondition { + return { + type: '', + observedGeneration: 0, + status: '', + lastProbeTime: undefined, + lastTransitionTime: undefined, + reason: '', + message: '', + }; +} + +export const PodCondition: MessageFns = { + encode(message: PodCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(56).int64(message.observedGeneration); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastProbeTime !== undefined) { + Time.encode(message.lastProbeTime, writer.uint32(26).fork()).join(); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(34).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(42).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(50).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastProbeTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.reason = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastProbeTime: isSet(object.lastProbeTime) ? Time.fromJSON(object.lastProbeTime) : undefined, + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: PodCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastProbeTime !== undefined) { + obj.lastProbeTime = Time.toJSON(message.lastProbeTime); + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): PodCondition { + return PodCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodCondition { + const message = createBasePodCondition(); + message.type = object.type ?? ''; + message.observedGeneration = object.observedGeneration ?? 0; + message.status = object.status ?? ''; + message.lastProbeTime = + object.lastProbeTime !== undefined && object.lastProbeTime !== null + ? Time.fromPartial(object.lastProbeTime) + : undefined; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBasePodDNSConfig(): PodDNSConfig { + return { nameservers: [], searches: [], options: [] }; +} + +export const PodDNSConfig: MessageFns = { + encode(message: PodDNSConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.nameservers) { + writer.uint32(10).string(v!); + } + for (const v of message.searches) { + writer.uint32(18).string(v!); + } + for (const v of message.options) { + PodDNSConfigOption.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodDNSConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodDNSConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.nameservers.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.searches.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.options.push(PodDNSConfigOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodDNSConfig { + return { + nameservers: globalThis.Array.isArray(object?.nameservers) + ? object.nameservers.map((e: any) => globalThis.String(e)) + : [], + searches: globalThis.Array.isArray(object?.searches) + ? object.searches.map((e: any) => globalThis.String(e)) + : [], + options: globalThis.Array.isArray(object?.options) + ? object.options.map((e: any) => PodDNSConfigOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PodDNSConfig): unknown { + const obj: any = {}; + if (message.nameservers?.length) { + obj.nameservers = message.nameservers; + } + if (message.searches?.length) { + obj.searches = message.searches; + } + if (message.options?.length) { + obj.options = message.options.map((e) => PodDNSConfigOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PodDNSConfig { + return PodDNSConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodDNSConfig { + const message = createBasePodDNSConfig(); + message.nameservers = object.nameservers?.map((e) => e) || []; + message.searches = object.searches?.map((e) => e) || []; + message.options = object.options?.map((e) => PodDNSConfigOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePodDNSConfigOption(): PodDNSConfigOption { + return { name: '', value: '' }; +} + +export const PodDNSConfigOption: MessageFns = { + encode(message: PodDNSConfigOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.value !== undefined && message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodDNSConfigOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodDNSConfigOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodDNSConfigOption { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: PodDNSConfigOption): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.value !== undefined && message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): PodDNSConfigOption { + return PodDNSConfigOption.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodDNSConfigOption { + const message = createBasePodDNSConfigOption(); + message.name = object.name ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBasePodExecOptions(): PodExecOptions { + return { stdin: false, stdout: false, stderr: false, tty: false, container: '', command: [] }; +} + +export const PodExecOptions: MessageFns = { + encode(message: PodExecOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stdin !== undefined && message.stdin !== false) { + writer.uint32(8).bool(message.stdin); + } + if (message.stdout !== undefined && message.stdout !== false) { + writer.uint32(16).bool(message.stdout); + } + if (message.stderr !== undefined && message.stderr !== false) { + writer.uint32(24).bool(message.stderr); + } + if (message.tty !== undefined && message.tty !== false) { + writer.uint32(32).bool(message.tty); + } + if (message.container !== undefined && message.container !== '') { + writer.uint32(42).string(message.container); + } + for (const v of message.command) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodExecOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodExecOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.stdin = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.stdout = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.stderr = reader.bool(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.tty = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.container = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.command.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodExecOptions { + return { + stdin: isSet(object.stdin) ? globalThis.Boolean(object.stdin) : false, + stdout: isSet(object.stdout) ? globalThis.Boolean(object.stdout) : false, + stderr: isSet(object.stderr) ? globalThis.Boolean(object.stderr) : false, + tty: isSet(object.tty) ? globalThis.Boolean(object.tty) : false, + container: isSet(object.container) ? globalThis.String(object.container) : '', + command: globalThis.Array.isArray(object?.command) + ? object.command.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: PodExecOptions): unknown { + const obj: any = {}; + if (message.stdin !== undefined && message.stdin !== false) { + obj.stdin = message.stdin; + } + if (message.stdout !== undefined && message.stdout !== false) { + obj.stdout = message.stdout; + } + if (message.stderr !== undefined && message.stderr !== false) { + obj.stderr = message.stderr; + } + if (message.tty !== undefined && message.tty !== false) { + obj.tty = message.tty; + } + if (message.container !== undefined && message.container !== '') { + obj.container = message.container; + } + if (message.command?.length) { + obj.command = message.command; + } + return obj; + }, + + create, I>>(base?: I): PodExecOptions { + return PodExecOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodExecOptions { + const message = createBasePodExecOptions(); + message.stdin = object.stdin ?? false; + message.stdout = object.stdout ?? false; + message.stderr = object.stderr ?? false; + message.tty = object.tty ?? false; + message.container = object.container ?? ''; + message.command = object.command?.map((e) => e) || []; + return message; + }, +}; + +function createBasePodExtendedResourceClaimStatus(): PodExtendedResourceClaimStatus { + return { requestMappings: [], resourceClaimName: '' }; +} + +export const PodExtendedResourceClaimStatus: MessageFns = { + encode(message: PodExtendedResourceClaimStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.requestMappings) { + ContainerExtendedResourceRequest.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.resourceClaimName !== undefined && message.resourceClaimName !== '') { + writer.uint32(18).string(message.resourceClaimName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodExtendedResourceClaimStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodExtendedResourceClaimStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.requestMappings.push( + ContainerExtendedResourceRequest.decode(reader, reader.uint32()), + ); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resourceClaimName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodExtendedResourceClaimStatus { + return { + requestMappings: globalThis.Array.isArray(object?.requestMappings) + ? object.requestMappings.map((e: any) => ContainerExtendedResourceRequest.fromJSON(e)) + : [], + resourceClaimName: isSet(object.resourceClaimName) + ? globalThis.String(object.resourceClaimName) + : '', + }; + }, + + toJSON(message: PodExtendedResourceClaimStatus): unknown { + const obj: any = {}; + if (message.requestMappings?.length) { + obj.requestMappings = message.requestMappings.map((e) => + ContainerExtendedResourceRequest.toJSON(e), + ); + } + if (message.resourceClaimName !== undefined && message.resourceClaimName !== '') { + obj.resourceClaimName = message.resourceClaimName; + } + return obj; + }, + + create, I>>( + base?: I, + ): PodExtendedResourceClaimStatus { + return PodExtendedResourceClaimStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodExtendedResourceClaimStatus { + const message = createBasePodExtendedResourceClaimStatus(); + message.requestMappings = + object.requestMappings?.map((e) => ContainerExtendedResourceRequest.fromPartial(e)) || []; + message.resourceClaimName = object.resourceClaimName ?? ''; + return message; + }, +}; + +function createBasePodIP(): PodIP { + return { ip: '' }; +} + +export const PodIP: MessageFns = { + encode(message: PodIP, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ip !== undefined && message.ip !== '') { + writer.uint32(10).string(message.ip); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodIP { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodIP(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ip = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodIP { + return { ip: isSet(object.ip) ? globalThis.String(object.ip) : '' }; + }, + + toJSON(message: PodIP): unknown { + const obj: any = {}; + if (message.ip !== undefined && message.ip !== '') { + obj.ip = message.ip; + } + return obj; + }, + + create, I>>(base?: I): PodIP { + return PodIP.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodIP { + const message = createBasePodIP(); + message.ip = object.ip ?? ''; + return message; + }, +}; + +function createBasePodList(): PodList { + return { metadata: undefined, items: [] }; +} + +export const PodList: MessageFns = { + encode(message: PodList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Pod.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Pod.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Pod.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PodList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Pod.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PodList { + return PodList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodList { + const message = createBasePodList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Pod.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePodLogOptions(): PodLogOptions { + return { + container: '', + follow: false, + previous: false, + sinceSeconds: 0, + sinceTime: undefined, + timestamps: false, + tailLines: 0, + limitBytes: 0, + insecureSkipTLSVerifyBackend: false, + stream: '', + }; +} + +export const PodLogOptions: MessageFns = { + encode(message: PodLogOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.container !== undefined && message.container !== '') { + writer.uint32(10).string(message.container); + } + if (message.follow !== undefined && message.follow !== false) { + writer.uint32(16).bool(message.follow); + } + if (message.previous !== undefined && message.previous !== false) { + writer.uint32(24).bool(message.previous); + } + if (message.sinceSeconds !== undefined && message.sinceSeconds !== 0) { + writer.uint32(32).int64(message.sinceSeconds); + } + if (message.sinceTime !== undefined) { + Time.encode(message.sinceTime, writer.uint32(42).fork()).join(); + } + if (message.timestamps !== undefined && message.timestamps !== false) { + writer.uint32(48).bool(message.timestamps); + } + if (message.tailLines !== undefined && message.tailLines !== 0) { + writer.uint32(56).int64(message.tailLines); + } + if (message.limitBytes !== undefined && message.limitBytes !== 0) { + writer.uint32(64).int64(message.limitBytes); + } + if ( + message.insecureSkipTLSVerifyBackend !== undefined && + message.insecureSkipTLSVerifyBackend !== false + ) { + writer.uint32(72).bool(message.insecureSkipTLSVerifyBackend); + } + if (message.stream !== undefined && message.stream !== '') { + writer.uint32(82).string(message.stream); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodLogOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodLogOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.container = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.follow = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.previous = reader.bool(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.sinceSeconds = longToNumber(reader.int64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.sinceTime = Time.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.timestamps = reader.bool(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.tailLines = longToNumber(reader.int64()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.limitBytes = longToNumber(reader.int64()); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.insecureSkipTLSVerifyBackend = reader.bool(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.stream = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodLogOptions { + return { + container: isSet(object.container) ? globalThis.String(object.container) : '', + follow: isSet(object.follow) ? globalThis.Boolean(object.follow) : false, + previous: isSet(object.previous) ? globalThis.Boolean(object.previous) : false, + sinceSeconds: isSet(object.sinceSeconds) ? globalThis.Number(object.sinceSeconds) : 0, + sinceTime: isSet(object.sinceTime) ? Time.fromJSON(object.sinceTime) : undefined, + timestamps: isSet(object.timestamps) ? globalThis.Boolean(object.timestamps) : false, + tailLines: isSet(object.tailLines) ? globalThis.Number(object.tailLines) : 0, + limitBytes: isSet(object.limitBytes) ? globalThis.Number(object.limitBytes) : 0, + insecureSkipTLSVerifyBackend: isSet(object.insecureSkipTLSVerifyBackend) + ? globalThis.Boolean(object.insecureSkipTLSVerifyBackend) + : false, + stream: isSet(object.stream) ? globalThis.String(object.stream) : '', + }; + }, + + toJSON(message: PodLogOptions): unknown { + const obj: any = {}; + if (message.container !== undefined && message.container !== '') { + obj.container = message.container; + } + if (message.follow !== undefined && message.follow !== false) { + obj.follow = message.follow; + } + if (message.previous !== undefined && message.previous !== false) { + obj.previous = message.previous; + } + if (message.sinceSeconds !== undefined && message.sinceSeconds !== 0) { + obj.sinceSeconds = Math.round(message.sinceSeconds); + } + if (message.sinceTime !== undefined) { + obj.sinceTime = Time.toJSON(message.sinceTime); + } + if (message.timestamps !== undefined && message.timestamps !== false) { + obj.timestamps = message.timestamps; + } + if (message.tailLines !== undefined && message.tailLines !== 0) { + obj.tailLines = Math.round(message.tailLines); + } + if (message.limitBytes !== undefined && message.limitBytes !== 0) { + obj.limitBytes = Math.round(message.limitBytes); + } + if ( + message.insecureSkipTLSVerifyBackend !== undefined && + message.insecureSkipTLSVerifyBackend !== false + ) { + obj.insecureSkipTLSVerifyBackend = message.insecureSkipTLSVerifyBackend; + } + if (message.stream !== undefined && message.stream !== '') { + obj.stream = message.stream; + } + return obj; + }, + + create, I>>(base?: I): PodLogOptions { + return PodLogOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodLogOptions { + const message = createBasePodLogOptions(); + message.container = object.container ?? ''; + message.follow = object.follow ?? false; + message.previous = object.previous ?? false; + message.sinceSeconds = object.sinceSeconds ?? 0; + message.sinceTime = + object.sinceTime !== undefined && object.sinceTime !== null + ? Time.fromPartial(object.sinceTime) + : undefined; + message.timestamps = object.timestamps ?? false; + message.tailLines = object.tailLines ?? 0; + message.limitBytes = object.limitBytes ?? 0; + message.insecureSkipTLSVerifyBackend = object.insecureSkipTLSVerifyBackend ?? false; + message.stream = object.stream ?? ''; + return message; + }, +}; + +function createBasePodOS(): PodOS { + return { name: '' }; +} + +export const PodOS: MessageFns = { + encode(message: PodOS, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodOS { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodOS(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodOS { + return { name: isSet(object.name) ? globalThis.String(object.name) : '' }; + }, + + toJSON(message: PodOS): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): PodOS { + return PodOS.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodOS { + const message = createBasePodOS(); + message.name = object.name ?? ''; + return message; + }, +}; + +function createBasePodPortForwardOptions(): PodPortForwardOptions { + return { ports: [] }; +} + +export const PodPortForwardOptions: MessageFns = { + encode(message: PodPortForwardOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ports) { + writer.uint32(8).int32(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodPortForwardOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodPortForwardOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.ports.push(reader.int32()); + + continue; + } + + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.ports.push(reader.int32()); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodPortForwardOptions { + return { + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: PodPortForwardOptions): unknown { + const obj: any = {}; + if (message.ports?.length) { + obj.ports = message.ports.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): PodPortForwardOptions { + return PodPortForwardOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodPortForwardOptions { + const message = createBasePodPortForwardOptions(); + message.ports = object.ports?.map((e) => e) || []; + return message; + }, +}; + +function createBasePodProxyOptions(): PodProxyOptions { + return { path: '' }; +} + +export const PodProxyOptions: MessageFns = { + encode(message: PodProxyOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined && message.path !== '') { + writer.uint32(10).string(message.path); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodProxyOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodProxyOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodProxyOptions { + return { path: isSet(object.path) ? globalThis.String(object.path) : '' }; + }, + + toJSON(message: PodProxyOptions): unknown { + const obj: any = {}; + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + return obj; + }, + + create, I>>(base?: I): PodProxyOptions { + return PodProxyOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodProxyOptions { + const message = createBasePodProxyOptions(); + message.path = object.path ?? ''; + return message; + }, +}; + +function createBasePodReadinessGate(): PodReadinessGate { + return { conditionType: '' }; +} + +export const PodReadinessGate: MessageFns = { + encode(message: PodReadinessGate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.conditionType !== undefined && message.conditionType !== '') { + writer.uint32(10).string(message.conditionType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodReadinessGate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodReadinessGate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.conditionType = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodReadinessGate { + return { conditionType: isSet(object.conditionType) ? globalThis.String(object.conditionType) : '' }; + }, + + toJSON(message: PodReadinessGate): unknown { + const obj: any = {}; + if (message.conditionType !== undefined && message.conditionType !== '') { + obj.conditionType = message.conditionType; + } + return obj; + }, + + create, I>>(base?: I): PodReadinessGate { + return PodReadinessGate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodReadinessGate { + const message = createBasePodReadinessGate(); + message.conditionType = object.conditionType ?? ''; + return message; + }, +}; + +function createBasePodResourceClaim(): PodResourceClaim { + return { name: '', resourceClaimName: '', resourceClaimTemplateName: '' }; +} + +export const PodResourceClaim: MessageFns = { + encode(message: PodResourceClaim, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.resourceClaimName !== undefined && message.resourceClaimName !== '') { + writer.uint32(26).string(message.resourceClaimName); + } + if (message.resourceClaimTemplateName !== undefined && message.resourceClaimTemplateName !== '') { + writer.uint32(34).string(message.resourceClaimTemplateName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodResourceClaim { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodResourceClaim(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.resourceClaimName = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.resourceClaimTemplateName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodResourceClaim { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + resourceClaimName: isSet(object.resourceClaimName) + ? globalThis.String(object.resourceClaimName) + : '', + resourceClaimTemplateName: isSet(object.resourceClaimTemplateName) + ? globalThis.String(object.resourceClaimTemplateName) + : '', + }; + }, + + toJSON(message: PodResourceClaim): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.resourceClaimName !== undefined && message.resourceClaimName !== '') { + obj.resourceClaimName = message.resourceClaimName; + } + if (message.resourceClaimTemplateName !== undefined && message.resourceClaimTemplateName !== '') { + obj.resourceClaimTemplateName = message.resourceClaimTemplateName; + } + return obj; + }, + + create, I>>(base?: I): PodResourceClaim { + return PodResourceClaim.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodResourceClaim { + const message = createBasePodResourceClaim(); + message.name = object.name ?? ''; + message.resourceClaimName = object.resourceClaimName ?? ''; + message.resourceClaimTemplateName = object.resourceClaimTemplateName ?? ''; + return message; + }, +}; + +function createBasePodResourceClaimStatus(): PodResourceClaimStatus { + return { name: '', resourceClaimName: '' }; +} + +export const PodResourceClaimStatus: MessageFns = { + encode(message: PodResourceClaimStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.resourceClaimName !== undefined && message.resourceClaimName !== '') { + writer.uint32(18).string(message.resourceClaimName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodResourceClaimStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodResourceClaimStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resourceClaimName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodResourceClaimStatus { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + resourceClaimName: isSet(object.resourceClaimName) + ? globalThis.String(object.resourceClaimName) + : '', + }; + }, + + toJSON(message: PodResourceClaimStatus): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.resourceClaimName !== undefined && message.resourceClaimName !== '') { + obj.resourceClaimName = message.resourceClaimName; + } + return obj; + }, + + create, I>>(base?: I): PodResourceClaimStatus { + return PodResourceClaimStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodResourceClaimStatus { + const message = createBasePodResourceClaimStatus(); + message.name = object.name ?? ''; + message.resourceClaimName = object.resourceClaimName ?? ''; + return message; + }, +}; + +function createBasePodSchedulingGate(): PodSchedulingGate { + return { name: '' }; +} + +export const PodSchedulingGate: MessageFns = { + encode(message: PodSchedulingGate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodSchedulingGate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodSchedulingGate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodSchedulingGate { + return { name: isSet(object.name) ? globalThis.String(object.name) : '' }; + }, + + toJSON(message: PodSchedulingGate): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): PodSchedulingGate { + return PodSchedulingGate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodSchedulingGate { + const message = createBasePodSchedulingGate(); + message.name = object.name ?? ''; + return message; + }, +}; + +function createBasePodSchedulingGroup(): PodSchedulingGroup { + return { podGroupName: '' }; +} + +export const PodSchedulingGroup: MessageFns = { + encode(message: PodSchedulingGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.podGroupName !== undefined && message.podGroupName !== '') { + writer.uint32(10).string(message.podGroupName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodSchedulingGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodSchedulingGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.podGroupName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodSchedulingGroup { + return { podGroupName: isSet(object.podGroupName) ? globalThis.String(object.podGroupName) : '' }; + }, + + toJSON(message: PodSchedulingGroup): unknown { + const obj: any = {}; + if (message.podGroupName !== undefined && message.podGroupName !== '') { + obj.podGroupName = message.podGroupName; + } + return obj; + }, + + create, I>>(base?: I): PodSchedulingGroup { + return PodSchedulingGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodSchedulingGroup { + const message = createBasePodSchedulingGroup(); + message.podGroupName = object.podGroupName ?? ''; + return message; + }, +}; + +function createBasePodSecurityContext(): PodSecurityContext { + return { + seLinuxOptions: undefined, + windowsOptions: undefined, + runAsUser: 0, + runAsGroup: 0, + runAsNonRoot: false, + supplementalGroups: [], + supplementalGroupsPolicy: '', + fsGroup: 0, + sysctls: [], + fsGroupChangePolicy: '', + seccompProfile: undefined, + appArmorProfile: undefined, + seLinuxChangePolicy: '', + }; +} + +export const PodSecurityContext: MessageFns = { + encode(message: PodSecurityContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seLinuxOptions !== undefined) { + SELinuxOptions.encode(message.seLinuxOptions, writer.uint32(10).fork()).join(); + } + if (message.windowsOptions !== undefined) { + WindowsSecurityContextOptions.encode(message.windowsOptions, writer.uint32(66).fork()).join(); + } + if (message.runAsUser !== undefined && message.runAsUser !== 0) { + writer.uint32(16).int64(message.runAsUser); + } + if (message.runAsGroup !== undefined && message.runAsGroup !== 0) { + writer.uint32(48).int64(message.runAsGroup); + } + if (message.runAsNonRoot !== undefined && message.runAsNonRoot !== false) { + writer.uint32(24).bool(message.runAsNonRoot); + } + for (const v of message.supplementalGroups) { + writer.uint32(32).int64(v!); + } + if (message.supplementalGroupsPolicy !== undefined && message.supplementalGroupsPolicy !== '') { + writer.uint32(98).string(message.supplementalGroupsPolicy); + } + if (message.fsGroup !== undefined && message.fsGroup !== 0) { + writer.uint32(40).int64(message.fsGroup); + } + for (const v of message.sysctls) { + Sysctl.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.fsGroupChangePolicy !== undefined && message.fsGroupChangePolicy !== '') { + writer.uint32(74).string(message.fsGroupChangePolicy); + } + if (message.seccompProfile !== undefined) { + SeccompProfile.encode(message.seccompProfile, writer.uint32(82).fork()).join(); + } + if (message.appArmorProfile !== undefined) { + AppArmorProfile.encode(message.appArmorProfile, writer.uint32(90).fork()).join(); + } + if (message.seLinuxChangePolicy !== undefined && message.seLinuxChangePolicy !== '') { + writer.uint32(106).string(message.seLinuxChangePolicy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodSecurityContext { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodSecurityContext(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.seLinuxOptions = SELinuxOptions.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.windowsOptions = WindowsSecurityContextOptions.decode( + reader, + reader.uint32(), + ); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.runAsUser = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.runAsGroup = longToNumber(reader.int64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.runAsNonRoot = reader.bool(); + continue; + } + case 4: { + if (tag === 32) { + message.supplementalGroups.push(longToNumber(reader.int64())); + + continue; + } + + if (tag === 34) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supplementalGroups.push(longToNumber(reader.int64())); + } + + continue; + } + + break; + } + case 12: { + if (tag !== 98) { + break; + } + + message.supplementalGroupsPolicy = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.fsGroup = longToNumber(reader.int64()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.sysctls.push(Sysctl.decode(reader, reader.uint32())); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.fsGroupChangePolicy = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.seccompProfile = SeccompProfile.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.appArmorProfile = AppArmorProfile.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.seLinuxChangePolicy = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodSecurityContext { + return { + seLinuxOptions: isSet(object.seLinuxOptions) + ? SELinuxOptions.fromJSON(object.seLinuxOptions) + : undefined, + windowsOptions: isSet(object.windowsOptions) + ? WindowsSecurityContextOptions.fromJSON(object.windowsOptions) + : undefined, + runAsUser: isSet(object.runAsUser) ? globalThis.Number(object.runAsUser) : 0, + runAsGroup: isSet(object.runAsGroup) ? globalThis.Number(object.runAsGroup) : 0, + runAsNonRoot: isSet(object.runAsNonRoot) ? globalThis.Boolean(object.runAsNonRoot) : false, + supplementalGroups: globalThis.Array.isArray(object?.supplementalGroups) + ? object.supplementalGroups.map((e: any) => globalThis.Number(e)) + : [], + supplementalGroupsPolicy: isSet(object.supplementalGroupsPolicy) + ? globalThis.String(object.supplementalGroupsPolicy) + : '', + fsGroup: isSet(object.fsGroup) ? globalThis.Number(object.fsGroup) : 0, + sysctls: globalThis.Array.isArray(object?.sysctls) + ? object.sysctls.map((e: any) => Sysctl.fromJSON(e)) + : [], + fsGroupChangePolicy: isSet(object.fsGroupChangePolicy) + ? globalThis.String(object.fsGroupChangePolicy) + : '', + seccompProfile: isSet(object.seccompProfile) + ? SeccompProfile.fromJSON(object.seccompProfile) + : undefined, + appArmorProfile: isSet(object.appArmorProfile) + ? AppArmorProfile.fromJSON(object.appArmorProfile) + : undefined, + seLinuxChangePolicy: isSet(object.seLinuxChangePolicy) + ? globalThis.String(object.seLinuxChangePolicy) + : '', + }; + }, + + toJSON(message: PodSecurityContext): unknown { + const obj: any = {}; + if (message.seLinuxOptions !== undefined) { + obj.seLinuxOptions = SELinuxOptions.toJSON(message.seLinuxOptions); + } + if (message.windowsOptions !== undefined) { + obj.windowsOptions = WindowsSecurityContextOptions.toJSON(message.windowsOptions); + } + if (message.runAsUser !== undefined && message.runAsUser !== 0) { + obj.runAsUser = Math.round(message.runAsUser); + } + if (message.runAsGroup !== undefined && message.runAsGroup !== 0) { + obj.runAsGroup = Math.round(message.runAsGroup); + } + if (message.runAsNonRoot !== undefined && message.runAsNonRoot !== false) { + obj.runAsNonRoot = message.runAsNonRoot; + } + if (message.supplementalGroups?.length) { + obj.supplementalGroups = message.supplementalGroups.map((e) => Math.round(e)); + } + if (message.supplementalGroupsPolicy !== undefined && message.supplementalGroupsPolicy !== '') { + obj.supplementalGroupsPolicy = message.supplementalGroupsPolicy; + } + if (message.fsGroup !== undefined && message.fsGroup !== 0) { + obj.fsGroup = Math.round(message.fsGroup); + } + if (message.sysctls?.length) { + obj.sysctls = message.sysctls.map((e) => Sysctl.toJSON(e)); + } + if (message.fsGroupChangePolicy !== undefined && message.fsGroupChangePolicy !== '') { + obj.fsGroupChangePolicy = message.fsGroupChangePolicy; + } + if (message.seccompProfile !== undefined) { + obj.seccompProfile = SeccompProfile.toJSON(message.seccompProfile); + } + if (message.appArmorProfile !== undefined) { + obj.appArmorProfile = AppArmorProfile.toJSON(message.appArmorProfile); + } + if (message.seLinuxChangePolicy !== undefined && message.seLinuxChangePolicy !== '') { + obj.seLinuxChangePolicy = message.seLinuxChangePolicy; + } + return obj; + }, + + create, I>>(base?: I): PodSecurityContext { + return PodSecurityContext.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodSecurityContext { + const message = createBasePodSecurityContext(); + message.seLinuxOptions = + object.seLinuxOptions !== undefined && object.seLinuxOptions !== null + ? SELinuxOptions.fromPartial(object.seLinuxOptions) + : undefined; + message.windowsOptions = + object.windowsOptions !== undefined && object.windowsOptions !== null + ? WindowsSecurityContextOptions.fromPartial(object.windowsOptions) + : undefined; + message.runAsUser = object.runAsUser ?? 0; + message.runAsGroup = object.runAsGroup ?? 0; + message.runAsNonRoot = object.runAsNonRoot ?? false; + message.supplementalGroups = object.supplementalGroups?.map((e) => e) || []; + message.supplementalGroupsPolicy = object.supplementalGroupsPolicy ?? ''; + message.fsGroup = object.fsGroup ?? 0; + message.sysctls = object.sysctls?.map((e) => Sysctl.fromPartial(e)) || []; + message.fsGroupChangePolicy = object.fsGroupChangePolicy ?? ''; + message.seccompProfile = + object.seccompProfile !== undefined && object.seccompProfile !== null + ? SeccompProfile.fromPartial(object.seccompProfile) + : undefined; + message.appArmorProfile = + object.appArmorProfile !== undefined && object.appArmorProfile !== null + ? AppArmorProfile.fromPartial(object.appArmorProfile) + : undefined; + message.seLinuxChangePolicy = object.seLinuxChangePolicy ?? ''; + return message; + }, +}; + +function createBasePodSignature(): PodSignature { + return { podController: undefined }; +} + +export const PodSignature: MessageFns = { + encode(message: PodSignature, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.podController !== undefined) { + OwnerReference.encode(message.podController, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodSignature { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodSignature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.podController = OwnerReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodSignature { + return { + podController: isSet(object.podController) + ? OwnerReference.fromJSON(object.podController) + : undefined, + }; + }, + + toJSON(message: PodSignature): unknown { + const obj: any = {}; + if (message.podController !== undefined) { + obj.podController = OwnerReference.toJSON(message.podController); + } + return obj; + }, + + create, I>>(base?: I): PodSignature { + return PodSignature.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodSignature { + const message = createBasePodSignature(); + message.podController = + object.podController !== undefined && object.podController !== null + ? OwnerReference.fromPartial(object.podController) + : undefined; + return message; + }, +}; + +function createBasePodSpec(): PodSpec { + return { + volumes: [], + initContainers: [], + containers: [], + ephemeralContainers: [], + restartPolicy: '', + terminationGracePeriodSeconds: 0, + activeDeadlineSeconds: 0, + dnsPolicy: '', + nodeSelector: {}, + serviceAccountName: '', + serviceAccount: '', + automountServiceAccountToken: false, + nodeName: '', + hostNetwork: false, + hostPID: false, + hostIPC: false, + shareProcessNamespace: false, + securityContext: undefined, + imagePullSecrets: [], + hostname: '', + subdomain: '', + affinity: undefined, + schedulerName: '', + tolerations: [], + hostAliases: [], + priorityClassName: '', + priority: 0, + dnsConfig: undefined, + readinessGates: [], + runtimeClassName: '', + enableServiceLinks: false, + preemptionPolicy: '', + overhead: {}, + topologySpreadConstraints: [], + setHostnameAsFQDN: false, + os: undefined, + hostUsers: false, + schedulingGates: [], + resourceClaims: [], + resources: undefined, + hostnameOverride: '', + schedulingGroup: undefined, + evictionResponders: [], + }; +} + +export const PodSpec: MessageFns = { + encode(message: PodSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.volumes) { + Volume.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.initContainers) { + Container.encode(v!, writer.uint32(162).fork()).join(); + } + for (const v of message.containers) { + Container.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.ephemeralContainers) { + EphemeralContainer.encode(v!, writer.uint32(274).fork()).join(); + } + if (message.restartPolicy !== undefined && message.restartPolicy !== '') { + writer.uint32(26).string(message.restartPolicy); + } + if ( + message.terminationGracePeriodSeconds !== undefined && + message.terminationGracePeriodSeconds !== 0 + ) { + writer.uint32(32).int64(message.terminationGracePeriodSeconds); + } + if (message.activeDeadlineSeconds !== undefined && message.activeDeadlineSeconds !== 0) { + writer.uint32(40).int64(message.activeDeadlineSeconds); + } + if (message.dnsPolicy !== undefined && message.dnsPolicy !== '') { + writer.uint32(50).string(message.dnsPolicy); + } + globalThis.Object.entries(message.nodeSelector).forEach(([key, value]: [string, string]) => { + PodSpec_NodeSelectorEntry.encode({ key: key as any, value }, writer.uint32(58).fork()).join(); + }); + if (message.serviceAccountName !== undefined && message.serviceAccountName !== '') { + writer.uint32(66).string(message.serviceAccountName); + } + if (message.serviceAccount !== undefined && message.serviceAccount !== '') { + writer.uint32(74).string(message.serviceAccount); + } + if ( + message.automountServiceAccountToken !== undefined && + message.automountServiceAccountToken !== false + ) { + writer.uint32(168).bool(message.automountServiceAccountToken); + } + if (message.nodeName !== undefined && message.nodeName !== '') { + writer.uint32(82).string(message.nodeName); + } + if (message.hostNetwork !== undefined && message.hostNetwork !== false) { + writer.uint32(88).bool(message.hostNetwork); + } + if (message.hostPID !== undefined && message.hostPID !== false) { + writer.uint32(96).bool(message.hostPID); + } + if (message.hostIPC !== undefined && message.hostIPC !== false) { + writer.uint32(104).bool(message.hostIPC); + } + if (message.shareProcessNamespace !== undefined && message.shareProcessNamespace !== false) { + writer.uint32(216).bool(message.shareProcessNamespace); + } + if (message.securityContext !== undefined) { + PodSecurityContext.encode(message.securityContext, writer.uint32(114).fork()).join(); + } + for (const v of message.imagePullSecrets) { + LocalObjectReference.encode(v!, writer.uint32(122).fork()).join(); + } + if (message.hostname !== undefined && message.hostname !== '') { + writer.uint32(130).string(message.hostname); + } + if (message.subdomain !== undefined && message.subdomain !== '') { + writer.uint32(138).string(message.subdomain); + } + if (message.affinity !== undefined) { + Affinity.encode(message.affinity, writer.uint32(146).fork()).join(); + } + if (message.schedulerName !== undefined && message.schedulerName !== '') { + writer.uint32(154).string(message.schedulerName); + } + for (const v of message.tolerations) { + Toleration.encode(v!, writer.uint32(178).fork()).join(); + } + for (const v of message.hostAliases) { + HostAlias.encode(v!, writer.uint32(186).fork()).join(); + } + if (message.priorityClassName !== undefined && message.priorityClassName !== '') { + writer.uint32(194).string(message.priorityClassName); + } + if (message.priority !== undefined && message.priority !== 0) { + writer.uint32(200).int32(message.priority); + } + if (message.dnsConfig !== undefined) { + PodDNSConfig.encode(message.dnsConfig, writer.uint32(210).fork()).join(); + } + for (const v of message.readinessGates) { + PodReadinessGate.encode(v!, writer.uint32(226).fork()).join(); + } + if (message.runtimeClassName !== undefined && message.runtimeClassName !== '') { + writer.uint32(234).string(message.runtimeClassName); + } + if (message.enableServiceLinks !== undefined && message.enableServiceLinks !== false) { + writer.uint32(240).bool(message.enableServiceLinks); + } + if (message.preemptionPolicy !== undefined && message.preemptionPolicy !== '') { + writer.uint32(250).string(message.preemptionPolicy); + } + globalThis.Object.entries(message.overhead).forEach(([key, value]: [string, Quantity]) => { + PodSpec_OverheadEntry.encode({ key: key as any, value }, writer.uint32(258).fork()).join(); + }); + for (const v of message.topologySpreadConstraints) { + TopologySpreadConstraint.encode(v!, writer.uint32(266).fork()).join(); + } + if (message.setHostnameAsFQDN !== undefined && message.setHostnameAsFQDN !== false) { + writer.uint32(280).bool(message.setHostnameAsFQDN); + } + if (message.os !== undefined) { + PodOS.encode(message.os, writer.uint32(290).fork()).join(); + } + if (message.hostUsers !== undefined && message.hostUsers !== false) { + writer.uint32(296).bool(message.hostUsers); + } + for (const v of message.schedulingGates) { + PodSchedulingGate.encode(v!, writer.uint32(306).fork()).join(); + } + for (const v of message.resourceClaims) { + PodResourceClaim.encode(v!, writer.uint32(314).fork()).join(); + } + if (message.resources !== undefined) { + ResourceRequirements.encode(message.resources, writer.uint32(322).fork()).join(); + } + if (message.hostnameOverride !== undefined && message.hostnameOverride !== '') { + writer.uint32(330).string(message.hostnameOverride); + } + if (message.schedulingGroup !== undefined) { + PodSchedulingGroup.encode(message.schedulingGroup, writer.uint32(346).fork()).join(); + } + for (const v of message.evictionResponders) { + EvictionResponder.encode(v!, writer.uint32(354).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.volumes.push(Volume.decode(reader, reader.uint32())); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + + message.initContainers.push(Container.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.containers.push(Container.decode(reader, reader.uint32())); + continue; + } + case 34: { + if (tag !== 274) { + break; + } + + message.ephemeralContainers.push(EphemeralContainer.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.restartPolicy = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.terminationGracePeriodSeconds = longToNumber(reader.int64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.activeDeadlineSeconds = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.dnsPolicy = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + const entry7 = PodSpec_NodeSelectorEntry.decode(reader, reader.uint32()); + if (entry7.value !== undefined) { + message.nodeSelector[entry7.key] = entry7.value; + } + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.serviceAccountName = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.serviceAccount = reader.string(); + continue; + } + case 21: { + if (tag !== 168) { + break; + } + + message.automountServiceAccountToken = reader.bool(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.nodeName = reader.string(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + + message.hostNetwork = reader.bool(); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + + message.hostPID = reader.bool(); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + + message.hostIPC = reader.bool(); + continue; + } + case 27: { + if (tag !== 216) { + break; + } + + message.shareProcessNamespace = reader.bool(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.securityContext = PodSecurityContext.decode(reader, reader.uint32()); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.imagePullSecrets.push(LocalObjectReference.decode(reader, reader.uint32())); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + + message.hostname = reader.string(); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + + message.subdomain = reader.string(); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + + message.affinity = Affinity.decode(reader, reader.uint32()); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + + message.schedulerName = reader.string(); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + + message.tolerations.push(Toleration.decode(reader, reader.uint32())); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + + message.hostAliases.push(HostAlias.decode(reader, reader.uint32())); + continue; + } + case 24: { + if (tag !== 194) { + break; + } + + message.priorityClassName = reader.string(); + continue; + } + case 25: { + if (tag !== 200) { + break; + } + + message.priority = reader.int32(); + continue; + } + case 26: { + if (tag !== 210) { + break; + } + + message.dnsConfig = PodDNSConfig.decode(reader, reader.uint32()); + continue; + } + case 28: { + if (tag !== 226) { + break; + } + + message.readinessGates.push(PodReadinessGate.decode(reader, reader.uint32())); + continue; + } + case 29: { + if (tag !== 234) { + break; + } + + message.runtimeClassName = reader.string(); + continue; + } + case 30: { + if (tag !== 240) { + break; + } + + message.enableServiceLinks = reader.bool(); + continue; + } + case 31: { + if (tag !== 250) { + break; + } + + message.preemptionPolicy = reader.string(); + continue; + } + case 32: { + if (tag !== 258) { + break; + } + + const entry32 = PodSpec_OverheadEntry.decode(reader, reader.uint32()); + if (entry32.value !== undefined) { + message.overhead[entry32.key] = entry32.value; + } + continue; + } + case 33: { + if (tag !== 266) { + break; + } + + message.topologySpreadConstraints.push( + TopologySpreadConstraint.decode(reader, reader.uint32()), + ); + continue; + } + case 35: { + if (tag !== 280) { + break; + } + + message.setHostnameAsFQDN = reader.bool(); + continue; + } + case 36: { + if (tag !== 290) { + break; + } + + message.os = PodOS.decode(reader, reader.uint32()); + continue; + } + case 37: { + if (tag !== 296) { + break; + } + + message.hostUsers = reader.bool(); + continue; + } + case 38: { + if (tag !== 306) { + break; + } + + message.schedulingGates.push(PodSchedulingGate.decode(reader, reader.uint32())); + continue; + } + case 39: { + if (tag !== 314) { + break; + } + + message.resourceClaims.push(PodResourceClaim.decode(reader, reader.uint32())); + continue; + } + case 40: { + if (tag !== 322) { + break; + } + + message.resources = ResourceRequirements.decode(reader, reader.uint32()); + continue; + } + case 41: { + if (tag !== 330) { + break; + } + + message.hostnameOverride = reader.string(); + continue; + } + case 43: { + if (tag !== 346) { + break; + } + + message.schedulingGroup = PodSchedulingGroup.decode(reader, reader.uint32()); + continue; + } + case 44: { + if (tag !== 354) { + break; + } + + message.evictionResponders.push(EvictionResponder.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodSpec { + return { + volumes: globalThis.Array.isArray(object?.volumes) + ? object.volumes.map((e: any) => Volume.fromJSON(e)) + : [], + initContainers: globalThis.Array.isArray(object?.initContainers) + ? object.initContainers.map((e: any) => Container.fromJSON(e)) + : [], + containers: globalThis.Array.isArray(object?.containers) + ? object.containers.map((e: any) => Container.fromJSON(e)) + : [], + ephemeralContainers: globalThis.Array.isArray(object?.ephemeralContainers) + ? object.ephemeralContainers.map((e: any) => EphemeralContainer.fromJSON(e)) + : [], + restartPolicy: isSet(object.restartPolicy) ? globalThis.String(object.restartPolicy) : '', + terminationGracePeriodSeconds: isSet(object.terminationGracePeriodSeconds) + ? globalThis.Number(object.terminationGracePeriodSeconds) + : 0, + activeDeadlineSeconds: isSet(object.activeDeadlineSeconds) + ? globalThis.Number(object.activeDeadlineSeconds) + : 0, + dnsPolicy: isSet(object.dnsPolicy) ? globalThis.String(object.dnsPolicy) : '', + nodeSelector: isObject(object.nodeSelector) + ? (globalThis.Object.entries(object.nodeSelector) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + serviceAccountName: isSet(object.serviceAccountName) + ? globalThis.String(object.serviceAccountName) + : '', + serviceAccount: isSet(object.serviceAccount) ? globalThis.String(object.serviceAccount) : '', + automountServiceAccountToken: isSet(object.automountServiceAccountToken) + ? globalThis.Boolean(object.automountServiceAccountToken) + : false, + nodeName: isSet(object.nodeName) ? globalThis.String(object.nodeName) : '', + hostNetwork: isSet(object.hostNetwork) ? globalThis.Boolean(object.hostNetwork) : false, + hostPID: isSet(object.hostPID) ? globalThis.Boolean(object.hostPID) : false, + hostIPC: isSet(object.hostIPC) ? globalThis.Boolean(object.hostIPC) : false, + shareProcessNamespace: isSet(object.shareProcessNamespace) + ? globalThis.Boolean(object.shareProcessNamespace) + : false, + securityContext: isSet(object.securityContext) + ? PodSecurityContext.fromJSON(object.securityContext) + : undefined, + imagePullSecrets: globalThis.Array.isArray(object?.imagePullSecrets) + ? object.imagePullSecrets.map((e: any) => LocalObjectReference.fromJSON(e)) + : [], + hostname: isSet(object.hostname) ? globalThis.String(object.hostname) : '', + subdomain: isSet(object.subdomain) ? globalThis.String(object.subdomain) : '', + affinity: isSet(object.affinity) ? Affinity.fromJSON(object.affinity) : undefined, + schedulerName: isSet(object.schedulerName) ? globalThis.String(object.schedulerName) : '', + tolerations: globalThis.Array.isArray(object?.tolerations) + ? object.tolerations.map((e: any) => Toleration.fromJSON(e)) + : [], + hostAliases: globalThis.Array.isArray(object?.hostAliases) + ? object.hostAliases.map((e: any) => HostAlias.fromJSON(e)) + : [], + priorityClassName: isSet(object.priorityClassName) + ? globalThis.String(object.priorityClassName) + : '', + priority: isSet(object.priority) ? globalThis.Number(object.priority) : 0, + dnsConfig: isSet(object.dnsConfig) ? PodDNSConfig.fromJSON(object.dnsConfig) : undefined, + readinessGates: globalThis.Array.isArray(object?.readinessGates) + ? object.readinessGates.map((e: any) => PodReadinessGate.fromJSON(e)) + : [], + runtimeClassName: isSet(object.runtimeClassName) + ? globalThis.String(object.runtimeClassName) + : '', + enableServiceLinks: isSet(object.enableServiceLinks) + ? globalThis.Boolean(object.enableServiceLinks) + : false, + preemptionPolicy: isSet(object.preemptionPolicy) + ? globalThis.String(object.preemptionPolicy) + : '', + overhead: isObject(object.overhead) + ? (globalThis.Object.entries(object.overhead) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + topologySpreadConstraints: globalThis.Array.isArray(object?.topologySpreadConstraints) + ? object.topologySpreadConstraints.map((e: any) => TopologySpreadConstraint.fromJSON(e)) + : [], + setHostnameAsFQDN: isSet(object.setHostnameAsFQDN) + ? globalThis.Boolean(object.setHostnameAsFQDN) + : false, + os: isSet(object.os) ? PodOS.fromJSON(object.os) : undefined, + hostUsers: isSet(object.hostUsers) ? globalThis.Boolean(object.hostUsers) : false, + schedulingGates: globalThis.Array.isArray(object?.schedulingGates) + ? object.schedulingGates.map((e: any) => PodSchedulingGate.fromJSON(e)) + : [], + resourceClaims: globalThis.Array.isArray(object?.resourceClaims) + ? object.resourceClaims.map((e: any) => PodResourceClaim.fromJSON(e)) + : [], + resources: isSet(object.resources) ? ResourceRequirements.fromJSON(object.resources) : undefined, + hostnameOverride: isSet(object.hostnameOverride) + ? globalThis.String(object.hostnameOverride) + : '', + schedulingGroup: isSet(object.schedulingGroup) + ? PodSchedulingGroup.fromJSON(object.schedulingGroup) + : undefined, + evictionResponders: globalThis.Array.isArray(object?.evictionResponders) + ? object.evictionResponders.map((e: any) => EvictionResponder.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PodSpec): unknown { + const obj: any = {}; + if (message.volumes?.length) { + obj.volumes = message.volumes.map((e) => Volume.toJSON(e)); + } + if (message.initContainers?.length) { + obj.initContainers = message.initContainers.map((e) => Container.toJSON(e)); + } + if (message.containers?.length) { + obj.containers = message.containers.map((e) => Container.toJSON(e)); + } + if (message.ephemeralContainers?.length) { + obj.ephemeralContainers = message.ephemeralContainers.map((e) => EphemeralContainer.toJSON(e)); + } + if (message.restartPolicy !== undefined && message.restartPolicy !== '') { + obj.restartPolicy = message.restartPolicy; + } + if ( + message.terminationGracePeriodSeconds !== undefined && + message.terminationGracePeriodSeconds !== 0 + ) { + obj.terminationGracePeriodSeconds = Math.round(message.terminationGracePeriodSeconds); + } + if (message.activeDeadlineSeconds !== undefined && message.activeDeadlineSeconds !== 0) { + obj.activeDeadlineSeconds = Math.round(message.activeDeadlineSeconds); + } + if (message.dnsPolicy !== undefined && message.dnsPolicy !== '') { + obj.dnsPolicy = message.dnsPolicy; + } + if (message.nodeSelector) { + const entries = globalThis.Object.entries(message.nodeSelector) as [string, string][]; + if (entries.length > 0) { + obj.nodeSelector = {}; + entries.forEach(([k, v]) => { + obj.nodeSelector[k] = v; + }); + } + } + if (message.serviceAccountName !== undefined && message.serviceAccountName !== '') { + obj.serviceAccountName = message.serviceAccountName; + } + if (message.serviceAccount !== undefined && message.serviceAccount !== '') { + obj.serviceAccount = message.serviceAccount; + } + if ( + message.automountServiceAccountToken !== undefined && + message.automountServiceAccountToken !== false + ) { + obj.automountServiceAccountToken = message.automountServiceAccountToken; + } + if (message.nodeName !== undefined && message.nodeName !== '') { + obj.nodeName = message.nodeName; + } + if (message.hostNetwork !== undefined && message.hostNetwork !== false) { + obj.hostNetwork = message.hostNetwork; + } + if (message.hostPID !== undefined && message.hostPID !== false) { + obj.hostPID = message.hostPID; + } + if (message.hostIPC !== undefined && message.hostIPC !== false) { + obj.hostIPC = message.hostIPC; + } + if (message.shareProcessNamespace !== undefined && message.shareProcessNamespace !== false) { + obj.shareProcessNamespace = message.shareProcessNamespace; + } + if (message.securityContext !== undefined) { + obj.securityContext = PodSecurityContext.toJSON(message.securityContext); + } + if (message.imagePullSecrets?.length) { + obj.imagePullSecrets = message.imagePullSecrets.map((e) => LocalObjectReference.toJSON(e)); + } + if (message.hostname !== undefined && message.hostname !== '') { + obj.hostname = message.hostname; + } + if (message.subdomain !== undefined && message.subdomain !== '') { + obj.subdomain = message.subdomain; + } + if (message.affinity !== undefined) { + obj.affinity = Affinity.toJSON(message.affinity); + } + if (message.schedulerName !== undefined && message.schedulerName !== '') { + obj.schedulerName = message.schedulerName; + } + if (message.tolerations?.length) { + obj.tolerations = message.tolerations.map((e) => Toleration.toJSON(e)); + } + if (message.hostAliases?.length) { + obj.hostAliases = message.hostAliases.map((e) => HostAlias.toJSON(e)); + } + if (message.priorityClassName !== undefined && message.priorityClassName !== '') { + obj.priorityClassName = message.priorityClassName; + } + if (message.priority !== undefined && message.priority !== 0) { + obj.priority = Math.round(message.priority); + } + if (message.dnsConfig !== undefined) { + obj.dnsConfig = PodDNSConfig.toJSON(message.dnsConfig); + } + if (message.readinessGates?.length) { + obj.readinessGates = message.readinessGates.map((e) => PodReadinessGate.toJSON(e)); + } + if (message.runtimeClassName !== undefined && message.runtimeClassName !== '') { + obj.runtimeClassName = message.runtimeClassName; + } + if (message.enableServiceLinks !== undefined && message.enableServiceLinks !== false) { + obj.enableServiceLinks = message.enableServiceLinks; + } + if (message.preemptionPolicy !== undefined && message.preemptionPolicy !== '') { + obj.preemptionPolicy = message.preemptionPolicy; + } + if (message.overhead) { + const entries = globalThis.Object.entries(message.overhead) as [string, Quantity][]; + if (entries.length > 0) { + obj.overhead = {}; + entries.forEach(([k, v]) => { + obj.overhead[k] = Quantity.toJSON(v); + }); + } + } + if (message.topologySpreadConstraints?.length) { + obj.topologySpreadConstraints = message.topologySpreadConstraints.map((e) => + TopologySpreadConstraint.toJSON(e), + ); + } + if (message.setHostnameAsFQDN !== undefined && message.setHostnameAsFQDN !== false) { + obj.setHostnameAsFQDN = message.setHostnameAsFQDN; + } + if (message.os !== undefined) { + obj.os = PodOS.toJSON(message.os); + } + if (message.hostUsers !== undefined && message.hostUsers !== false) { + obj.hostUsers = message.hostUsers; + } + if (message.schedulingGates?.length) { + obj.schedulingGates = message.schedulingGates.map((e) => PodSchedulingGate.toJSON(e)); + } + if (message.resourceClaims?.length) { + obj.resourceClaims = message.resourceClaims.map((e) => PodResourceClaim.toJSON(e)); + } + if (message.resources !== undefined) { + obj.resources = ResourceRequirements.toJSON(message.resources); + } + if (message.hostnameOverride !== undefined && message.hostnameOverride !== '') { + obj.hostnameOverride = message.hostnameOverride; + } + if (message.schedulingGroup !== undefined) { + obj.schedulingGroup = PodSchedulingGroup.toJSON(message.schedulingGroup); + } + if (message.evictionResponders?.length) { + obj.evictionResponders = message.evictionResponders.map((e) => EvictionResponder.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PodSpec { + return PodSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodSpec { + const message = createBasePodSpec(); + message.volumes = object.volumes?.map((e) => Volume.fromPartial(e)) || []; + message.initContainers = object.initContainers?.map((e) => Container.fromPartial(e)) || []; + message.containers = object.containers?.map((e) => Container.fromPartial(e)) || []; + message.ephemeralContainers = + object.ephemeralContainers?.map((e) => EphemeralContainer.fromPartial(e)) || []; + message.restartPolicy = object.restartPolicy ?? ''; + message.terminationGracePeriodSeconds = object.terminationGracePeriodSeconds ?? 0; + message.activeDeadlineSeconds = object.activeDeadlineSeconds ?? 0; + message.dnsPolicy = object.dnsPolicy ?? ''; + message.nodeSelector = ( + globalThis.Object.entries(object.nodeSelector ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.serviceAccountName = object.serviceAccountName ?? ''; + message.serviceAccount = object.serviceAccount ?? ''; + message.automountServiceAccountToken = object.automountServiceAccountToken ?? false; + message.nodeName = object.nodeName ?? ''; + message.hostNetwork = object.hostNetwork ?? false; + message.hostPID = object.hostPID ?? false; + message.hostIPC = object.hostIPC ?? false; + message.shareProcessNamespace = object.shareProcessNamespace ?? false; + message.securityContext = + object.securityContext !== undefined && object.securityContext !== null + ? PodSecurityContext.fromPartial(object.securityContext) + : undefined; + message.imagePullSecrets = + object.imagePullSecrets?.map((e) => LocalObjectReference.fromPartial(e)) || []; + message.hostname = object.hostname ?? ''; + message.subdomain = object.subdomain ?? ''; + message.affinity = + object.affinity !== undefined && object.affinity !== null + ? Affinity.fromPartial(object.affinity) + : undefined; + message.schedulerName = object.schedulerName ?? ''; + message.tolerations = object.tolerations?.map((e) => Toleration.fromPartial(e)) || []; + message.hostAliases = object.hostAliases?.map((e) => HostAlias.fromPartial(e)) || []; + message.priorityClassName = object.priorityClassName ?? ''; + message.priority = object.priority ?? 0; + message.dnsConfig = + object.dnsConfig !== undefined && object.dnsConfig !== null + ? PodDNSConfig.fromPartial(object.dnsConfig) + : undefined; + message.readinessGates = object.readinessGates?.map((e) => PodReadinessGate.fromPartial(e)) || []; + message.runtimeClassName = object.runtimeClassName ?? ''; + message.enableServiceLinks = object.enableServiceLinks ?? false; + message.preemptionPolicy = object.preemptionPolicy ?? ''; + message.overhead = (globalThis.Object.entries(object.overhead ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + message.topologySpreadConstraints = + object.topologySpreadConstraints?.map((e) => TopologySpreadConstraint.fromPartial(e)) || []; + message.setHostnameAsFQDN = object.setHostnameAsFQDN ?? false; + message.os = object.os !== undefined && object.os !== null ? PodOS.fromPartial(object.os) : undefined; + message.hostUsers = object.hostUsers ?? false; + message.schedulingGates = object.schedulingGates?.map((e) => PodSchedulingGate.fromPartial(e)) || []; + message.resourceClaims = object.resourceClaims?.map((e) => PodResourceClaim.fromPartial(e)) || []; + message.resources = + object.resources !== undefined && object.resources !== null + ? ResourceRequirements.fromPartial(object.resources) + : undefined; + message.hostnameOverride = object.hostnameOverride ?? ''; + message.schedulingGroup = + object.schedulingGroup !== undefined && object.schedulingGroup !== null + ? PodSchedulingGroup.fromPartial(object.schedulingGroup) + : undefined; + message.evictionResponders = + object.evictionResponders?.map((e) => EvictionResponder.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePodSpec_NodeSelectorEntry(): PodSpec_NodeSelectorEntry { + return { key: '', value: '' }; +} + +export const PodSpec_NodeSelectorEntry: MessageFns = { + encode(message: PodSpec_NodeSelectorEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodSpec_NodeSelectorEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodSpec_NodeSelectorEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodSpec_NodeSelectorEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: PodSpec_NodeSelectorEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): PodSpec_NodeSelectorEntry { + return PodSpec_NodeSelectorEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodSpec_NodeSelectorEntry { + const message = createBasePodSpec_NodeSelectorEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBasePodSpec_OverheadEntry(): PodSpec_OverheadEntry { + return { key: '', value: undefined }; +} + +export const PodSpec_OverheadEntry: MessageFns = { + encode(message: PodSpec_OverheadEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodSpec_OverheadEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodSpec_OverheadEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodSpec_OverheadEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: PodSpec_OverheadEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): PodSpec_OverheadEntry { + return PodSpec_OverheadEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodSpec_OverheadEntry { + const message = createBasePodSpec_OverheadEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBasePodStatus(): PodStatus { + return { + observedGeneration: 0, + phase: '', + conditions: [], + message: '', + reason: '', + nominatedNodeName: '', + hostIP: '', + hostIPs: [], + podIP: '', + podIPs: [], + startTime: undefined, + initContainerStatuses: [], + containerStatuses: [], + qosClass: '', + ephemeralContainerStatuses: [], + resize: '', + resourceClaimStatuses: [], + extendedResourceClaimStatus: undefined, + allocatedResources: {}, + resources: undefined, + nodeAllocatableResourceClaimStatuses: [], + volumeHealth: [], + }; +} + +export const PodStatus: MessageFns = { + encode(message: PodStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(136).int64(message.observedGeneration); + } + if (message.phase !== undefined && message.phase !== '') { + writer.uint32(10).string(message.phase); + } + for (const v of message.conditions) { + PodCondition.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(26).string(message.message); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.nominatedNodeName !== undefined && message.nominatedNodeName !== '') { + writer.uint32(90).string(message.nominatedNodeName); + } + if (message.hostIP !== undefined && message.hostIP !== '') { + writer.uint32(42).string(message.hostIP); + } + for (const v of message.hostIPs) { + HostIP.encode(v!, writer.uint32(130).fork()).join(); + } + if (message.podIP !== undefined && message.podIP !== '') { + writer.uint32(50).string(message.podIP); + } + for (const v of message.podIPs) { + PodIP.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.startTime !== undefined) { + Time.encode(message.startTime, writer.uint32(58).fork()).join(); + } + for (const v of message.initContainerStatuses) { + ContainerStatus.encode(v!, writer.uint32(82).fork()).join(); + } + for (const v of message.containerStatuses) { + ContainerStatus.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.qosClass !== undefined && message.qosClass !== '') { + writer.uint32(74).string(message.qosClass); + } + for (const v of message.ephemeralContainerStatuses) { + ContainerStatus.encode(v!, writer.uint32(106).fork()).join(); + } + if (message.resize !== undefined && message.resize !== '') { + writer.uint32(114).string(message.resize); + } + for (const v of message.resourceClaimStatuses) { + PodResourceClaimStatus.encode(v!, writer.uint32(122).fork()).join(); + } + if (message.extendedResourceClaimStatus !== undefined) { + PodExtendedResourceClaimStatus.encode( + message.extendedResourceClaimStatus, + writer.uint32(146).fork(), + ).join(); + } + globalThis.Object.entries(message.allocatedResources).forEach(([key, value]: [string, Quantity]) => { + PodStatus_AllocatedResourcesEntry.encode( + { key: key as any, value }, + writer.uint32(154).fork(), + ).join(); + }); + if (message.resources !== undefined) { + ResourceRequirements.encode(message.resources, writer.uint32(162).fork()).join(); + } + for (const v of message.nodeAllocatableResourceClaimStatuses) { + NodeAllocatableResourceClaimStatus.encode(v!, writer.uint32(170).fork()).join(); + } + for (const v of message.volumeHealth) { + PodVolumeHealth.encode(v!, writer.uint32(178).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 17: { + if (tag !== 136) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 1: { + if (tag !== 10) { + break; + } + + message.phase = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.conditions.push(PodCondition.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.nominatedNodeName = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.hostIP = reader.string(); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + + message.hostIPs.push(HostIP.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.podIP = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.podIPs.push(PodIP.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.startTime = Time.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.initContainerStatuses.push(ContainerStatus.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.containerStatuses.push(ContainerStatus.decode(reader, reader.uint32())); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.qosClass = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.ephemeralContainerStatuses.push( + ContainerStatus.decode(reader, reader.uint32()), + ); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.resize = reader.string(); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.resourceClaimStatuses.push( + PodResourceClaimStatus.decode(reader, reader.uint32()), + ); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + + message.extendedResourceClaimStatus = PodExtendedResourceClaimStatus.decode( + reader, + reader.uint32(), + ); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + + const entry19 = PodStatus_AllocatedResourcesEntry.decode(reader, reader.uint32()); + if (entry19.value !== undefined) { + message.allocatedResources[entry19.key] = entry19.value; + } + continue; + } + case 20: { + if (tag !== 162) { + break; + } + + message.resources = ResourceRequirements.decode(reader, reader.uint32()); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + + message.nodeAllocatableResourceClaimStatuses.push( + NodeAllocatableResourceClaimStatus.decode(reader, reader.uint32()), + ); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + + message.volumeHealth.push(PodVolumeHealth.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodStatus { + return { + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + phase: isSet(object.phase) ? globalThis.String(object.phase) : '', + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => PodCondition.fromJSON(e)) + : [], + message: isSet(object.message) ? globalThis.String(object.message) : '', + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + nominatedNodeName: isSet(object.nominatedNodeName) + ? globalThis.String(object.nominatedNodeName) + : '', + hostIP: isSet(object.hostIP) ? globalThis.String(object.hostIP) : '', + hostIPs: globalThis.Array.isArray(object?.hostIPs) + ? object.hostIPs.map((e: any) => HostIP.fromJSON(e)) + : [], + podIP: isSet(object.podIP) ? globalThis.String(object.podIP) : '', + podIPs: globalThis.Array.isArray(object?.podIPs) + ? object.podIPs.map((e: any) => PodIP.fromJSON(e)) + : [], + startTime: isSet(object.startTime) ? Time.fromJSON(object.startTime) : undefined, + initContainerStatuses: globalThis.Array.isArray(object?.initContainerStatuses) + ? object.initContainerStatuses.map((e: any) => ContainerStatus.fromJSON(e)) + : [], + containerStatuses: globalThis.Array.isArray(object?.containerStatuses) + ? object.containerStatuses.map((e: any) => ContainerStatus.fromJSON(e)) + : [], + qosClass: isSet(object.qosClass) ? globalThis.String(object.qosClass) : '', + ephemeralContainerStatuses: globalThis.Array.isArray(object?.ephemeralContainerStatuses) + ? object.ephemeralContainerStatuses.map((e: any) => ContainerStatus.fromJSON(e)) + : [], + resize: isSet(object.resize) ? globalThis.String(object.resize) : '', + resourceClaimStatuses: globalThis.Array.isArray(object?.resourceClaimStatuses) + ? object.resourceClaimStatuses.map((e: any) => PodResourceClaimStatus.fromJSON(e)) + : [], + extendedResourceClaimStatus: isSet(object.extendedResourceClaimStatus) + ? PodExtendedResourceClaimStatus.fromJSON(object.extendedResourceClaimStatus) + : undefined, + allocatedResources: isObject(object.allocatedResources) + ? (globalThis.Object.entries(object.allocatedResources) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + resources: isSet(object.resources) ? ResourceRequirements.fromJSON(object.resources) : undefined, + nodeAllocatableResourceClaimStatuses: globalThis.Array.isArray( + object?.nodeAllocatableResourceClaimStatuses, + ) + ? object.nodeAllocatableResourceClaimStatuses.map((e: any) => + NodeAllocatableResourceClaimStatus.fromJSON(e), + ) + : [], + volumeHealth: globalThis.Array.isArray(object?.volumeHealth) + ? object.volumeHealth.map((e: any) => PodVolumeHealth.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PodStatus): unknown { + const obj: any = {}; + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.phase !== undefined && message.phase !== '') { + obj.phase = message.phase; + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => PodCondition.toJSON(e)); + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.nominatedNodeName !== undefined && message.nominatedNodeName !== '') { + obj.nominatedNodeName = message.nominatedNodeName; + } + if (message.hostIP !== undefined && message.hostIP !== '') { + obj.hostIP = message.hostIP; + } + if (message.hostIPs?.length) { + obj.hostIPs = message.hostIPs.map((e) => HostIP.toJSON(e)); + } + if (message.podIP !== undefined && message.podIP !== '') { + obj.podIP = message.podIP; + } + if (message.podIPs?.length) { + obj.podIPs = message.podIPs.map((e) => PodIP.toJSON(e)); + } + if (message.startTime !== undefined) { + obj.startTime = Time.toJSON(message.startTime); + } + if (message.initContainerStatuses?.length) { + obj.initContainerStatuses = message.initContainerStatuses.map((e) => ContainerStatus.toJSON(e)); + } + if (message.containerStatuses?.length) { + obj.containerStatuses = message.containerStatuses.map((e) => ContainerStatus.toJSON(e)); + } + if (message.qosClass !== undefined && message.qosClass !== '') { + obj.qosClass = message.qosClass; + } + if (message.ephemeralContainerStatuses?.length) { + obj.ephemeralContainerStatuses = message.ephemeralContainerStatuses.map((e) => + ContainerStatus.toJSON(e), + ); + } + if (message.resize !== undefined && message.resize !== '') { + obj.resize = message.resize; + } + if (message.resourceClaimStatuses?.length) { + obj.resourceClaimStatuses = message.resourceClaimStatuses.map((e) => + PodResourceClaimStatus.toJSON(e), + ); + } + if (message.extendedResourceClaimStatus !== undefined) { + obj.extendedResourceClaimStatus = PodExtendedResourceClaimStatus.toJSON( + message.extendedResourceClaimStatus, + ); + } + if (message.allocatedResources) { + const entries = globalThis.Object.entries(message.allocatedResources) as [string, Quantity][]; + if (entries.length > 0) { + obj.allocatedResources = {}; + entries.forEach(([k, v]) => { + obj.allocatedResources[k] = Quantity.toJSON(v); + }); + } + } + if (message.resources !== undefined) { + obj.resources = ResourceRequirements.toJSON(message.resources); + } + if (message.nodeAllocatableResourceClaimStatuses?.length) { + obj.nodeAllocatableResourceClaimStatuses = message.nodeAllocatableResourceClaimStatuses.map((e) => + NodeAllocatableResourceClaimStatus.toJSON(e), + ); + } + if (message.volumeHealth?.length) { + obj.volumeHealth = message.volumeHealth.map((e) => PodVolumeHealth.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PodStatus { + return PodStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodStatus { + const message = createBasePodStatus(); + message.observedGeneration = object.observedGeneration ?? 0; + message.phase = object.phase ?? ''; + message.conditions = object.conditions?.map((e) => PodCondition.fromPartial(e)) || []; + message.message = object.message ?? ''; + message.reason = object.reason ?? ''; + message.nominatedNodeName = object.nominatedNodeName ?? ''; + message.hostIP = object.hostIP ?? ''; + message.hostIPs = object.hostIPs?.map((e) => HostIP.fromPartial(e)) || []; + message.podIP = object.podIP ?? ''; + message.podIPs = object.podIPs?.map((e) => PodIP.fromPartial(e)) || []; + message.startTime = + object.startTime !== undefined && object.startTime !== null + ? Time.fromPartial(object.startTime) + : undefined; + message.initContainerStatuses = + object.initContainerStatuses?.map((e) => ContainerStatus.fromPartial(e)) || []; + message.containerStatuses = + object.containerStatuses?.map((e) => ContainerStatus.fromPartial(e)) || []; + message.qosClass = object.qosClass ?? ''; + message.ephemeralContainerStatuses = + object.ephemeralContainerStatuses?.map((e) => ContainerStatus.fromPartial(e)) || []; + message.resize = object.resize ?? ''; + message.resourceClaimStatuses = + object.resourceClaimStatuses?.map((e) => PodResourceClaimStatus.fromPartial(e)) || []; + message.extendedResourceClaimStatus = + object.extendedResourceClaimStatus !== undefined && object.extendedResourceClaimStatus !== null + ? PodExtendedResourceClaimStatus.fromPartial(object.extendedResourceClaimStatus) + : undefined; + message.allocatedResources = ( + globalThis.Object.entries(object.allocatedResources ?? {}) as [string, Quantity][] + ).reduce((acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, {}); + message.resources = + object.resources !== undefined && object.resources !== null + ? ResourceRequirements.fromPartial(object.resources) + : undefined; + message.nodeAllocatableResourceClaimStatuses = + object.nodeAllocatableResourceClaimStatuses?.map((e) => + NodeAllocatableResourceClaimStatus.fromPartial(e), + ) || []; + message.volumeHealth = object.volumeHealth?.map((e) => PodVolumeHealth.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePodStatus_AllocatedResourcesEntry(): PodStatus_AllocatedResourcesEntry { + return { key: '', value: undefined }; +} + +export const PodStatus_AllocatedResourcesEntry: MessageFns = { + encode( + message: PodStatus_AllocatedResourcesEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodStatus_AllocatedResourcesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodStatus_AllocatedResourcesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodStatus_AllocatedResourcesEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: PodStatus_AllocatedResourcesEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): PodStatus_AllocatedResourcesEntry { + return PodStatus_AllocatedResourcesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodStatus_AllocatedResourcesEntry { + const message = createBasePodStatus_AllocatedResourcesEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBasePodTemplate(): PodTemplate { + return { metadata: undefined, template: undefined }; +} + +export const PodTemplate: MessageFns = { + encode(message: PodTemplate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.template !== undefined) { + PodTemplateSpec.encode(message.template, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodTemplate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodTemplate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.template = PodTemplateSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodTemplate { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + template: isSet(object.template) ? PodTemplateSpec.fromJSON(object.template) : undefined, + }; + }, + + toJSON(message: PodTemplate): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.template !== undefined) { + obj.template = PodTemplateSpec.toJSON(message.template); + } + return obj; + }, + + create, I>>(base?: I): PodTemplate { + return PodTemplate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodTemplate { + const message = createBasePodTemplate(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.template = + object.template !== undefined && object.template !== null + ? PodTemplateSpec.fromPartial(object.template) + : undefined; + return message; + }, +}; + +function createBasePodTemplateList(): PodTemplateList { + return { metadata: undefined, items: [] }; +} + +export const PodTemplateList: MessageFns = { + encode(message: PodTemplateList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + PodTemplate.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodTemplateList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodTemplateList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(PodTemplate.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodTemplateList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => PodTemplate.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PodTemplateList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => PodTemplate.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PodTemplateList { + return PodTemplateList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodTemplateList { + const message = createBasePodTemplateList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => PodTemplate.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePodTemplateSpec(): PodTemplateSpec { + return { metadata: undefined, spec: undefined }; +} + +export const PodTemplateSpec: MessageFns = { + encode(message: PodTemplateSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + PodSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodTemplateSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodTemplateSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = PodSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodTemplateSpec { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? PodSpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: PodTemplateSpec): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = PodSpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>(base?: I): PodTemplateSpec { + return PodTemplateSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodTemplateSpec { + const message = createBasePodTemplateSpec(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null ? PodSpec.fromPartial(object.spec) : undefined; + return message; + }, +}; + +function createBasePodVolumeHealth(): PodVolumeHealth { + return { name: '', healthConditions: [], lastTransitionTime: undefined }; +} + +export const PodVolumeHealth: MessageFns = { + encode(message: PodVolumeHealth, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + for (const v of message.healthConditions) { + VolumeHealthCondition.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodVolumeHealth { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodVolumeHealth(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.healthConditions.push(VolumeHealthCondition.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodVolumeHealth { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + healthConditions: globalThis.Array.isArray(object?.healthConditions) + ? object.healthConditions.map((e: any) => VolumeHealthCondition.fromJSON(e)) + : [], + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + }; + }, + + toJSON(message: PodVolumeHealth): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.healthConditions?.length) { + obj.healthConditions = message.healthConditions.map((e) => VolumeHealthCondition.toJSON(e)); + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + return obj; + }, + + create, I>>(base?: I): PodVolumeHealth { + return PodVolumeHealth.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodVolumeHealth { + const message = createBasePodVolumeHealth(); + message.name = object.name ?? ''; + message.healthConditions = + object.healthConditions?.map((e) => VolumeHealthCondition.fromPartial(e)) || []; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + return message; + }, +}; + +function createBasePortStatus(): PortStatus { + return { port: 0, protocol: '', error: '' }; +} + +export const PortStatus: MessageFns = { + encode(message: PortStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.port !== undefined && message.port !== 0) { + writer.uint32(8).int32(message.port); + } + if (message.protocol !== undefined && message.protocol !== '') { + writer.uint32(18).string(message.protocol); + } + if (message.error !== undefined && message.error !== '') { + writer.uint32(26).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PortStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePortStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.port = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.protocol = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.error = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PortStatus { + return { + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + protocol: isSet(object.protocol) ? globalThis.String(object.protocol) : '', + error: isSet(object.error) ? globalThis.String(object.error) : '', + }; + }, + + toJSON(message: PortStatus): unknown { + const obj: any = {}; + if (message.port !== undefined && message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.protocol !== undefined && message.protocol !== '') { + obj.protocol = message.protocol; + } + if (message.error !== undefined && message.error !== '') { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): PortStatus { + return PortStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PortStatus { + const message = createBasePortStatus(); + message.port = object.port ?? 0; + message.protocol = object.protocol ?? ''; + message.error = object.error ?? ''; + return message; + }, +}; + +function createBasePortworxVolumeSource(): PortworxVolumeSource { + return { volumeID: '', fsType: '', readOnly: false }; +} + +export const PortworxVolumeSource: MessageFns = { + encode(message: PortworxVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.volumeID !== undefined && message.volumeID !== '') { + writer.uint32(10).string(message.volumeID); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(18).string(message.fsType); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(24).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PortworxVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePortworxVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.volumeID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PortworxVolumeSource { + return { + volumeID: isSet(object.volumeID) ? globalThis.String(object.volumeID) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: PortworxVolumeSource): unknown { + const obj: any = {}; + if (message.volumeID !== undefined && message.volumeID !== '') { + obj.volumeID = message.volumeID; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>(base?: I): PortworxVolumeSource { + return PortworxVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PortworxVolumeSource { + const message = createBasePortworxVolumeSource(); + message.volumeID = object.volumeID ?? ''; + message.fsType = object.fsType ?? ''; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBasePreconditions(): Preconditions { + return { uid: '' }; +} + +export const Preconditions: MessageFns = { + encode(message: Preconditions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.uid !== undefined && message.uid !== '') { + writer.uint32(10).string(message.uid); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Preconditions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePreconditions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.uid = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Preconditions { + return { uid: isSet(object.uid) ? globalThis.String(object.uid) : '' }; + }, + + toJSON(message: Preconditions): unknown { + const obj: any = {}; + if (message.uid !== undefined && message.uid !== '') { + obj.uid = message.uid; + } + return obj; + }, + + create, I>>(base?: I): Preconditions { + return Preconditions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Preconditions { + const message = createBasePreconditions(); + message.uid = object.uid ?? ''; + return message; + }, +}; + +function createBasePreferAvoidPodsEntry(): PreferAvoidPodsEntry { + return { podSignature: undefined, evictionTime: undefined, reason: '', message: '' }; +} + +export const PreferAvoidPodsEntry: MessageFns = { + encode(message: PreferAvoidPodsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.podSignature !== undefined) { + PodSignature.encode(message.podSignature, writer.uint32(10).fork()).join(); + } + if (message.evictionTime !== undefined) { + Time.encode(message.evictionTime, writer.uint32(18).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(26).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(34).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PreferAvoidPodsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePreferAvoidPodsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.podSignature = PodSignature.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.evictionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.reason = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PreferAvoidPodsEntry { + return { + podSignature: isSet(object.podSignature) ? PodSignature.fromJSON(object.podSignature) : undefined, + evictionTime: isSet(object.evictionTime) ? Time.fromJSON(object.evictionTime) : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: PreferAvoidPodsEntry): unknown { + const obj: any = {}; + if (message.podSignature !== undefined) { + obj.podSignature = PodSignature.toJSON(message.podSignature); + } + if (message.evictionTime !== undefined) { + obj.evictionTime = Time.toJSON(message.evictionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): PreferAvoidPodsEntry { + return PreferAvoidPodsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PreferAvoidPodsEntry { + const message = createBasePreferAvoidPodsEntry(); + message.podSignature = + object.podSignature !== undefined && object.podSignature !== null + ? PodSignature.fromPartial(object.podSignature) + : undefined; + message.evictionTime = + object.evictionTime !== undefined && object.evictionTime !== null + ? Time.fromPartial(object.evictionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBasePreferredSchedulingTerm(): PreferredSchedulingTerm { + return { weight: 0, preference: undefined }; +} + +export const PreferredSchedulingTerm: MessageFns = { + encode(message: PreferredSchedulingTerm, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.weight !== undefined && message.weight !== 0) { + writer.uint32(8).int32(message.weight); + } + if (message.preference !== undefined) { + NodeSelectorTerm.encode(message.preference, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PreferredSchedulingTerm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePreferredSchedulingTerm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.weight = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.preference = NodeSelectorTerm.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PreferredSchedulingTerm { + return { + weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, + preference: isSet(object.preference) ? NodeSelectorTerm.fromJSON(object.preference) : undefined, + }; + }, + + toJSON(message: PreferredSchedulingTerm): unknown { + const obj: any = {}; + if (message.weight !== undefined && message.weight !== 0) { + obj.weight = Math.round(message.weight); + } + if (message.preference !== undefined) { + obj.preference = NodeSelectorTerm.toJSON(message.preference); + } + return obj; + }, + + create, I>>(base?: I): PreferredSchedulingTerm { + return PreferredSchedulingTerm.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PreferredSchedulingTerm { + const message = createBasePreferredSchedulingTerm(); + message.weight = object.weight ?? 0; + message.preference = + object.preference !== undefined && object.preference !== null + ? NodeSelectorTerm.fromPartial(object.preference) + : undefined; + return message; + }, +}; + +function createBaseProbe(): Probe { + return { + handler: undefined, + initialDelaySeconds: 0, + timeoutSeconds: 0, + periodSeconds: 0, + successThreshold: 0, + failureThreshold: 0, + terminationGracePeriodSeconds: 0, + }; +} + +export const Probe: MessageFns = { + encode(message: Probe, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.handler !== undefined) { + ProbeHandler.encode(message.handler, writer.uint32(10).fork()).join(); + } + if (message.initialDelaySeconds !== undefined && message.initialDelaySeconds !== 0) { + writer.uint32(16).int32(message.initialDelaySeconds); + } + if (message.timeoutSeconds !== undefined && message.timeoutSeconds !== 0) { + writer.uint32(24).int32(message.timeoutSeconds); + } + if (message.periodSeconds !== undefined && message.periodSeconds !== 0) { + writer.uint32(32).int32(message.periodSeconds); + } + if (message.successThreshold !== undefined && message.successThreshold !== 0) { + writer.uint32(40).int32(message.successThreshold); + } + if (message.failureThreshold !== undefined && message.failureThreshold !== 0) { + writer.uint32(48).int32(message.failureThreshold); + } + if ( + message.terminationGracePeriodSeconds !== undefined && + message.terminationGracePeriodSeconds !== 0 + ) { + writer.uint32(56).int64(message.terminationGracePeriodSeconds); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Probe { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProbe(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.handler = ProbeHandler.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.initialDelaySeconds = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.timeoutSeconds = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.periodSeconds = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.successThreshold = reader.int32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.failureThreshold = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.terminationGracePeriodSeconds = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Probe { + return { + handler: isSet(object.handler) ? ProbeHandler.fromJSON(object.handler) : undefined, + initialDelaySeconds: isSet(object.initialDelaySeconds) + ? globalThis.Number(object.initialDelaySeconds) + : 0, + timeoutSeconds: isSet(object.timeoutSeconds) ? globalThis.Number(object.timeoutSeconds) : 0, + periodSeconds: isSet(object.periodSeconds) ? globalThis.Number(object.periodSeconds) : 0, + successThreshold: isSet(object.successThreshold) ? globalThis.Number(object.successThreshold) : 0, + failureThreshold: isSet(object.failureThreshold) ? globalThis.Number(object.failureThreshold) : 0, + terminationGracePeriodSeconds: isSet(object.terminationGracePeriodSeconds) + ? globalThis.Number(object.terminationGracePeriodSeconds) + : 0, + }; + }, + + toJSON(message: Probe): unknown { + const obj: any = {}; + if (message.handler !== undefined) { + obj.handler = ProbeHandler.toJSON(message.handler); + } + if (message.initialDelaySeconds !== undefined && message.initialDelaySeconds !== 0) { + obj.initialDelaySeconds = Math.round(message.initialDelaySeconds); + } + if (message.timeoutSeconds !== undefined && message.timeoutSeconds !== 0) { + obj.timeoutSeconds = Math.round(message.timeoutSeconds); + } + if (message.periodSeconds !== undefined && message.periodSeconds !== 0) { + obj.periodSeconds = Math.round(message.periodSeconds); + } + if (message.successThreshold !== undefined && message.successThreshold !== 0) { + obj.successThreshold = Math.round(message.successThreshold); + } + if (message.failureThreshold !== undefined && message.failureThreshold !== 0) { + obj.failureThreshold = Math.round(message.failureThreshold); + } + if ( + message.terminationGracePeriodSeconds !== undefined && + message.terminationGracePeriodSeconds !== 0 + ) { + obj.terminationGracePeriodSeconds = Math.round(message.terminationGracePeriodSeconds); + } + return obj; + }, + + create, I>>(base?: I): Probe { + return Probe.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Probe { + const message = createBaseProbe(); + message.handler = + object.handler !== undefined && object.handler !== null + ? ProbeHandler.fromPartial(object.handler) + : undefined; + message.initialDelaySeconds = object.initialDelaySeconds ?? 0; + message.timeoutSeconds = object.timeoutSeconds ?? 0; + message.periodSeconds = object.periodSeconds ?? 0; + message.successThreshold = object.successThreshold ?? 0; + message.failureThreshold = object.failureThreshold ?? 0; + message.terminationGracePeriodSeconds = object.terminationGracePeriodSeconds ?? 0; + return message; + }, +}; + +function createBaseProbeHandler(): ProbeHandler { + return { exec: undefined, httpGet: undefined, tcpSocket: undefined, grpc: undefined }; +} + +export const ProbeHandler: MessageFns = { + encode(message: ProbeHandler, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exec !== undefined) { + ExecAction.encode(message.exec, writer.uint32(10).fork()).join(); + } + if (message.httpGet !== undefined) { + HTTPGetAction.encode(message.httpGet, writer.uint32(18).fork()).join(); + } + if (message.tcpSocket !== undefined) { + TCPSocketAction.encode(message.tcpSocket, writer.uint32(26).fork()).join(); + } + if (message.grpc !== undefined) { + GRPCAction.encode(message.grpc, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProbeHandler { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProbeHandler(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.exec = ExecAction.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.httpGet = HTTPGetAction.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.tcpSocket = TCPSocketAction.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.grpc = GRPCAction.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ProbeHandler { + return { + exec: isSet(object.exec) ? ExecAction.fromJSON(object.exec) : undefined, + httpGet: isSet(object.httpGet) ? HTTPGetAction.fromJSON(object.httpGet) : undefined, + tcpSocket: isSet(object.tcpSocket) ? TCPSocketAction.fromJSON(object.tcpSocket) : undefined, + grpc: isSet(object.grpc) ? GRPCAction.fromJSON(object.grpc) : undefined, + }; + }, + + toJSON(message: ProbeHandler): unknown { + const obj: any = {}; + if (message.exec !== undefined) { + obj.exec = ExecAction.toJSON(message.exec); + } + if (message.httpGet !== undefined) { + obj.httpGet = HTTPGetAction.toJSON(message.httpGet); + } + if (message.tcpSocket !== undefined) { + obj.tcpSocket = TCPSocketAction.toJSON(message.tcpSocket); + } + if (message.grpc !== undefined) { + obj.grpc = GRPCAction.toJSON(message.grpc); + } + return obj; + }, + + create, I>>(base?: I): ProbeHandler { + return ProbeHandler.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProbeHandler { + const message = createBaseProbeHandler(); + message.exec = + object.exec !== undefined && object.exec !== null + ? ExecAction.fromPartial(object.exec) + : undefined; + message.httpGet = + object.httpGet !== undefined && object.httpGet !== null + ? HTTPGetAction.fromPartial(object.httpGet) + : undefined; + message.tcpSocket = + object.tcpSocket !== undefined && object.tcpSocket !== null + ? TCPSocketAction.fromPartial(object.tcpSocket) + : undefined; + message.grpc = + object.grpc !== undefined && object.grpc !== null + ? GRPCAction.fromPartial(object.grpc) + : undefined; + return message; + }, +}; + +function createBaseProjectedVolumeSource(): ProjectedVolumeSource { + return { sources: [], defaultMode: 0, defaultUser: 0 }; +} + +export const ProjectedVolumeSource: MessageFns = { + encode(message: ProjectedVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.sources) { + VolumeProjection.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.defaultMode !== undefined && message.defaultMode !== 0) { + writer.uint32(16).int32(message.defaultMode); + } + if (message.defaultUser !== undefined && message.defaultUser !== 0) { + writer.uint32(24).int64(message.defaultUser); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProjectedVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProjectedVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.sources.push(VolumeProjection.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.defaultMode = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.defaultUser = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ProjectedVolumeSource { + return { + sources: globalThis.Array.isArray(object?.sources) + ? object.sources.map((e: any) => VolumeProjection.fromJSON(e)) + : [], + defaultMode: isSet(object.defaultMode) ? globalThis.Number(object.defaultMode) : 0, + defaultUser: isSet(object.defaultUser) ? globalThis.Number(object.defaultUser) : 0, + }; + }, + + toJSON(message: ProjectedVolumeSource): unknown { + const obj: any = {}; + if (message.sources?.length) { + obj.sources = message.sources.map((e) => VolumeProjection.toJSON(e)); + } + if (message.defaultMode !== undefined && message.defaultMode !== 0) { + obj.defaultMode = Math.round(message.defaultMode); + } + if (message.defaultUser !== undefined && message.defaultUser !== 0) { + obj.defaultUser = Math.round(message.defaultUser); + } + return obj; + }, + + create, I>>(base?: I): ProjectedVolumeSource { + return ProjectedVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProjectedVolumeSource { + const message = createBaseProjectedVolumeSource(); + message.sources = object.sources?.map((e) => VolumeProjection.fromPartial(e)) || []; + message.defaultMode = object.defaultMode ?? 0; + message.defaultUser = object.defaultUser ?? 0; + return message; + }, +}; + +function createBaseQuobyteVolumeSource(): QuobyteVolumeSource { + return { registry: '', volume: '', readOnly: false, user: '', group: '', tenant: '' }; +} + +export const QuobyteVolumeSource: MessageFns = { + encode(message: QuobyteVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.registry !== undefined && message.registry !== '') { + writer.uint32(10).string(message.registry); + } + if (message.volume !== undefined && message.volume !== '') { + writer.uint32(18).string(message.volume); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(24).bool(message.readOnly); + } + if (message.user !== undefined && message.user !== '') { + writer.uint32(34).string(message.user); + } + if (message.group !== undefined && message.group !== '') { + writer.uint32(42).string(message.group); + } + if (message.tenant !== undefined && message.tenant !== '') { + writer.uint32(50).string(message.tenant); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuobyteVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuobyteVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.registry = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.volume = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.user = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.group = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.tenant = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): QuobyteVolumeSource { + return { + registry: isSet(object.registry) ? globalThis.String(object.registry) : '', + volume: isSet(object.volume) ? globalThis.String(object.volume) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + user: isSet(object.user) ? globalThis.String(object.user) : '', + group: isSet(object.group) ? globalThis.String(object.group) : '', + tenant: isSet(object.tenant) ? globalThis.String(object.tenant) : '', + }; + }, + + toJSON(message: QuobyteVolumeSource): unknown { + const obj: any = {}; + if (message.registry !== undefined && message.registry !== '') { + obj.registry = message.registry; + } + if (message.volume !== undefined && message.volume !== '') { + obj.volume = message.volume; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.user !== undefined && message.user !== '') { + obj.user = message.user; + } + if (message.group !== undefined && message.group !== '') { + obj.group = message.group; + } + if (message.tenant !== undefined && message.tenant !== '') { + obj.tenant = message.tenant; + } + return obj; + }, + + create, I>>(base?: I): QuobyteVolumeSource { + return QuobyteVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuobyteVolumeSource { + const message = createBaseQuobyteVolumeSource(); + message.registry = object.registry ?? ''; + message.volume = object.volume ?? ''; + message.readOnly = object.readOnly ?? false; + message.user = object.user ?? ''; + message.group = object.group ?? ''; + message.tenant = object.tenant ?? ''; + return message; + }, +}; + +function createBaseRBDPersistentVolumeSource(): RBDPersistentVolumeSource { + return { + monitors: [], + image: '', + fsType: '', + pool: '', + user: '', + keyring: '', + secretRef: undefined, + readOnly: false, + }; +} + +export const RBDPersistentVolumeSource: MessageFns = { + encode(message: RBDPersistentVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.monitors) { + writer.uint32(10).string(v!); + } + if (message.image !== undefined && message.image !== '') { + writer.uint32(18).string(message.image); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(26).string(message.fsType); + } + if (message.pool !== undefined && message.pool !== '') { + writer.uint32(34).string(message.pool); + } + if (message.user !== undefined && message.user !== '') { + writer.uint32(42).string(message.user); + } + if (message.keyring !== undefined && message.keyring !== '') { + writer.uint32(50).string(message.keyring); + } + if (message.secretRef !== undefined) { + SecretReference.encode(message.secretRef, writer.uint32(58).fork()).join(); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(64).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RBDPersistentVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRBDPersistentVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.monitors.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.image = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.pool = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.user = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.keyring = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.secretRef = SecretReference.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RBDPersistentVolumeSource { + return { + monitors: globalThis.Array.isArray(object?.monitors) + ? object.monitors.map((e: any) => globalThis.String(e)) + : [], + image: isSet(object.image) ? globalThis.String(object.image) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + pool: isSet(object.pool) ? globalThis.String(object.pool) : '', + user: isSet(object.user) ? globalThis.String(object.user) : '', + keyring: isSet(object.keyring) ? globalThis.String(object.keyring) : '', + secretRef: isSet(object.secretRef) ? SecretReference.fromJSON(object.secretRef) : undefined, + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: RBDPersistentVolumeSource): unknown { + const obj: any = {}; + if (message.monitors?.length) { + obj.monitors = message.monitors; + } + if (message.image !== undefined && message.image !== '') { + obj.image = message.image; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.pool !== undefined && message.pool !== '') { + obj.pool = message.pool; + } + if (message.user !== undefined && message.user !== '') { + obj.user = message.user; + } + if (message.keyring !== undefined && message.keyring !== '') { + obj.keyring = message.keyring; + } + if (message.secretRef !== undefined) { + obj.secretRef = SecretReference.toJSON(message.secretRef); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>(base?: I): RBDPersistentVolumeSource { + return RBDPersistentVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RBDPersistentVolumeSource { + const message = createBaseRBDPersistentVolumeSource(); + message.monitors = object.monitors?.map((e) => e) || []; + message.image = object.image ?? ''; + message.fsType = object.fsType ?? ''; + message.pool = object.pool ?? ''; + message.user = object.user ?? ''; + message.keyring = object.keyring ?? ''; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? SecretReference.fromPartial(object.secretRef) + : undefined; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBaseRBDVolumeSource(): RBDVolumeSource { + return { + monitors: [], + image: '', + fsType: '', + pool: '', + user: '', + keyring: '', + secretRef: undefined, + readOnly: false, + }; +} + +export const RBDVolumeSource: MessageFns = { + encode(message: RBDVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.monitors) { + writer.uint32(10).string(v!); + } + if (message.image !== undefined && message.image !== '') { + writer.uint32(18).string(message.image); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(26).string(message.fsType); + } + if (message.pool !== undefined && message.pool !== '') { + writer.uint32(34).string(message.pool); + } + if (message.user !== undefined && message.user !== '') { + writer.uint32(42).string(message.user); + } + if (message.keyring !== undefined && message.keyring !== '') { + writer.uint32(50).string(message.keyring); + } + if (message.secretRef !== undefined) { + LocalObjectReference.encode(message.secretRef, writer.uint32(58).fork()).join(); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(64).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RBDVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRBDVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.monitors.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.image = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.pool = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.user = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.keyring = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.secretRef = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RBDVolumeSource { + return { + monitors: globalThis.Array.isArray(object?.monitors) + ? object.monitors.map((e: any) => globalThis.String(e)) + : [], + image: isSet(object.image) ? globalThis.String(object.image) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + pool: isSet(object.pool) ? globalThis.String(object.pool) : '', + user: isSet(object.user) ? globalThis.String(object.user) : '', + keyring: isSet(object.keyring) ? globalThis.String(object.keyring) : '', + secretRef: isSet(object.secretRef) ? LocalObjectReference.fromJSON(object.secretRef) : undefined, + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: RBDVolumeSource): unknown { + const obj: any = {}; + if (message.monitors?.length) { + obj.monitors = message.monitors; + } + if (message.image !== undefined && message.image !== '') { + obj.image = message.image; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.pool !== undefined && message.pool !== '') { + obj.pool = message.pool; + } + if (message.user !== undefined && message.user !== '') { + obj.user = message.user; + } + if (message.keyring !== undefined && message.keyring !== '') { + obj.keyring = message.keyring; + } + if (message.secretRef !== undefined) { + obj.secretRef = LocalObjectReference.toJSON(message.secretRef); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>(base?: I): RBDVolumeSource { + return RBDVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RBDVolumeSource { + const message = createBaseRBDVolumeSource(); + message.monitors = object.monitors?.map((e) => e) || []; + message.image = object.image ?? ''; + message.fsType = object.fsType ?? ''; + message.pool = object.pool ?? ''; + message.user = object.user ?? ''; + message.keyring = object.keyring ?? ''; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? LocalObjectReference.fromPartial(object.secretRef) + : undefined; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBaseRangeAllocation(): RangeAllocation { + return { metadata: undefined, range: '', data: new Uint8Array(0) }; +} + +export const RangeAllocation: MessageFns = { + encode(message: RangeAllocation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.range !== undefined && message.range !== '') { + writer.uint32(18).string(message.range); + } + if (message.data !== undefined && message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RangeAllocation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRangeAllocation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.range = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RangeAllocation { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + range: isSet(object.range) ? globalThis.String(object.range) : '', + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: RangeAllocation): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.range !== undefined && message.range !== '') { + obj.range = message.range; + } + if (message.data !== undefined && message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): RangeAllocation { + return RangeAllocation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RangeAllocation { + const message = createBaseRangeAllocation(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.range = object.range ?? ''; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseReplicationController(): ReplicationController { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const ReplicationController: MessageFns = { + encode(message: ReplicationController, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + ReplicationControllerSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + ReplicationControllerStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicationController { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicationController(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = ReplicationControllerSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = ReplicationControllerStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicationController { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? ReplicationControllerSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? ReplicationControllerStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: ReplicationController): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = ReplicationControllerSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = ReplicationControllerStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ReplicationController { + return ReplicationController.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReplicationController { + const message = createBaseReplicationController(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? ReplicationControllerSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? ReplicationControllerStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseReplicationControllerCondition(): ReplicationControllerCondition { + return { type: '', status: '', lastTransitionTime: undefined, reason: '', message: '' }; +} + +export const ReplicationControllerCondition: MessageFns = { + encode(message: ReplicationControllerCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(26).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(42).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicationControllerCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicationControllerCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicationControllerCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: ReplicationControllerCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>( + base?: I, + ): ReplicationControllerCondition { + return ReplicationControllerCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ReplicationControllerCondition { + const message = createBaseReplicationControllerCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseReplicationControllerList(): ReplicationControllerList { + return { metadata: undefined, items: [] }; +} + +export const ReplicationControllerList: MessageFns = { + encode(message: ReplicationControllerList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ReplicationController.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicationControllerList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicationControllerList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ReplicationController.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicationControllerList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ReplicationController.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ReplicationControllerList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ReplicationController.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ReplicationControllerList { + return ReplicationControllerList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ReplicationControllerList { + const message = createBaseReplicationControllerList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ReplicationController.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseReplicationControllerSpec(): ReplicationControllerSpec { + return { replicas: 0, minReadySeconds: 0, selector: {}, template: undefined }; +} + +export const ReplicationControllerSpec: MessageFns = { + encode(message: ReplicationControllerSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + writer.uint32(32).int32(message.minReadySeconds); + } + globalThis.Object.entries(message.selector).forEach(([key, value]: [string, string]) => { + ReplicationControllerSpec_SelectorEntry.encode( + { key: key as any, value }, + writer.uint32(18).fork(), + ).join(); + }); + if (message.template !== undefined) { + PodTemplateSpec.encode(message.template, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicationControllerSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicationControllerSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.minReadySeconds = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = ReplicationControllerSpec_SelectorEntry.decode( + reader, + reader.uint32(), + ); + if (entry2.value !== undefined) { + message.selector[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.template = PodTemplateSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicationControllerSpec { + return { + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + minReadySeconds: isSet(object.minReadySeconds) ? globalThis.Number(object.minReadySeconds) : 0, + selector: isObject(object.selector) + ? (globalThis.Object.entries(object.selector) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + template: isSet(object.template) ? PodTemplateSpec.fromJSON(object.template) : undefined, + }; + }, + + toJSON(message: ReplicationControllerSpec): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + obj.minReadySeconds = Math.round(message.minReadySeconds); + } + if (message.selector) { + const entries = globalThis.Object.entries(message.selector) as [string, string][]; + if (entries.length > 0) { + obj.selector = {}; + entries.forEach(([k, v]) => { + obj.selector[k] = v; + }); + } + } + if (message.template !== undefined) { + obj.template = PodTemplateSpec.toJSON(message.template); + } + return obj; + }, + + create, I>>(base?: I): ReplicationControllerSpec { + return ReplicationControllerSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ReplicationControllerSpec { + const message = createBaseReplicationControllerSpec(); + message.replicas = object.replicas ?? 0; + message.minReadySeconds = object.minReadySeconds ?? 0; + message.selector = (globalThis.Object.entries(object.selector ?? {}) as [string, string][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.template = + object.template !== undefined && object.template !== null + ? PodTemplateSpec.fromPartial(object.template) + : undefined; + return message; + }, +}; + +function createBaseReplicationControllerSpec_SelectorEntry(): ReplicationControllerSpec_SelectorEntry { + return { key: '', value: '' }; +} + +export const ReplicationControllerSpec_SelectorEntry: MessageFns = { + encode( + message: ReplicationControllerSpec_SelectorEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicationControllerSpec_SelectorEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicationControllerSpec_SelectorEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicationControllerSpec_SelectorEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: ReplicationControllerSpec_SelectorEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): ReplicationControllerSpec_SelectorEntry { + return ReplicationControllerSpec_SelectorEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ReplicationControllerSpec_SelectorEntry { + const message = createBaseReplicationControllerSpec_SelectorEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBaseReplicationControllerStatus(): ReplicationControllerStatus { + return { + replicas: 0, + fullyLabeledReplicas: 0, + readyReplicas: 0, + availableReplicas: 0, + observedGeneration: 0, + conditions: [], + }; +} + +export const ReplicationControllerStatus: MessageFns = { + encode(message: ReplicationControllerStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + if (message.fullyLabeledReplicas !== undefined && message.fullyLabeledReplicas !== 0) { + writer.uint32(16).int32(message.fullyLabeledReplicas); + } + if (message.readyReplicas !== undefined && message.readyReplicas !== 0) { + writer.uint32(32).int32(message.readyReplicas); + } + if (message.availableReplicas !== undefined && message.availableReplicas !== 0) { + writer.uint32(40).int32(message.availableReplicas); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(24).int64(message.observedGeneration); + } + for (const v of message.conditions) { + ReplicationControllerCondition.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicationControllerStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicationControllerStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.fullyLabeledReplicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.readyReplicas = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.availableReplicas = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.conditions.push( + ReplicationControllerCondition.decode(reader, reader.uint32()), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicationControllerStatus { + return { + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + fullyLabeledReplicas: isSet(object.fullyLabeledReplicas) + ? globalThis.Number(object.fullyLabeledReplicas) + : 0, + readyReplicas: isSet(object.readyReplicas) ? globalThis.Number(object.readyReplicas) : 0, + availableReplicas: isSet(object.availableReplicas) + ? globalThis.Number(object.availableReplicas) + : 0, + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => ReplicationControllerCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ReplicationControllerStatus): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.fullyLabeledReplicas !== undefined && message.fullyLabeledReplicas !== 0) { + obj.fullyLabeledReplicas = Math.round(message.fullyLabeledReplicas); + } + if (message.readyReplicas !== undefined && message.readyReplicas !== 0) { + obj.readyReplicas = Math.round(message.readyReplicas); + } + if (message.availableReplicas !== undefined && message.availableReplicas !== 0) { + obj.availableReplicas = Math.round(message.availableReplicas); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => ReplicationControllerCondition.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): ReplicationControllerStatus { + return ReplicationControllerStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ReplicationControllerStatus { + const message = createBaseReplicationControllerStatus(); + message.replicas = object.replicas ?? 0; + message.fullyLabeledReplicas = object.fullyLabeledReplicas ?? 0; + message.readyReplicas = object.readyReplicas ?? 0; + message.availableReplicas = object.availableReplicas ?? 0; + message.observedGeneration = object.observedGeneration ?? 0; + message.conditions = + object.conditions?.map((e) => ReplicationControllerCondition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseResourceClaim(): ResourceClaim { + return { name: '', request: '' }; +} + +export const ResourceClaim: MessageFns = { + encode(message: ResourceClaim, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.request !== undefined && message.request !== '') { + writer.uint32(18).string(message.request); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceClaim { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceClaim(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.request = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceClaim { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + request: isSet(object.request) ? globalThis.String(object.request) : '', + }; + }, + + toJSON(message: ResourceClaim): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.request !== undefined && message.request !== '') { + obj.request = message.request; + } + return obj; + }, + + create, I>>(base?: I): ResourceClaim { + return ResourceClaim.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceClaim { + const message = createBaseResourceClaim(); + message.name = object.name ?? ''; + message.request = object.request ?? ''; + return message; + }, +}; + +function createBaseResourceFieldSelector(): ResourceFieldSelector { + return { containerName: '', resource: '', divisor: undefined }; +} + +export const ResourceFieldSelector: MessageFns = { + encode(message: ResourceFieldSelector, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.containerName !== undefined && message.containerName !== '') { + writer.uint32(10).string(message.containerName); + } + if (message.resource !== undefined && message.resource !== '') { + writer.uint32(18).string(message.resource); + } + if (message.divisor !== undefined) { + Quantity.encode(message.divisor, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceFieldSelector { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceFieldSelector(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.containerName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resource = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.divisor = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceFieldSelector { + return { + containerName: isSet(object.containerName) ? globalThis.String(object.containerName) : '', + resource: isSet(object.resource) ? globalThis.String(object.resource) : '', + divisor: isSet(object.divisor) ? Quantity.fromJSON(object.divisor) : undefined, + }; + }, + + toJSON(message: ResourceFieldSelector): unknown { + const obj: any = {}; + if (message.containerName !== undefined && message.containerName !== '') { + obj.containerName = message.containerName; + } + if (message.resource !== undefined && message.resource !== '') { + obj.resource = message.resource; + } + if (message.divisor !== undefined) { + obj.divisor = Quantity.toJSON(message.divisor); + } + return obj; + }, + + create, I>>(base?: I): ResourceFieldSelector { + return ResourceFieldSelector.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceFieldSelector { + const message = createBaseResourceFieldSelector(); + message.containerName = object.containerName ?? ''; + message.resource = object.resource ?? ''; + message.divisor = + object.divisor !== undefined && object.divisor !== null + ? Quantity.fromPartial(object.divisor) + : undefined; + return message; + }, +}; + +function createBaseResourceHealth(): ResourceHealth { + return { resourceID: '', health: '', message: '' }; +} + +export const ResourceHealth: MessageFns = { + encode(message: ResourceHealth, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.resourceID !== undefined && message.resourceID !== '') { + writer.uint32(10).string(message.resourceID); + } + if (message.health !== undefined && message.health !== '') { + writer.uint32(18).string(message.health); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(50).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceHealth { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceHealth(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resourceID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.health = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceHealth { + return { + resourceID: isSet(object.resourceID) ? globalThis.String(object.resourceID) : '', + health: isSet(object.health) ? globalThis.String(object.health) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: ResourceHealth): unknown { + const obj: any = {}; + if (message.resourceID !== undefined && message.resourceID !== '') { + obj.resourceID = message.resourceID; + } + if (message.health !== undefined && message.health !== '') { + obj.health = message.health; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): ResourceHealth { + return ResourceHealth.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceHealth { + const message = createBaseResourceHealth(); + message.resourceID = object.resourceID ?? ''; + message.health = object.health ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseResourceQuota(): ResourceQuota { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const ResourceQuota: MessageFns = { + encode(message: ResourceQuota, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + ResourceQuotaSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + ResourceQuotaStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceQuota { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceQuota(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = ResourceQuotaSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = ResourceQuotaStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceQuota { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? ResourceQuotaSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? ResourceQuotaStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: ResourceQuota): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = ResourceQuotaSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = ResourceQuotaStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ResourceQuota { + return ResourceQuota.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceQuota { + const message = createBaseResourceQuota(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? ResourceQuotaSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? ResourceQuotaStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseResourceQuotaList(): ResourceQuotaList { + return { metadata: undefined, items: [] }; +} + +export const ResourceQuotaList: MessageFns = { + encode(message: ResourceQuotaList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ResourceQuota.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceQuotaList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceQuotaList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ResourceQuota.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceQuotaList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ResourceQuota.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ResourceQuotaList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ResourceQuota.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ResourceQuotaList { + return ResourceQuotaList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceQuotaList { + const message = createBaseResourceQuotaList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ResourceQuota.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseResourceQuotaSpec(): ResourceQuotaSpec { + return { hard: {}, scopes: [], scopeSelector: undefined }; +} + +export const ResourceQuotaSpec: MessageFns = { + encode(message: ResourceQuotaSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + globalThis.Object.entries(message.hard).forEach(([key, value]: [string, Quantity]) => { + ResourceQuotaSpec_HardEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + for (const v of message.scopes) { + writer.uint32(18).string(v!); + } + if (message.scopeSelector !== undefined) { + ScopeSelector.encode(message.scopeSelector, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceQuotaSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceQuotaSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + const entry1 = ResourceQuotaSpec_HardEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.hard[entry1.key] = entry1.value; + } + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.scopes.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.scopeSelector = ScopeSelector.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceQuotaSpec { + return { + hard: isObject(object.hard) + ? (globalThis.Object.entries(object.hard) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + scopes: globalThis.Array.isArray(object?.scopes) + ? object.scopes.map((e: any) => globalThis.String(e)) + : [], + scopeSelector: isSet(object.scopeSelector) + ? ScopeSelector.fromJSON(object.scopeSelector) + : undefined, + }; + }, + + toJSON(message: ResourceQuotaSpec): unknown { + const obj: any = {}; + if (message.hard) { + const entries = globalThis.Object.entries(message.hard) as [string, Quantity][]; + if (entries.length > 0) { + obj.hard = {}; + entries.forEach(([k, v]) => { + obj.hard[k] = Quantity.toJSON(v); + }); + } + } + if (message.scopes?.length) { + obj.scopes = message.scopes; + } + if (message.scopeSelector !== undefined) { + obj.scopeSelector = ScopeSelector.toJSON(message.scopeSelector); + } + return obj; + }, + + create, I>>(base?: I): ResourceQuotaSpec { + return ResourceQuotaSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceQuotaSpec { + const message = createBaseResourceQuotaSpec(); + message.hard = (globalThis.Object.entries(object.hard ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + message.scopes = object.scopes?.map((e) => e) || []; + message.scopeSelector = + object.scopeSelector !== undefined && object.scopeSelector !== null + ? ScopeSelector.fromPartial(object.scopeSelector) + : undefined; + return message; + }, +}; + +function createBaseResourceQuotaSpec_HardEntry(): ResourceQuotaSpec_HardEntry { + return { key: '', value: undefined }; +} + +export const ResourceQuotaSpec_HardEntry: MessageFns = { + encode(message: ResourceQuotaSpec_HardEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceQuotaSpec_HardEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceQuotaSpec_HardEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceQuotaSpec_HardEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ResourceQuotaSpec_HardEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ResourceQuotaSpec_HardEntry { + return ResourceQuotaSpec_HardEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ResourceQuotaSpec_HardEntry { + const message = createBaseResourceQuotaSpec_HardEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseResourceQuotaStatus(): ResourceQuotaStatus { + return { hard: {}, used: {} }; +} + +export const ResourceQuotaStatus: MessageFns = { + encode(message: ResourceQuotaStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + globalThis.Object.entries(message.hard).forEach(([key, value]: [string, Quantity]) => { + ResourceQuotaStatus_HardEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + globalThis.Object.entries(message.used).forEach(([key, value]: [string, Quantity]) => { + ResourceQuotaStatus_UsedEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceQuotaStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceQuotaStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + const entry1 = ResourceQuotaStatus_HardEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.hard[entry1.key] = entry1.value; + } + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = ResourceQuotaStatus_UsedEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.used[entry2.key] = entry2.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceQuotaStatus { + return { + hard: isObject(object.hard) + ? (globalThis.Object.entries(object.hard) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + used: isObject(object.used) + ? (globalThis.Object.entries(object.used) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: ResourceQuotaStatus): unknown { + const obj: any = {}; + if (message.hard) { + const entries = globalThis.Object.entries(message.hard) as [string, Quantity][]; + if (entries.length > 0) { + obj.hard = {}; + entries.forEach(([k, v]) => { + obj.hard[k] = Quantity.toJSON(v); + }); + } + } + if (message.used) { + const entries = globalThis.Object.entries(message.used) as [string, Quantity][]; + if (entries.length > 0) { + obj.used = {}; + entries.forEach(([k, v]) => { + obj.used[k] = Quantity.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): ResourceQuotaStatus { + return ResourceQuotaStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceQuotaStatus { + const message = createBaseResourceQuotaStatus(); + message.hard = (globalThis.Object.entries(object.hard ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + message.used = (globalThis.Object.entries(object.used ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseResourceQuotaStatus_HardEntry(): ResourceQuotaStatus_HardEntry { + return { key: '', value: undefined }; +} + +export const ResourceQuotaStatus_HardEntry: MessageFns = { + encode(message: ResourceQuotaStatus_HardEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceQuotaStatus_HardEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceQuotaStatus_HardEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceQuotaStatus_HardEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ResourceQuotaStatus_HardEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ResourceQuotaStatus_HardEntry { + return ResourceQuotaStatus_HardEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ResourceQuotaStatus_HardEntry { + const message = createBaseResourceQuotaStatus_HardEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseResourceQuotaStatus_UsedEntry(): ResourceQuotaStatus_UsedEntry { + return { key: '', value: undefined }; +} + +export const ResourceQuotaStatus_UsedEntry: MessageFns = { + encode(message: ResourceQuotaStatus_UsedEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceQuotaStatus_UsedEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceQuotaStatus_UsedEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceQuotaStatus_UsedEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ResourceQuotaStatus_UsedEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ResourceQuotaStatus_UsedEntry { + return ResourceQuotaStatus_UsedEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ResourceQuotaStatus_UsedEntry { + const message = createBaseResourceQuotaStatus_UsedEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseResourceRequirements(): ResourceRequirements { + return { limits: {}, requests: {}, claims: [] }; +} + +export const ResourceRequirements: MessageFns = { + encode(message: ResourceRequirements, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + globalThis.Object.entries(message.limits).forEach(([key, value]: [string, Quantity]) => { + ResourceRequirements_LimitsEntry.encode( + { key: key as any, value }, + writer.uint32(10).fork(), + ).join(); + }); + globalThis.Object.entries(message.requests).forEach(([key, value]: [string, Quantity]) => { + ResourceRequirements_RequestsEntry.encode( + { key: key as any, value }, + writer.uint32(18).fork(), + ).join(); + }); + for (const v of message.claims) { + ResourceClaim.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceRequirements { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceRequirements(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + const entry1 = ResourceRequirements_LimitsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.limits[entry1.key] = entry1.value; + } + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = ResourceRequirements_RequestsEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.requests[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.claims.push(ResourceClaim.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceRequirements { + return { + limits: isObject(object.limits) + ? (globalThis.Object.entries(object.limits) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + requests: isObject(object.requests) + ? (globalThis.Object.entries(object.requests) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + claims: globalThis.Array.isArray(object?.claims) + ? object.claims.map((e: any) => ResourceClaim.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ResourceRequirements): unknown { + const obj: any = {}; + if (message.limits) { + const entries = globalThis.Object.entries(message.limits) as [string, Quantity][]; + if (entries.length > 0) { + obj.limits = {}; + entries.forEach(([k, v]) => { + obj.limits[k] = Quantity.toJSON(v); + }); + } + } + if (message.requests) { + const entries = globalThis.Object.entries(message.requests) as [string, Quantity][]; + if (entries.length > 0) { + obj.requests = {}; + entries.forEach(([k, v]) => { + obj.requests[k] = Quantity.toJSON(v); + }); + } + } + if (message.claims?.length) { + obj.claims = message.claims.map((e) => ResourceClaim.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ResourceRequirements { + return ResourceRequirements.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceRequirements { + const message = createBaseResourceRequirements(); + message.limits = (globalThis.Object.entries(object.limits ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + message.requests = (globalThis.Object.entries(object.requests ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + message.claims = object.claims?.map((e) => ResourceClaim.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseResourceRequirements_LimitsEntry(): ResourceRequirements_LimitsEntry { + return { key: '', value: undefined }; +} + +export const ResourceRequirements_LimitsEntry: MessageFns = { + encode( + message: ResourceRequirements_LimitsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceRequirements_LimitsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceRequirements_LimitsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceRequirements_LimitsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ResourceRequirements_LimitsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ResourceRequirements_LimitsEntry { + return ResourceRequirements_LimitsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ResourceRequirements_LimitsEntry { + const message = createBaseResourceRequirements_LimitsEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseResourceRequirements_RequestsEntry(): ResourceRequirements_RequestsEntry { + return { key: '', value: undefined }; +} + +export const ResourceRequirements_RequestsEntry: MessageFns = { + encode( + message: ResourceRequirements_RequestsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceRequirements_RequestsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceRequirements_RequestsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceRequirements_RequestsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ResourceRequirements_RequestsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ResourceRequirements_RequestsEntry { + return ResourceRequirements_RequestsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ResourceRequirements_RequestsEntry { + const message = createBaseResourceRequirements_RequestsEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseResourceStatus(): ResourceStatus { + return { name: '', resources: [] }; +} + +export const ResourceStatus: MessageFns = { + encode(message: ResourceStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + for (const v of message.resources) { + ResourceHealth.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resources.push(ResourceHealth.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourceStatus { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + resources: globalThis.Array.isArray(object?.resources) + ? object.resources.map((e: any) => ResourceHealth.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ResourceStatus): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.resources?.length) { + obj.resources = message.resources.map((e) => ResourceHealth.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ResourceStatus { + return ResourceStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceStatus { + const message = createBaseResourceStatus(); + message.name = object.name ?? ''; + message.resources = object.resources?.map((e) => ResourceHealth.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSELinuxOptions(): SELinuxOptions { + return { user: '', role: '', type: '', level: '' }; +} + +export const SELinuxOptions: MessageFns = { + encode(message: SELinuxOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.user !== undefined && message.user !== '') { + writer.uint32(10).string(message.user); + } + if (message.role !== undefined && message.role !== '') { + writer.uint32(18).string(message.role); + } + if (message.type !== undefined && message.type !== '') { + writer.uint32(26).string(message.type); + } + if (message.level !== undefined && message.level !== '') { + writer.uint32(34).string(message.level); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SELinuxOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSELinuxOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.user = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.role = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.level = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SELinuxOptions { + return { + user: isSet(object.user) ? globalThis.String(object.user) : '', + role: isSet(object.role) ? globalThis.String(object.role) : '', + type: isSet(object.type) ? globalThis.String(object.type) : '', + level: isSet(object.level) ? globalThis.String(object.level) : '', + }; + }, + + toJSON(message: SELinuxOptions): unknown { + const obj: any = {}; + if (message.user !== undefined && message.user !== '') { + obj.user = message.user; + } + if (message.role !== undefined && message.role !== '') { + obj.role = message.role; + } + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.level !== undefined && message.level !== '') { + obj.level = message.level; + } + return obj; + }, + + create, I>>(base?: I): SELinuxOptions { + return SELinuxOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SELinuxOptions { + const message = createBaseSELinuxOptions(); + message.user = object.user ?? ''; + message.role = object.role ?? ''; + message.type = object.type ?? ''; + message.level = object.level ?? ''; + return message; + }, +}; + +function createBaseScaleIOPersistentVolumeSource(): ScaleIOPersistentVolumeSource { + return { + gateway: '', + system: '', + secretRef: undefined, + sslEnabled: false, + protectionDomain: '', + storagePool: '', + storageMode: '', + volumeName: '', + fsType: '', + readOnly: false, + }; +} + +export const ScaleIOPersistentVolumeSource: MessageFns = { + encode(message: ScaleIOPersistentVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gateway !== undefined && message.gateway !== '') { + writer.uint32(10).string(message.gateway); + } + if (message.system !== undefined && message.system !== '') { + writer.uint32(18).string(message.system); + } + if (message.secretRef !== undefined) { + SecretReference.encode(message.secretRef, writer.uint32(26).fork()).join(); + } + if (message.sslEnabled !== undefined && message.sslEnabled !== false) { + writer.uint32(32).bool(message.sslEnabled); + } + if (message.protectionDomain !== undefined && message.protectionDomain !== '') { + writer.uint32(42).string(message.protectionDomain); + } + if (message.storagePool !== undefined && message.storagePool !== '') { + writer.uint32(50).string(message.storagePool); + } + if (message.storageMode !== undefined && message.storageMode !== '') { + writer.uint32(58).string(message.storageMode); + } + if (message.volumeName !== undefined && message.volumeName !== '') { + writer.uint32(66).string(message.volumeName); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(74).string(message.fsType); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(80).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScaleIOPersistentVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScaleIOPersistentVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.gateway = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.system = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.secretRef = SecretReference.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.sslEnabled = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.protectionDomain = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.storagePool = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.storageMode = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.volumeName = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ScaleIOPersistentVolumeSource { + return { + gateway: isSet(object.gateway) ? globalThis.String(object.gateway) : '', + system: isSet(object.system) ? globalThis.String(object.system) : '', + secretRef: isSet(object.secretRef) ? SecretReference.fromJSON(object.secretRef) : undefined, + sslEnabled: isSet(object.sslEnabled) ? globalThis.Boolean(object.sslEnabled) : false, + protectionDomain: isSet(object.protectionDomain) + ? globalThis.String(object.protectionDomain) + : '', + storagePool: isSet(object.storagePool) ? globalThis.String(object.storagePool) : '', + storageMode: isSet(object.storageMode) ? globalThis.String(object.storageMode) : '', + volumeName: isSet(object.volumeName) ? globalThis.String(object.volumeName) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: ScaleIOPersistentVolumeSource): unknown { + const obj: any = {}; + if (message.gateway !== undefined && message.gateway !== '') { + obj.gateway = message.gateway; + } + if (message.system !== undefined && message.system !== '') { + obj.system = message.system; + } + if (message.secretRef !== undefined) { + obj.secretRef = SecretReference.toJSON(message.secretRef); + } + if (message.sslEnabled !== undefined && message.sslEnabled !== false) { + obj.sslEnabled = message.sslEnabled; + } + if (message.protectionDomain !== undefined && message.protectionDomain !== '') { + obj.protectionDomain = message.protectionDomain; + } + if (message.storagePool !== undefined && message.storagePool !== '') { + obj.storagePool = message.storagePool; + } + if (message.storageMode !== undefined && message.storageMode !== '') { + obj.storageMode = message.storageMode; + } + if (message.volumeName !== undefined && message.volumeName !== '') { + obj.volumeName = message.volumeName; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>( + base?: I, + ): ScaleIOPersistentVolumeSource { + return ScaleIOPersistentVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ScaleIOPersistentVolumeSource { + const message = createBaseScaleIOPersistentVolumeSource(); + message.gateway = object.gateway ?? ''; + message.system = object.system ?? ''; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? SecretReference.fromPartial(object.secretRef) + : undefined; + message.sslEnabled = object.sslEnabled ?? false; + message.protectionDomain = object.protectionDomain ?? ''; + message.storagePool = object.storagePool ?? ''; + message.storageMode = object.storageMode ?? ''; + message.volumeName = object.volumeName ?? ''; + message.fsType = object.fsType ?? ''; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBaseScaleIOVolumeSource(): ScaleIOVolumeSource { + return { + gateway: '', + system: '', + secretRef: undefined, + sslEnabled: false, + protectionDomain: '', + storagePool: '', + storageMode: '', + volumeName: '', + fsType: '', + readOnly: false, + }; +} + +export const ScaleIOVolumeSource: MessageFns = { + encode(message: ScaleIOVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gateway !== undefined && message.gateway !== '') { + writer.uint32(10).string(message.gateway); + } + if (message.system !== undefined && message.system !== '') { + writer.uint32(18).string(message.system); + } + if (message.secretRef !== undefined) { + LocalObjectReference.encode(message.secretRef, writer.uint32(26).fork()).join(); + } + if (message.sslEnabled !== undefined && message.sslEnabled !== false) { + writer.uint32(32).bool(message.sslEnabled); + } + if (message.protectionDomain !== undefined && message.protectionDomain !== '') { + writer.uint32(42).string(message.protectionDomain); + } + if (message.storagePool !== undefined && message.storagePool !== '') { + writer.uint32(50).string(message.storagePool); + } + if (message.storageMode !== undefined && message.storageMode !== '') { + writer.uint32(58).string(message.storageMode); + } + if (message.volumeName !== undefined && message.volumeName !== '') { + writer.uint32(66).string(message.volumeName); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(74).string(message.fsType); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(80).bool(message.readOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScaleIOVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScaleIOVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.gateway = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.system = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.secretRef = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.sslEnabled = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.protectionDomain = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.storagePool = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.storageMode = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.volumeName = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ScaleIOVolumeSource { + return { + gateway: isSet(object.gateway) ? globalThis.String(object.gateway) : '', + system: isSet(object.system) ? globalThis.String(object.system) : '', + secretRef: isSet(object.secretRef) ? LocalObjectReference.fromJSON(object.secretRef) : undefined, + sslEnabled: isSet(object.sslEnabled) ? globalThis.Boolean(object.sslEnabled) : false, + protectionDomain: isSet(object.protectionDomain) + ? globalThis.String(object.protectionDomain) + : '', + storagePool: isSet(object.storagePool) ? globalThis.String(object.storagePool) : '', + storageMode: isSet(object.storageMode) ? globalThis.String(object.storageMode) : '', + volumeName: isSet(object.volumeName) ? globalThis.String(object.volumeName) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + }; + }, + + toJSON(message: ScaleIOVolumeSource): unknown { + const obj: any = {}; + if (message.gateway !== undefined && message.gateway !== '') { + obj.gateway = message.gateway; + } + if (message.system !== undefined && message.system !== '') { + obj.system = message.system; + } + if (message.secretRef !== undefined) { + obj.secretRef = LocalObjectReference.toJSON(message.secretRef); + } + if (message.sslEnabled !== undefined && message.sslEnabled !== false) { + obj.sslEnabled = message.sslEnabled; + } + if (message.protectionDomain !== undefined && message.protectionDomain !== '') { + obj.protectionDomain = message.protectionDomain; + } + if (message.storagePool !== undefined && message.storagePool !== '') { + obj.storagePool = message.storagePool; + } + if (message.storageMode !== undefined && message.storageMode !== '') { + obj.storageMode = message.storageMode; + } + if (message.volumeName !== undefined && message.volumeName !== '') { + obj.volumeName = message.volumeName; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + + create, I>>(base?: I): ScaleIOVolumeSource { + return ScaleIOVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ScaleIOVolumeSource { + const message = createBaseScaleIOVolumeSource(); + message.gateway = object.gateway ?? ''; + message.system = object.system ?? ''; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? LocalObjectReference.fromPartial(object.secretRef) + : undefined; + message.sslEnabled = object.sslEnabled ?? false; + message.protectionDomain = object.protectionDomain ?? ''; + message.storagePool = object.storagePool ?? ''; + message.storageMode = object.storageMode ?? ''; + message.volumeName = object.volumeName ?? ''; + message.fsType = object.fsType ?? ''; + message.readOnly = object.readOnly ?? false; + return message; + }, +}; + +function createBaseScopeSelector(): ScopeSelector { + return { matchExpressions: [] }; +} + +export const ScopeSelector: MessageFns = { + encode(message: ScopeSelector, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.matchExpressions) { + ScopedResourceSelectorRequirement.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScopeSelector { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScopeSelector(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.matchExpressions.push( + ScopedResourceSelectorRequirement.decode(reader, reader.uint32()), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ScopeSelector { + return { + matchExpressions: globalThis.Array.isArray(object?.matchExpressions) + ? object.matchExpressions.map((e: any) => ScopedResourceSelectorRequirement.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ScopeSelector): unknown { + const obj: any = {}; + if (message.matchExpressions?.length) { + obj.matchExpressions = message.matchExpressions.map((e) => + ScopedResourceSelectorRequirement.toJSON(e), + ); + } + return obj; + }, + + create, I>>(base?: I): ScopeSelector { + return ScopeSelector.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ScopeSelector { + const message = createBaseScopeSelector(); + message.matchExpressions = + object.matchExpressions?.map((e) => ScopedResourceSelectorRequirement.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseScopedResourceSelectorRequirement(): ScopedResourceSelectorRequirement { + return { scopeName: '', operator: '', values: [] }; +} + +export const ScopedResourceSelectorRequirement: MessageFns = { + encode( + message: ScopedResourceSelectorRequirement, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.scopeName !== undefined && message.scopeName !== '') { + writer.uint32(10).string(message.scopeName); + } + if (message.operator !== undefined && message.operator !== '') { + writer.uint32(18).string(message.operator); + } + for (const v of message.values) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScopedResourceSelectorRequirement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScopedResourceSelectorRequirement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.scopeName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.operator = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.values.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ScopedResourceSelectorRequirement { + return { + scopeName: isSet(object.scopeName) ? globalThis.String(object.scopeName) : '', + operator: isSet(object.operator) ? globalThis.String(object.operator) : '', + values: globalThis.Array.isArray(object?.values) + ? object.values.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ScopedResourceSelectorRequirement): unknown { + const obj: any = {}; + if (message.scopeName !== undefined && message.scopeName !== '') { + obj.scopeName = message.scopeName; + } + if (message.operator !== undefined && message.operator !== '') { + obj.operator = message.operator; + } + if (message.values?.length) { + obj.values = message.values; + } + return obj; + }, + + create, I>>( + base?: I, + ): ScopedResourceSelectorRequirement { + return ScopedResourceSelectorRequirement.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ScopedResourceSelectorRequirement { + const message = createBaseScopedResourceSelectorRequirement(); + message.scopeName = object.scopeName ?? ''; + message.operator = object.operator ?? ''; + message.values = object.values?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSeccompProfile(): SeccompProfile { + return { type: '', localhostProfile: '' }; +} + +export const SeccompProfile: MessageFns = { + encode(message: SeccompProfile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.localhostProfile !== undefined && message.localhostProfile !== '') { + writer.uint32(18).string(message.localhostProfile); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SeccompProfile { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSeccompProfile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.localhostProfile = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SeccompProfile { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + localhostProfile: isSet(object.localhostProfile) + ? globalThis.String(object.localhostProfile) + : '', + }; + }, + + toJSON(message: SeccompProfile): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.localhostProfile !== undefined && message.localhostProfile !== '') { + obj.localhostProfile = message.localhostProfile; + } + return obj; + }, + + create, I>>(base?: I): SeccompProfile { + return SeccompProfile.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SeccompProfile { + const message = createBaseSeccompProfile(); + message.type = object.type ?? ''; + message.localhostProfile = object.localhostProfile ?? ''; + return message; + }, +}; + +function createBaseSecret(): Secret { + return { metadata: undefined, immutable: false, data: {}, stringData: {}, type: '' }; +} + +export const Secret: MessageFns = { + encode(message: Secret, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.immutable !== undefined && message.immutable !== false) { + writer.uint32(40).bool(message.immutable); + } + globalThis.Object.entries(message.data).forEach(([key, value]: [string, Uint8Array]) => { + Secret_DataEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); + }); + globalThis.Object.entries(message.stringData).forEach(([key, value]: [string, string]) => { + Secret_StringDataEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join(); + }); + if (message.type !== undefined && message.type !== '') { + writer.uint32(26).string(message.type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Secret { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecret(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.immutable = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = Secret_DataEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.data[entry2.key] = entry2.value; + } + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + const entry4 = Secret_StringDataEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.stringData[entry4.key] = entry4.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Secret { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + immutable: isSet(object.immutable) ? globalThis.Boolean(object.immutable) : false, + data: isObject(object.data) + ? (globalThis.Object.entries(object.data) as [string, any][]).reduce( + (acc: { [key: string]: Uint8Array }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: bytesFromBase64(value as string), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + stringData: isObject(object.stringData) + ? (globalThis.Object.entries(object.stringData) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + type: isSet(object.type) ? globalThis.String(object.type) : '', + }; + }, + + toJSON(message: Secret): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.immutable !== undefined && message.immutable !== false) { + obj.immutable = message.immutable; + } + if (message.data) { + const entries = globalThis.Object.entries(message.data) as [string, Uint8Array][]; + if (entries.length > 0) { + obj.data = {}; + entries.forEach(([k, v]) => { + obj.data[k] = base64FromBytes(v); + }); + } + } + if (message.stringData) { + const entries = globalThis.Object.entries(message.stringData) as [string, string][]; + if (entries.length > 0) { + obj.stringData = {}; + entries.forEach(([k, v]) => { + obj.stringData[k] = v; + }); + } + } + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + return obj; + }, + + create, I>>(base?: I): Secret { + return Secret.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Secret { + const message = createBaseSecret(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.immutable = object.immutable ?? false; + message.data = (globalThis.Object.entries(object.data ?? {}) as [string, Uint8Array][]).reduce( + (acc: { [key: string]: Uint8Array }, [key, value]: [string, Uint8Array]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, + {}, + ); + message.stringData = ( + globalThis.Object.entries(object.stringData ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.type = object.type ?? ''; + return message; + }, +}; + +function createBaseSecret_DataEntry(): Secret_DataEntry { + return { key: '', value: new Uint8Array(0) }; +} + +export const Secret_DataEntry: MessageFns = { + encode(message: Secret_DataEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Secret_DataEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecret_DataEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Secret_DataEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Secret_DataEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): Secret_DataEntry { + return Secret_DataEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Secret_DataEntry { + const message = createBaseSecret_DataEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSecret_StringDataEntry(): Secret_StringDataEntry { + return { key: '', value: '' }; +} + +export const Secret_StringDataEntry: MessageFns = { + encode(message: Secret_StringDataEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Secret_StringDataEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecret_StringDataEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Secret_StringDataEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: Secret_StringDataEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): Secret_StringDataEntry { + return Secret_StringDataEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Secret_StringDataEntry { + const message = createBaseSecret_StringDataEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBaseSecretEnvSource(): SecretEnvSource { + return { localObjectReference: undefined, optional: false }; +} + +export const SecretEnvSource: MessageFns = { + encode(message: SecretEnvSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.localObjectReference !== undefined) { + LocalObjectReference.encode(message.localObjectReference, writer.uint32(10).fork()).join(); + } + if (message.optional !== undefined && message.optional !== false) { + writer.uint32(16).bool(message.optional); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SecretEnvSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecretEnvSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.localObjectReference = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.optional = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SecretEnvSource { + return { + localObjectReference: isSet(object.localObjectReference) + ? LocalObjectReference.fromJSON(object.localObjectReference) + : undefined, + optional: isSet(object.optional) ? globalThis.Boolean(object.optional) : false, + }; + }, + + toJSON(message: SecretEnvSource): unknown { + const obj: any = {}; + if (message.localObjectReference !== undefined) { + obj.localObjectReference = LocalObjectReference.toJSON(message.localObjectReference); + } + if (message.optional !== undefined && message.optional !== false) { + obj.optional = message.optional; + } + return obj; + }, + + create, I>>(base?: I): SecretEnvSource { + return SecretEnvSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SecretEnvSource { + const message = createBaseSecretEnvSource(); + message.localObjectReference = + object.localObjectReference !== undefined && object.localObjectReference !== null + ? LocalObjectReference.fromPartial(object.localObjectReference) + : undefined; + message.optional = object.optional ?? false; + return message; + }, +}; + +function createBaseSecretKeySelector(): SecretKeySelector { + return { localObjectReference: undefined, key: '', optional: false }; +} + +export const SecretKeySelector: MessageFns = { + encode(message: SecretKeySelector, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.localObjectReference !== undefined) { + LocalObjectReference.encode(message.localObjectReference, writer.uint32(10).fork()).join(); + } + if (message.key !== undefined && message.key !== '') { + writer.uint32(18).string(message.key); + } + if (message.optional !== undefined && message.optional !== false) { + writer.uint32(24).bool(message.optional); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SecretKeySelector { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecretKeySelector(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.localObjectReference = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.optional = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SecretKeySelector { + return { + localObjectReference: isSet(object.localObjectReference) + ? LocalObjectReference.fromJSON(object.localObjectReference) + : undefined, + key: isSet(object.key) ? globalThis.String(object.key) : '', + optional: isSet(object.optional) ? globalThis.Boolean(object.optional) : false, + }; + }, + + toJSON(message: SecretKeySelector): unknown { + const obj: any = {}; + if (message.localObjectReference !== undefined) { + obj.localObjectReference = LocalObjectReference.toJSON(message.localObjectReference); + } + if (message.key !== undefined && message.key !== '') { + obj.key = message.key; + } + if (message.optional !== undefined && message.optional !== false) { + obj.optional = message.optional; + } + return obj; + }, + + create, I>>(base?: I): SecretKeySelector { + return SecretKeySelector.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SecretKeySelector { + const message = createBaseSecretKeySelector(); + message.localObjectReference = + object.localObjectReference !== undefined && object.localObjectReference !== null + ? LocalObjectReference.fromPartial(object.localObjectReference) + : undefined; + message.key = object.key ?? ''; + message.optional = object.optional ?? false; + return message; + }, +}; + +function createBaseSecretList(): SecretList { + return { metadata: undefined, items: [] }; +} + +export const SecretList: MessageFns = { + encode(message: SecretList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Secret.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SecretList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecretList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Secret.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SecretList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Secret.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SecretList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Secret.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SecretList { + return SecretList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SecretList { + const message = createBaseSecretList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Secret.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSecretProjection(): SecretProjection { + return { localObjectReference: undefined, items: [], optional: false }; +} + +export const SecretProjection: MessageFns = { + encode(message: SecretProjection, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.localObjectReference !== undefined) { + LocalObjectReference.encode(message.localObjectReference, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + KeyToPath.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.optional !== undefined && message.optional !== false) { + writer.uint32(32).bool(message.optional); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SecretProjection { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecretProjection(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.localObjectReference = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(KeyToPath.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.optional = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SecretProjection { + return { + localObjectReference: isSet(object.localObjectReference) + ? LocalObjectReference.fromJSON(object.localObjectReference) + : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => KeyToPath.fromJSON(e)) + : [], + optional: isSet(object.optional) ? globalThis.Boolean(object.optional) : false, + }; + }, + + toJSON(message: SecretProjection): unknown { + const obj: any = {}; + if (message.localObjectReference !== undefined) { + obj.localObjectReference = LocalObjectReference.toJSON(message.localObjectReference); + } + if (message.items?.length) { + obj.items = message.items.map((e) => KeyToPath.toJSON(e)); + } + if (message.optional !== undefined && message.optional !== false) { + obj.optional = message.optional; + } + return obj; + }, + + create, I>>(base?: I): SecretProjection { + return SecretProjection.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SecretProjection { + const message = createBaseSecretProjection(); + message.localObjectReference = + object.localObjectReference !== undefined && object.localObjectReference !== null + ? LocalObjectReference.fromPartial(object.localObjectReference) + : undefined; + message.items = object.items?.map((e) => KeyToPath.fromPartial(e)) || []; + message.optional = object.optional ?? false; + return message; + }, +}; + +function createBaseSecretReference(): SecretReference { + return { name: '', namespace: '' }; +} + +export const SecretReference: MessageFns = { + encode(message: SecretReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(18).string(message.namespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SecretReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecretReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.namespace = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SecretReference { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + }; + }, + + toJSON(message: SecretReference): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + return obj; + }, + + create, I>>(base?: I): SecretReference { + return SecretReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SecretReference { + const message = createBaseSecretReference(); + message.name = object.name ?? ''; + message.namespace = object.namespace ?? ''; + return message; + }, +}; + +function createBaseSecretVolumeSource(): SecretVolumeSource { + return { secretName: '', items: [], defaultMode: 0, optional: false, defaultUser: 0 }; +} + +export const SecretVolumeSource: MessageFns = { + encode(message: SecretVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.secretName !== undefined && message.secretName !== '') { + writer.uint32(10).string(message.secretName); + } + for (const v of message.items) { + KeyToPath.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.defaultMode !== undefined && message.defaultMode !== 0) { + writer.uint32(24).int32(message.defaultMode); + } + if (message.optional !== undefined && message.optional !== false) { + writer.uint32(32).bool(message.optional); + } + if (message.defaultUser !== undefined && message.defaultUser !== 0) { + writer.uint32(40).int64(message.defaultUser); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SecretVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecretVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.secretName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(KeyToPath.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.defaultMode = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.optional = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.defaultUser = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SecretVolumeSource { + return { + secretName: isSet(object.secretName) ? globalThis.String(object.secretName) : '', + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => KeyToPath.fromJSON(e)) + : [], + defaultMode: isSet(object.defaultMode) ? globalThis.Number(object.defaultMode) : 0, + optional: isSet(object.optional) ? globalThis.Boolean(object.optional) : false, + defaultUser: isSet(object.defaultUser) ? globalThis.Number(object.defaultUser) : 0, + }; + }, + + toJSON(message: SecretVolumeSource): unknown { + const obj: any = {}; + if (message.secretName !== undefined && message.secretName !== '') { + obj.secretName = message.secretName; + } + if (message.items?.length) { + obj.items = message.items.map((e) => KeyToPath.toJSON(e)); + } + if (message.defaultMode !== undefined && message.defaultMode !== 0) { + obj.defaultMode = Math.round(message.defaultMode); + } + if (message.optional !== undefined && message.optional !== false) { + obj.optional = message.optional; + } + if (message.defaultUser !== undefined && message.defaultUser !== 0) { + obj.defaultUser = Math.round(message.defaultUser); + } + return obj; + }, + + create, I>>(base?: I): SecretVolumeSource { + return SecretVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SecretVolumeSource { + const message = createBaseSecretVolumeSource(); + message.secretName = object.secretName ?? ''; + message.items = object.items?.map((e) => KeyToPath.fromPartial(e)) || []; + message.defaultMode = object.defaultMode ?? 0; + message.optional = object.optional ?? false; + message.defaultUser = object.defaultUser ?? 0; + return message; + }, +}; + +function createBaseSecurityContext(): SecurityContext { + return { + capabilities: undefined, + privileged: false, + seLinuxOptions: undefined, + windowsOptions: undefined, + runAsUser: 0, + runAsGroup: 0, + runAsNonRoot: false, + readOnlyRootFilesystem: false, + allowPrivilegeEscalation: false, + procMount: '', + seccompProfile: undefined, + appArmorProfile: undefined, + }; +} + +export const SecurityContext: MessageFns = { + encode(message: SecurityContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.capabilities !== undefined) { + Capabilities.encode(message.capabilities, writer.uint32(10).fork()).join(); + } + if (message.privileged !== undefined && message.privileged !== false) { + writer.uint32(16).bool(message.privileged); + } + if (message.seLinuxOptions !== undefined) { + SELinuxOptions.encode(message.seLinuxOptions, writer.uint32(26).fork()).join(); + } + if (message.windowsOptions !== undefined) { + WindowsSecurityContextOptions.encode(message.windowsOptions, writer.uint32(82).fork()).join(); + } + if (message.runAsUser !== undefined && message.runAsUser !== 0) { + writer.uint32(32).int64(message.runAsUser); + } + if (message.runAsGroup !== undefined && message.runAsGroup !== 0) { + writer.uint32(64).int64(message.runAsGroup); + } + if (message.runAsNonRoot !== undefined && message.runAsNonRoot !== false) { + writer.uint32(40).bool(message.runAsNonRoot); + } + if (message.readOnlyRootFilesystem !== undefined && message.readOnlyRootFilesystem !== false) { + writer.uint32(48).bool(message.readOnlyRootFilesystem); + } + if (message.allowPrivilegeEscalation !== undefined && message.allowPrivilegeEscalation !== false) { + writer.uint32(56).bool(message.allowPrivilegeEscalation); + } + if (message.procMount !== undefined && message.procMount !== '') { + writer.uint32(74).string(message.procMount); + } + if (message.seccompProfile !== undefined) { + SeccompProfile.encode(message.seccompProfile, writer.uint32(90).fork()).join(); + } + if (message.appArmorProfile !== undefined) { + AppArmorProfile.encode(message.appArmorProfile, writer.uint32(98).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SecurityContext { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSecurityContext(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.capabilities = Capabilities.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.privileged = reader.bool(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.seLinuxOptions = SELinuxOptions.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.windowsOptions = WindowsSecurityContextOptions.decode( + reader, + reader.uint32(), + ); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.runAsUser = longToNumber(reader.int64()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.runAsGroup = longToNumber(reader.int64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.runAsNonRoot = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.readOnlyRootFilesystem = reader.bool(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.allowPrivilegeEscalation = reader.bool(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.procMount = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.seccompProfile = SeccompProfile.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.appArmorProfile = AppArmorProfile.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SecurityContext { + return { + capabilities: isSet(object.capabilities) ? Capabilities.fromJSON(object.capabilities) : undefined, + privileged: isSet(object.privileged) ? globalThis.Boolean(object.privileged) : false, + seLinuxOptions: isSet(object.seLinuxOptions) + ? SELinuxOptions.fromJSON(object.seLinuxOptions) + : undefined, + windowsOptions: isSet(object.windowsOptions) + ? WindowsSecurityContextOptions.fromJSON(object.windowsOptions) + : undefined, + runAsUser: isSet(object.runAsUser) ? globalThis.Number(object.runAsUser) : 0, + runAsGroup: isSet(object.runAsGroup) ? globalThis.Number(object.runAsGroup) : 0, + runAsNonRoot: isSet(object.runAsNonRoot) ? globalThis.Boolean(object.runAsNonRoot) : false, + readOnlyRootFilesystem: isSet(object.readOnlyRootFilesystem) + ? globalThis.Boolean(object.readOnlyRootFilesystem) + : false, + allowPrivilegeEscalation: isSet(object.allowPrivilegeEscalation) + ? globalThis.Boolean(object.allowPrivilegeEscalation) + : false, + procMount: isSet(object.procMount) ? globalThis.String(object.procMount) : '', + seccompProfile: isSet(object.seccompProfile) + ? SeccompProfile.fromJSON(object.seccompProfile) + : undefined, + appArmorProfile: isSet(object.appArmorProfile) + ? AppArmorProfile.fromJSON(object.appArmorProfile) + : undefined, + }; + }, + + toJSON(message: SecurityContext): unknown { + const obj: any = {}; + if (message.capabilities !== undefined) { + obj.capabilities = Capabilities.toJSON(message.capabilities); + } + if (message.privileged !== undefined && message.privileged !== false) { + obj.privileged = message.privileged; + } + if (message.seLinuxOptions !== undefined) { + obj.seLinuxOptions = SELinuxOptions.toJSON(message.seLinuxOptions); + } + if (message.windowsOptions !== undefined) { + obj.windowsOptions = WindowsSecurityContextOptions.toJSON(message.windowsOptions); + } + if (message.runAsUser !== undefined && message.runAsUser !== 0) { + obj.runAsUser = Math.round(message.runAsUser); + } + if (message.runAsGroup !== undefined && message.runAsGroup !== 0) { + obj.runAsGroup = Math.round(message.runAsGroup); + } + if (message.runAsNonRoot !== undefined && message.runAsNonRoot !== false) { + obj.runAsNonRoot = message.runAsNonRoot; + } + if (message.readOnlyRootFilesystem !== undefined && message.readOnlyRootFilesystem !== false) { + obj.readOnlyRootFilesystem = message.readOnlyRootFilesystem; + } + if (message.allowPrivilegeEscalation !== undefined && message.allowPrivilegeEscalation !== false) { + obj.allowPrivilegeEscalation = message.allowPrivilegeEscalation; + } + if (message.procMount !== undefined && message.procMount !== '') { + obj.procMount = message.procMount; + } + if (message.seccompProfile !== undefined) { + obj.seccompProfile = SeccompProfile.toJSON(message.seccompProfile); + } + if (message.appArmorProfile !== undefined) { + obj.appArmorProfile = AppArmorProfile.toJSON(message.appArmorProfile); + } + return obj; + }, + + create, I>>(base?: I): SecurityContext { + return SecurityContext.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SecurityContext { + const message = createBaseSecurityContext(); + message.capabilities = + object.capabilities !== undefined && object.capabilities !== null + ? Capabilities.fromPartial(object.capabilities) + : undefined; + message.privileged = object.privileged ?? false; + message.seLinuxOptions = + object.seLinuxOptions !== undefined && object.seLinuxOptions !== null + ? SELinuxOptions.fromPartial(object.seLinuxOptions) + : undefined; + message.windowsOptions = + object.windowsOptions !== undefined && object.windowsOptions !== null + ? WindowsSecurityContextOptions.fromPartial(object.windowsOptions) + : undefined; + message.runAsUser = object.runAsUser ?? 0; + message.runAsGroup = object.runAsGroup ?? 0; + message.runAsNonRoot = object.runAsNonRoot ?? false; + message.readOnlyRootFilesystem = object.readOnlyRootFilesystem ?? false; + message.allowPrivilegeEscalation = object.allowPrivilegeEscalation ?? false; + message.procMount = object.procMount ?? ''; + message.seccompProfile = + object.seccompProfile !== undefined && object.seccompProfile !== null + ? SeccompProfile.fromPartial(object.seccompProfile) + : undefined; + message.appArmorProfile = + object.appArmorProfile !== undefined && object.appArmorProfile !== null + ? AppArmorProfile.fromPartial(object.appArmorProfile) + : undefined; + return message; + }, +}; + +function createBaseSerializedReference(): SerializedReference { + return { reference: undefined }; +} + +export const SerializedReference: MessageFns = { + encode(message: SerializedReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reference !== undefined) { + ObjectReference.encode(message.reference, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SerializedReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSerializedReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.reference = ObjectReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SerializedReference { + return { + reference: isSet(object.reference) ? ObjectReference.fromJSON(object.reference) : undefined, + }; + }, + + toJSON(message: SerializedReference): unknown { + const obj: any = {}; + if (message.reference !== undefined) { + obj.reference = ObjectReference.toJSON(message.reference); + } + return obj; + }, + + create, I>>(base?: I): SerializedReference { + return SerializedReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SerializedReference { + const message = createBaseSerializedReference(); + message.reference = + object.reference !== undefined && object.reference !== null + ? ObjectReference.fromPartial(object.reference) + : undefined; + return message; + }, +}; + +function createBaseService(): Service { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const Service: MessageFns = { + encode(message: Service, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + ServiceSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + ServiceStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Service { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseService(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = ServiceSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = ServiceStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Service { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? ServiceSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? ServiceStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: Service): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = ServiceSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = ServiceStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): Service { + return Service.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Service { + const message = createBaseService(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? ServiceSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? ServiceStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseServiceAccount(): ServiceAccount { + return { metadata: undefined, secrets: [], imagePullSecrets: [], automountServiceAccountToken: false }; +} + +export const ServiceAccount: MessageFns = { + encode(message: ServiceAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.secrets) { + ObjectReference.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.imagePullSecrets) { + LocalObjectReference.encode(v!, writer.uint32(26).fork()).join(); + } + if ( + message.automountServiceAccountToken !== undefined && + message.automountServiceAccountToken !== false + ) { + writer.uint32(32).bool(message.automountServiceAccountToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.secrets.push(ObjectReference.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.imagePullSecrets.push(LocalObjectReference.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.automountServiceAccountToken = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceAccount { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + secrets: globalThis.Array.isArray(object?.secrets) + ? object.secrets.map((e: any) => ObjectReference.fromJSON(e)) + : [], + imagePullSecrets: globalThis.Array.isArray(object?.imagePullSecrets) + ? object.imagePullSecrets.map((e: any) => LocalObjectReference.fromJSON(e)) + : [], + automountServiceAccountToken: isSet(object.automountServiceAccountToken) + ? globalThis.Boolean(object.automountServiceAccountToken) + : false, + }; + }, + + toJSON(message: ServiceAccount): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.secrets?.length) { + obj.secrets = message.secrets.map((e) => ObjectReference.toJSON(e)); + } + if (message.imagePullSecrets?.length) { + obj.imagePullSecrets = message.imagePullSecrets.map((e) => LocalObjectReference.toJSON(e)); + } + if ( + message.automountServiceAccountToken !== undefined && + message.automountServiceAccountToken !== false + ) { + obj.automountServiceAccountToken = message.automountServiceAccountToken; + } + return obj; + }, + + create, I>>(base?: I): ServiceAccount { + return ServiceAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceAccount { + const message = createBaseServiceAccount(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.secrets = object.secrets?.map((e) => ObjectReference.fromPartial(e)) || []; + message.imagePullSecrets = + object.imagePullSecrets?.map((e) => LocalObjectReference.fromPartial(e)) || []; + message.automountServiceAccountToken = object.automountServiceAccountToken ?? false; + return message; + }, +}; + +function createBaseServiceAccountList(): ServiceAccountList { + return { metadata: undefined, items: [] }; +} + +export const ServiceAccountList: MessageFns = { + encode(message: ServiceAccountList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ServiceAccount.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceAccountList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceAccountList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ServiceAccount.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceAccountList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ServiceAccount.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ServiceAccountList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ServiceAccount.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ServiceAccountList { + return ServiceAccountList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceAccountList { + const message = createBaseServiceAccountList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ServiceAccount.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseServiceAccountTokenProjection(): ServiceAccountTokenProjection { + return { audience: '', expirationSeconds: 0, path: '', user: 0 }; +} + +export const ServiceAccountTokenProjection: MessageFns = { + encode(message: ServiceAccountTokenProjection, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.audience !== undefined && message.audience !== '') { + writer.uint32(10).string(message.audience); + } + if (message.expirationSeconds !== undefined && message.expirationSeconds !== 0) { + writer.uint32(16).int64(message.expirationSeconds); + } + if (message.path !== undefined && message.path !== '') { + writer.uint32(26).string(message.path); + } + if (message.user !== undefined && message.user !== 0) { + writer.uint32(32).int64(message.user); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceAccountTokenProjection { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceAccountTokenProjection(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.audience = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.expirationSeconds = longToNumber(reader.int64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.path = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.user = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceAccountTokenProjection { + return { + audience: isSet(object.audience) ? globalThis.String(object.audience) : '', + expirationSeconds: isSet(object.expirationSeconds) + ? globalThis.Number(object.expirationSeconds) + : 0, + path: isSet(object.path) ? globalThis.String(object.path) : '', + user: isSet(object.user) ? globalThis.Number(object.user) : 0, + }; + }, + + toJSON(message: ServiceAccountTokenProjection): unknown { + const obj: any = {}; + if (message.audience !== undefined && message.audience !== '') { + obj.audience = message.audience; + } + if (message.expirationSeconds !== undefined && message.expirationSeconds !== 0) { + obj.expirationSeconds = Math.round(message.expirationSeconds); + } + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.user !== undefined && message.user !== 0) { + obj.user = Math.round(message.user); + } + return obj; + }, + + create, I>>( + base?: I, + ): ServiceAccountTokenProjection { + return ServiceAccountTokenProjection.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ServiceAccountTokenProjection { + const message = createBaseServiceAccountTokenProjection(); + message.audience = object.audience ?? ''; + message.expirationSeconds = object.expirationSeconds ?? 0; + message.path = object.path ?? ''; + message.user = object.user ?? 0; + return message; + }, +}; + +function createBaseServiceList(): ServiceList { + return { metadata: undefined, items: [] }; +} + +export const ServiceList: MessageFns = { + encode(message: ServiceList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Service.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Service.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Service.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ServiceList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Service.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ServiceList { + return ServiceList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceList { + const message = createBaseServiceList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Service.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseServicePort(): ServicePort { + return { name: '', protocol: '', appProtocol: '', port: 0, targetPort: undefined, nodePort: 0 }; +} + +export const ServicePort: MessageFns = { + encode(message: ServicePort, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.protocol !== undefined && message.protocol !== '') { + writer.uint32(18).string(message.protocol); + } + if (message.appProtocol !== undefined && message.appProtocol !== '') { + writer.uint32(50).string(message.appProtocol); + } + if (message.port !== undefined && message.port !== 0) { + writer.uint32(24).int32(message.port); + } + if (message.targetPort !== undefined) { + IntOrString.encode(message.targetPort, writer.uint32(34).fork()).join(); + } + if (message.nodePort !== undefined && message.nodePort !== 0) { + writer.uint32(40).int32(message.nodePort); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServicePort { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServicePort(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.protocol = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.appProtocol = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.port = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.targetPort = IntOrString.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.nodePort = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServicePort { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + protocol: isSet(object.protocol) ? globalThis.String(object.protocol) : '', + appProtocol: isSet(object.appProtocol) ? globalThis.String(object.appProtocol) : '', + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + targetPort: isSet(object.targetPort) ? IntOrString.fromJSON(object.targetPort) : undefined, + nodePort: isSet(object.nodePort) ? globalThis.Number(object.nodePort) : 0, + }; + }, + + toJSON(message: ServicePort): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.protocol !== undefined && message.protocol !== '') { + obj.protocol = message.protocol; + } + if (message.appProtocol !== undefined && message.appProtocol !== '') { + obj.appProtocol = message.appProtocol; + } + if (message.port !== undefined && message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.targetPort !== undefined) { + obj.targetPort = IntOrString.toJSON(message.targetPort); + } + if (message.nodePort !== undefined && message.nodePort !== 0) { + obj.nodePort = Math.round(message.nodePort); + } + return obj; + }, + + create, I>>(base?: I): ServicePort { + return ServicePort.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServicePort { + const message = createBaseServicePort(); + message.name = object.name ?? ''; + message.protocol = object.protocol ?? ''; + message.appProtocol = object.appProtocol ?? ''; + message.port = object.port ?? 0; + message.targetPort = + object.targetPort !== undefined && object.targetPort !== null + ? IntOrString.fromPartial(object.targetPort) + : undefined; + message.nodePort = object.nodePort ?? 0; + return message; + }, +}; + +function createBaseServiceProxyOptions(): ServiceProxyOptions { + return { path: '' }; +} + +export const ServiceProxyOptions: MessageFns = { + encode(message: ServiceProxyOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined && message.path !== '') { + writer.uint32(10).string(message.path); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceProxyOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceProxyOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceProxyOptions { + return { path: isSet(object.path) ? globalThis.String(object.path) : '' }; + }, + + toJSON(message: ServiceProxyOptions): unknown { + const obj: any = {}; + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + return obj; + }, + + create, I>>(base?: I): ServiceProxyOptions { + return ServiceProxyOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceProxyOptions { + const message = createBaseServiceProxyOptions(); + message.path = object.path ?? ''; + return message; + }, +}; + +function createBaseServiceSpec(): ServiceSpec { + return { + ports: [], + selector: {}, + clusterIP: '', + clusterIPs: [], + type: '', + externalIPs: [], + sessionAffinity: '', + loadBalancerIP: '', + loadBalancerSourceRanges: [], + externalName: '', + externalTrafficPolicy: '', + healthCheckNodePort: 0, + publishNotReadyAddresses: false, + sessionAffinityConfig: undefined, + ipFamilies: [], + ipFamilyPolicy: '', + allocateLoadBalancerNodePorts: false, + loadBalancerClass: '', + internalTrafficPolicy: '', + trafficDistribution: '', + }; +} + +export const ServiceSpec: MessageFns = { + encode(message: ServiceSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ports) { + ServicePort.encode(v!, writer.uint32(10).fork()).join(); + } + globalThis.Object.entries(message.selector).forEach(([key, value]: [string, string]) => { + ServiceSpec_SelectorEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); + }); + if (message.clusterIP !== undefined && message.clusterIP !== '') { + writer.uint32(26).string(message.clusterIP); + } + for (const v of message.clusterIPs) { + writer.uint32(146).string(v!); + } + if (message.type !== undefined && message.type !== '') { + writer.uint32(34).string(message.type); + } + for (const v of message.externalIPs) { + writer.uint32(42).string(v!); + } + if (message.sessionAffinity !== undefined && message.sessionAffinity !== '') { + writer.uint32(58).string(message.sessionAffinity); + } + if (message.loadBalancerIP !== undefined && message.loadBalancerIP !== '') { + writer.uint32(66).string(message.loadBalancerIP); + } + for (const v of message.loadBalancerSourceRanges) { + writer.uint32(74).string(v!); + } + if (message.externalName !== undefined && message.externalName !== '') { + writer.uint32(82).string(message.externalName); + } + if (message.externalTrafficPolicy !== undefined && message.externalTrafficPolicy !== '') { + writer.uint32(90).string(message.externalTrafficPolicy); + } + if (message.healthCheckNodePort !== undefined && message.healthCheckNodePort !== 0) { + writer.uint32(96).int32(message.healthCheckNodePort); + } + if (message.publishNotReadyAddresses !== undefined && message.publishNotReadyAddresses !== false) { + writer.uint32(104).bool(message.publishNotReadyAddresses); + } + if (message.sessionAffinityConfig !== undefined) { + SessionAffinityConfig.encode(message.sessionAffinityConfig, writer.uint32(114).fork()).join(); + } + for (const v of message.ipFamilies) { + writer.uint32(154).string(v!); + } + if (message.ipFamilyPolicy !== undefined && message.ipFamilyPolicy !== '') { + writer.uint32(138).string(message.ipFamilyPolicy); + } + if ( + message.allocateLoadBalancerNodePorts !== undefined && + message.allocateLoadBalancerNodePorts !== false + ) { + writer.uint32(160).bool(message.allocateLoadBalancerNodePorts); + } + if (message.loadBalancerClass !== undefined && message.loadBalancerClass !== '') { + writer.uint32(170).string(message.loadBalancerClass); + } + if (message.internalTrafficPolicy !== undefined && message.internalTrafficPolicy !== '') { + writer.uint32(178).string(message.internalTrafficPolicy); + } + if (message.trafficDistribution !== undefined && message.trafficDistribution !== '') { + writer.uint32(186).string(message.trafficDistribution); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ports.push(ServicePort.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = ServiceSpec_SelectorEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.selector[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.clusterIP = reader.string(); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + + message.clusterIPs.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.type = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.externalIPs.push(reader.string()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.sessionAffinity = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.loadBalancerIP = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.loadBalancerSourceRanges.push(reader.string()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.externalName = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.externalTrafficPolicy = reader.string(); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + + message.healthCheckNodePort = reader.int32(); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + + message.publishNotReadyAddresses = reader.bool(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.sessionAffinityConfig = SessionAffinityConfig.decode(reader, reader.uint32()); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + + message.ipFamilies.push(reader.string()); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + + message.ipFamilyPolicy = reader.string(); + continue; + } + case 20: { + if (tag !== 160) { + break; + } + + message.allocateLoadBalancerNodePorts = reader.bool(); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + + message.loadBalancerClass = reader.string(); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + + message.internalTrafficPolicy = reader.string(); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + + message.trafficDistribution = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceSpec { + return { + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => ServicePort.fromJSON(e)) + : [], + selector: isObject(object.selector) + ? (globalThis.Object.entries(object.selector) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + clusterIP: isSet(object.clusterIP) ? globalThis.String(object.clusterIP) : '', + clusterIPs: globalThis.Array.isArray(object?.clusterIPs) + ? object.clusterIPs.map((e: any) => globalThis.String(e)) + : [], + type: isSet(object.type) ? globalThis.String(object.type) : '', + externalIPs: globalThis.Array.isArray(object?.externalIPs) + ? object.externalIPs.map((e: any) => globalThis.String(e)) + : [], + sessionAffinity: isSet(object.sessionAffinity) ? globalThis.String(object.sessionAffinity) : '', + loadBalancerIP: isSet(object.loadBalancerIP) ? globalThis.String(object.loadBalancerIP) : '', + loadBalancerSourceRanges: globalThis.Array.isArray(object?.loadBalancerSourceRanges) + ? object.loadBalancerSourceRanges.map((e: any) => globalThis.String(e)) + : [], + externalName: isSet(object.externalName) ? globalThis.String(object.externalName) : '', + externalTrafficPolicy: isSet(object.externalTrafficPolicy) + ? globalThis.String(object.externalTrafficPolicy) + : '', + healthCheckNodePort: isSet(object.healthCheckNodePort) + ? globalThis.Number(object.healthCheckNodePort) + : 0, + publishNotReadyAddresses: isSet(object.publishNotReadyAddresses) + ? globalThis.Boolean(object.publishNotReadyAddresses) + : false, + sessionAffinityConfig: isSet(object.sessionAffinityConfig) + ? SessionAffinityConfig.fromJSON(object.sessionAffinityConfig) + : undefined, + ipFamilies: globalThis.Array.isArray(object?.ipFamilies) + ? object.ipFamilies.map((e: any) => globalThis.String(e)) + : [], + ipFamilyPolicy: isSet(object.ipFamilyPolicy) ? globalThis.String(object.ipFamilyPolicy) : '', + allocateLoadBalancerNodePorts: isSet(object.allocateLoadBalancerNodePorts) + ? globalThis.Boolean(object.allocateLoadBalancerNodePorts) + : false, + loadBalancerClass: isSet(object.loadBalancerClass) + ? globalThis.String(object.loadBalancerClass) + : '', + internalTrafficPolicy: isSet(object.internalTrafficPolicy) + ? globalThis.String(object.internalTrafficPolicy) + : '', + trafficDistribution: isSet(object.trafficDistribution) + ? globalThis.String(object.trafficDistribution) + : '', + }; + }, + + toJSON(message: ServiceSpec): unknown { + const obj: any = {}; + if (message.ports?.length) { + obj.ports = message.ports.map((e) => ServicePort.toJSON(e)); + } + if (message.selector) { + const entries = globalThis.Object.entries(message.selector) as [string, string][]; + if (entries.length > 0) { + obj.selector = {}; + entries.forEach(([k, v]) => { + obj.selector[k] = v; + }); + } + } + if (message.clusterIP !== undefined && message.clusterIP !== '') { + obj.clusterIP = message.clusterIP; + } + if (message.clusterIPs?.length) { + obj.clusterIPs = message.clusterIPs; + } + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.externalIPs?.length) { + obj.externalIPs = message.externalIPs; + } + if (message.sessionAffinity !== undefined && message.sessionAffinity !== '') { + obj.sessionAffinity = message.sessionAffinity; + } + if (message.loadBalancerIP !== undefined && message.loadBalancerIP !== '') { + obj.loadBalancerIP = message.loadBalancerIP; + } + if (message.loadBalancerSourceRanges?.length) { + obj.loadBalancerSourceRanges = message.loadBalancerSourceRanges; + } + if (message.externalName !== undefined && message.externalName !== '') { + obj.externalName = message.externalName; + } + if (message.externalTrafficPolicy !== undefined && message.externalTrafficPolicy !== '') { + obj.externalTrafficPolicy = message.externalTrafficPolicy; + } + if (message.healthCheckNodePort !== undefined && message.healthCheckNodePort !== 0) { + obj.healthCheckNodePort = Math.round(message.healthCheckNodePort); + } + if (message.publishNotReadyAddresses !== undefined && message.publishNotReadyAddresses !== false) { + obj.publishNotReadyAddresses = message.publishNotReadyAddresses; + } + if (message.sessionAffinityConfig !== undefined) { + obj.sessionAffinityConfig = SessionAffinityConfig.toJSON(message.sessionAffinityConfig); + } + if (message.ipFamilies?.length) { + obj.ipFamilies = message.ipFamilies; + } + if (message.ipFamilyPolicy !== undefined && message.ipFamilyPolicy !== '') { + obj.ipFamilyPolicy = message.ipFamilyPolicy; + } + if ( + message.allocateLoadBalancerNodePorts !== undefined && + message.allocateLoadBalancerNodePorts !== false + ) { + obj.allocateLoadBalancerNodePorts = message.allocateLoadBalancerNodePorts; + } + if (message.loadBalancerClass !== undefined && message.loadBalancerClass !== '') { + obj.loadBalancerClass = message.loadBalancerClass; + } + if (message.internalTrafficPolicy !== undefined && message.internalTrafficPolicy !== '') { + obj.internalTrafficPolicy = message.internalTrafficPolicy; + } + if (message.trafficDistribution !== undefined && message.trafficDistribution !== '') { + obj.trafficDistribution = message.trafficDistribution; + } + return obj; + }, + + create, I>>(base?: I): ServiceSpec { + return ServiceSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceSpec { + const message = createBaseServiceSpec(); + message.ports = object.ports?.map((e) => ServicePort.fromPartial(e)) || []; + message.selector = (globalThis.Object.entries(object.selector ?? {}) as [string, string][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.clusterIP = object.clusterIP ?? ''; + message.clusterIPs = object.clusterIPs?.map((e) => e) || []; + message.type = object.type ?? ''; + message.externalIPs = object.externalIPs?.map((e) => e) || []; + message.sessionAffinity = object.sessionAffinity ?? ''; + message.loadBalancerIP = object.loadBalancerIP ?? ''; + message.loadBalancerSourceRanges = object.loadBalancerSourceRanges?.map((e) => e) || []; + message.externalName = object.externalName ?? ''; + message.externalTrafficPolicy = object.externalTrafficPolicy ?? ''; + message.healthCheckNodePort = object.healthCheckNodePort ?? 0; + message.publishNotReadyAddresses = object.publishNotReadyAddresses ?? false; + message.sessionAffinityConfig = + object.sessionAffinityConfig !== undefined && object.sessionAffinityConfig !== null + ? SessionAffinityConfig.fromPartial(object.sessionAffinityConfig) + : undefined; + message.ipFamilies = object.ipFamilies?.map((e) => e) || []; + message.ipFamilyPolicy = object.ipFamilyPolicy ?? ''; + message.allocateLoadBalancerNodePorts = object.allocateLoadBalancerNodePorts ?? false; + message.loadBalancerClass = object.loadBalancerClass ?? ''; + message.internalTrafficPolicy = object.internalTrafficPolicy ?? ''; + message.trafficDistribution = object.trafficDistribution ?? ''; + return message; + }, +}; + +function createBaseServiceSpec_SelectorEntry(): ServiceSpec_SelectorEntry { + return { key: '', value: '' }; +} + +export const ServiceSpec_SelectorEntry: MessageFns = { + encode(message: ServiceSpec_SelectorEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceSpec_SelectorEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceSpec_SelectorEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceSpec_SelectorEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: ServiceSpec_SelectorEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): ServiceSpec_SelectorEntry { + return ServiceSpec_SelectorEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ServiceSpec_SelectorEntry { + const message = createBaseServiceSpec_SelectorEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBaseServiceStatus(): ServiceStatus { + return { loadBalancer: undefined, conditions: [] }; +} + +export const ServiceStatus: MessageFns = { + encode(message: ServiceStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.loadBalancer !== undefined) { + LoadBalancerStatus.encode(message.loadBalancer, writer.uint32(10).fork()).join(); + } + for (const v of message.conditions) { + Condition.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.loadBalancer = LoadBalancerStatus.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.conditions.push(Condition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceStatus { + return { + loadBalancer: isSet(object.loadBalancer) + ? LoadBalancerStatus.fromJSON(object.loadBalancer) + : undefined, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => Condition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ServiceStatus): unknown { + const obj: any = {}; + if (message.loadBalancer !== undefined) { + obj.loadBalancer = LoadBalancerStatus.toJSON(message.loadBalancer); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => Condition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ServiceStatus { + return ServiceStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceStatus { + const message = createBaseServiceStatus(); + message.loadBalancer = + object.loadBalancer !== undefined && object.loadBalancer !== null + ? LoadBalancerStatus.fromPartial(object.loadBalancer) + : undefined; + message.conditions = object.conditions?.map((e) => Condition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSessionAffinityConfig(): SessionAffinityConfig { + return { clientIP: undefined }; +} + +export const SessionAffinityConfig: MessageFns = { + encode(message: SessionAffinityConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientIP !== undefined) { + ClientIPConfig.encode(message.clientIP, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SessionAffinityConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSessionAffinityConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.clientIP = ClientIPConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SessionAffinityConfig { + return { clientIP: isSet(object.clientIP) ? ClientIPConfig.fromJSON(object.clientIP) : undefined }; + }, + + toJSON(message: SessionAffinityConfig): unknown { + const obj: any = {}; + if (message.clientIP !== undefined) { + obj.clientIP = ClientIPConfig.toJSON(message.clientIP); + } + return obj; + }, + + create, I>>(base?: I): SessionAffinityConfig { + return SessionAffinityConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SessionAffinityConfig { + const message = createBaseSessionAffinityConfig(); + message.clientIP = + object.clientIP !== undefined && object.clientIP !== null + ? ClientIPConfig.fromPartial(object.clientIP) + : undefined; + return message; + }, +}; + +function createBaseSleepAction(): SleepAction { + return { seconds: 0 }; +} + +export const SleepAction: MessageFns = { + encode(message: SleepAction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== undefined && message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SleepAction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSleepAction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): SleepAction { + return { seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0 }; + }, + + toJSON(message: SleepAction): unknown { + const obj: any = {}; + if (message.seconds !== undefined && message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + return obj; + }, + + create, I>>(base?: I): SleepAction { + return SleepAction.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SleepAction { + const message = createBaseSleepAction(); + message.seconds = object.seconds ?? 0; + return message; + }, +}; + +function createBaseStorageOSPersistentVolumeSource(): StorageOSPersistentVolumeSource { + return { volumeName: '', volumeNamespace: '', fsType: '', readOnly: false, secretRef: undefined }; +} + +export const StorageOSPersistentVolumeSource: MessageFns = { + encode( + message: StorageOSPersistentVolumeSource, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.volumeName !== undefined && message.volumeName !== '') { + writer.uint32(10).string(message.volumeName); + } + if (message.volumeNamespace !== undefined && message.volumeNamespace !== '') { + writer.uint32(18).string(message.volumeNamespace); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(26).string(message.fsType); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + if (message.secretRef !== undefined) { + ObjectReference.encode(message.secretRef, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StorageOSPersistentVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStorageOSPersistentVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.volumeName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.volumeNamespace = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.secretRef = ObjectReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StorageOSPersistentVolumeSource { + return { + volumeName: isSet(object.volumeName) ? globalThis.String(object.volumeName) : '', + volumeNamespace: isSet(object.volumeNamespace) ? globalThis.String(object.volumeNamespace) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + secretRef: isSet(object.secretRef) ? ObjectReference.fromJSON(object.secretRef) : undefined, + }; + }, + + toJSON(message: StorageOSPersistentVolumeSource): unknown { + const obj: any = {}; + if (message.volumeName !== undefined && message.volumeName !== '') { + obj.volumeName = message.volumeName; + } + if (message.volumeNamespace !== undefined && message.volumeNamespace !== '') { + obj.volumeNamespace = message.volumeNamespace; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.secretRef !== undefined) { + obj.secretRef = ObjectReference.toJSON(message.secretRef); + } + return obj; + }, + + create, I>>( + base?: I, + ): StorageOSPersistentVolumeSource { + return StorageOSPersistentVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): StorageOSPersistentVolumeSource { + const message = createBaseStorageOSPersistentVolumeSource(); + message.volumeName = object.volumeName ?? ''; + message.volumeNamespace = object.volumeNamespace ?? ''; + message.fsType = object.fsType ?? ''; + message.readOnly = object.readOnly ?? false; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? ObjectReference.fromPartial(object.secretRef) + : undefined; + return message; + }, +}; + +function createBaseStorageOSVolumeSource(): StorageOSVolumeSource { + return { volumeName: '', volumeNamespace: '', fsType: '', readOnly: false, secretRef: undefined }; +} + +export const StorageOSVolumeSource: MessageFns = { + encode(message: StorageOSVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.volumeName !== undefined && message.volumeName !== '') { + writer.uint32(10).string(message.volumeName); + } + if (message.volumeNamespace !== undefined && message.volumeNamespace !== '') { + writer.uint32(18).string(message.volumeNamespace); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(26).string(message.fsType); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + if (message.secretRef !== undefined) { + LocalObjectReference.encode(message.secretRef, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StorageOSVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStorageOSVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.volumeName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.volumeNamespace = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.secretRef = LocalObjectReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StorageOSVolumeSource { + return { + volumeName: isSet(object.volumeName) ? globalThis.String(object.volumeName) : '', + volumeNamespace: isSet(object.volumeNamespace) ? globalThis.String(object.volumeNamespace) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + secretRef: isSet(object.secretRef) ? LocalObjectReference.fromJSON(object.secretRef) : undefined, + }; + }, + + toJSON(message: StorageOSVolumeSource): unknown { + const obj: any = {}; + if (message.volumeName !== undefined && message.volumeName !== '') { + obj.volumeName = message.volumeName; + } + if (message.volumeNamespace !== undefined && message.volumeNamespace !== '') { + obj.volumeNamespace = message.volumeNamespace; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.secretRef !== undefined) { + obj.secretRef = LocalObjectReference.toJSON(message.secretRef); + } + return obj; + }, + + create, I>>(base?: I): StorageOSVolumeSource { + return StorageOSVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StorageOSVolumeSource { + const message = createBaseStorageOSVolumeSource(); + message.volumeName = object.volumeName ?? ''; + message.volumeNamespace = object.volumeNamespace ?? ''; + message.fsType = object.fsType ?? ''; + message.readOnly = object.readOnly ?? false; + message.secretRef = + object.secretRef !== undefined && object.secretRef !== null + ? LocalObjectReference.fromPartial(object.secretRef) + : undefined; + return message; + }, +}; + +function createBaseSysctl(): Sysctl { + return { name: '', value: '' }; +} + +export const Sysctl: MessageFns = { + encode(message: Sysctl, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.value !== undefined && message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Sysctl { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSysctl(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Sysctl { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: Sysctl): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.value !== undefined && message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): Sysctl { + return Sysctl.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Sysctl { + const message = createBaseSysctl(); + message.name = object.name ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBaseTCPSocketAction(): TCPSocketAction { + return { port: undefined, host: '' }; +} + +export const TCPSocketAction: MessageFns = { + encode(message: TCPSocketAction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.port !== undefined) { + IntOrString.encode(message.port, writer.uint32(10).fork()).join(); + } + if (message.host !== undefined && message.host !== '') { + writer.uint32(18).string(message.host); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TCPSocketAction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTCPSocketAction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.port = IntOrString.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.host = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TCPSocketAction { + return { + port: isSet(object.port) ? IntOrString.fromJSON(object.port) : undefined, + host: isSet(object.host) ? globalThis.String(object.host) : '', + }; + }, + + toJSON(message: TCPSocketAction): unknown { + const obj: any = {}; + if (message.port !== undefined) { + obj.port = IntOrString.toJSON(message.port); + } + if (message.host !== undefined && message.host !== '') { + obj.host = message.host; + } + return obj; + }, + + create, I>>(base?: I): TCPSocketAction { + return TCPSocketAction.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TCPSocketAction { + const message = createBaseTCPSocketAction(); + message.port = + object.port !== undefined && object.port !== null + ? IntOrString.fromPartial(object.port) + : undefined; + message.host = object.host ?? ''; + return message; + }, +}; + +function createBaseTaint(): Taint { + return { key: '', value: '', effect: '', timeAdded: undefined }; +} + +export const Taint: MessageFns = { + encode(message: Taint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined && message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined && message.value !== '') { + writer.uint32(18).string(message.value); + } + if (message.effect !== undefined && message.effect !== '') { + writer.uint32(26).string(message.effect); + } + if (message.timeAdded !== undefined) { + Time.encode(message.timeAdded, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Taint { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTaint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.effect = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.timeAdded = Time.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Taint { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + effect: isSet(object.effect) ? globalThis.String(object.effect) : '', + timeAdded: isSet(object.timeAdded) ? Time.fromJSON(object.timeAdded) : undefined, + }; + }, + + toJSON(message: Taint): unknown { + const obj: any = {}; + if (message.key !== undefined && message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined && message.value !== '') { + obj.value = message.value; + } + if (message.effect !== undefined && message.effect !== '') { + obj.effect = message.effect; + } + if (message.timeAdded !== undefined) { + obj.timeAdded = Time.toJSON(message.timeAdded); + } + return obj; + }, + + create, I>>(base?: I): Taint { + return Taint.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Taint { + const message = createBaseTaint(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + message.effect = object.effect ?? ''; + message.timeAdded = + object.timeAdded !== undefined && object.timeAdded !== null + ? Time.fromPartial(object.timeAdded) + : undefined; + return message; + }, +}; + +function createBaseToleration(): Toleration { + return { key: '', operator: '', value: '', effect: '', tolerationSeconds: 0 }; +} + +export const Toleration: MessageFns = { + encode(message: Toleration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined && message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.operator !== undefined && message.operator !== '') { + writer.uint32(18).string(message.operator); + } + if (message.value !== undefined && message.value !== '') { + writer.uint32(26).string(message.value); + } + if (message.effect !== undefined && message.effect !== '') { + writer.uint32(34).string(message.effect); + } + if (message.tolerationSeconds !== undefined && message.tolerationSeconds !== 0) { + writer.uint32(40).int64(message.tolerationSeconds); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Toleration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseToleration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.operator = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.value = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.effect = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.tolerationSeconds = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Toleration { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + operator: isSet(object.operator) ? globalThis.String(object.operator) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + effect: isSet(object.effect) ? globalThis.String(object.effect) : '', + tolerationSeconds: isSet(object.tolerationSeconds) + ? globalThis.Number(object.tolerationSeconds) + : 0, + }; + }, + + toJSON(message: Toleration): unknown { + const obj: any = {}; + if (message.key !== undefined && message.key !== '') { + obj.key = message.key; + } + if (message.operator !== undefined && message.operator !== '') { + obj.operator = message.operator; + } + if (message.value !== undefined && message.value !== '') { + obj.value = message.value; + } + if (message.effect !== undefined && message.effect !== '') { + obj.effect = message.effect; + } + if (message.tolerationSeconds !== undefined && message.tolerationSeconds !== 0) { + obj.tolerationSeconds = Math.round(message.tolerationSeconds); + } + return obj; + }, + + create, I>>(base?: I): Toleration { + return Toleration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Toleration { + const message = createBaseToleration(); + message.key = object.key ?? ''; + message.operator = object.operator ?? ''; + message.value = object.value ?? ''; + message.effect = object.effect ?? ''; + message.tolerationSeconds = object.tolerationSeconds ?? 0; + return message; + }, +}; + +function createBaseTopologySelectorLabelRequirement(): TopologySelectorLabelRequirement { + return { key: '', values: [] }; +} + +export const TopologySelectorLabelRequirement: MessageFns = { + encode( + message: TopologySelectorLabelRequirement, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== undefined && message.key !== '') { + writer.uint32(10).string(message.key); + } + for (const v of message.values) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopologySelectorLabelRequirement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopologySelectorLabelRequirement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.values.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TopologySelectorLabelRequirement { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + values: globalThis.Array.isArray(object?.values) + ? object.values.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: TopologySelectorLabelRequirement): unknown { + const obj: any = {}; + if (message.key !== undefined && message.key !== '') { + obj.key = message.key; + } + if (message.values?.length) { + obj.values = message.values; + } + return obj; + }, + + create, I>>( + base?: I, + ): TopologySelectorLabelRequirement { + return TopologySelectorLabelRequirement.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): TopologySelectorLabelRequirement { + const message = createBaseTopologySelectorLabelRequirement(); + message.key = object.key ?? ''; + message.values = object.values?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTopologySelectorTerm(): TopologySelectorTerm { + return { matchLabelExpressions: [] }; +} + +export const TopologySelectorTerm: MessageFns = { + encode(message: TopologySelectorTerm, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.matchLabelExpressions) { + TopologySelectorLabelRequirement.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopologySelectorTerm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopologySelectorTerm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.matchLabelExpressions.push( + TopologySelectorLabelRequirement.decode(reader, reader.uint32()), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TopologySelectorTerm { + return { + matchLabelExpressions: globalThis.Array.isArray(object?.matchLabelExpressions) + ? object.matchLabelExpressions.map((e: any) => TopologySelectorLabelRequirement.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TopologySelectorTerm): unknown { + const obj: any = {}; + if (message.matchLabelExpressions?.length) { + obj.matchLabelExpressions = message.matchLabelExpressions.map((e) => + TopologySelectorLabelRequirement.toJSON(e), + ); + } + return obj; + }, + + create, I>>(base?: I): TopologySelectorTerm { + return TopologySelectorTerm.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TopologySelectorTerm { + const message = createBaseTopologySelectorTerm(); + message.matchLabelExpressions = + object.matchLabelExpressions?.map((e) => TopologySelectorLabelRequirement.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseTopologySpreadConstraint(): TopologySpreadConstraint { + return { + maxSkew: 0, + topologyKey: '', + whenUnsatisfiable: '', + labelSelector: undefined, + minDomains: 0, + nodeAffinityPolicy: '', + nodeTaintsPolicy: '', + matchLabelKeys: [], + }; +} + +export const TopologySpreadConstraint: MessageFns = { + encode(message: TopologySpreadConstraint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxSkew !== undefined && message.maxSkew !== 0) { + writer.uint32(8).int32(message.maxSkew); + } + if (message.topologyKey !== undefined && message.topologyKey !== '') { + writer.uint32(18).string(message.topologyKey); + } + if (message.whenUnsatisfiable !== undefined && message.whenUnsatisfiable !== '') { + writer.uint32(26).string(message.whenUnsatisfiable); + } + if (message.labelSelector !== undefined) { + LabelSelector.encode(message.labelSelector, writer.uint32(34).fork()).join(); + } + if (message.minDomains !== undefined && message.minDomains !== 0) { + writer.uint32(40).int32(message.minDomains); + } + if (message.nodeAffinityPolicy !== undefined && message.nodeAffinityPolicy !== '') { + writer.uint32(50).string(message.nodeAffinityPolicy); + } + if (message.nodeTaintsPolicy !== undefined && message.nodeTaintsPolicy !== '') { + writer.uint32(58).string(message.nodeTaintsPolicy); + } + for (const v of message.matchLabelKeys) { + writer.uint32(66).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopologySpreadConstraint { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopologySpreadConstraint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.maxSkew = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.topologyKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.whenUnsatisfiable = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.labelSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.minDomains = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.nodeAffinityPolicy = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.nodeTaintsPolicy = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.matchLabelKeys.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TopologySpreadConstraint { + return { + maxSkew: isSet(object.maxSkew) ? globalThis.Number(object.maxSkew) : 0, + topologyKey: isSet(object.topologyKey) ? globalThis.String(object.topologyKey) : '', + whenUnsatisfiable: isSet(object.whenUnsatisfiable) + ? globalThis.String(object.whenUnsatisfiable) + : '', + labelSelector: isSet(object.labelSelector) + ? LabelSelector.fromJSON(object.labelSelector) + : undefined, + minDomains: isSet(object.minDomains) ? globalThis.Number(object.minDomains) : 0, + nodeAffinityPolicy: isSet(object.nodeAffinityPolicy) + ? globalThis.String(object.nodeAffinityPolicy) + : '', + nodeTaintsPolicy: isSet(object.nodeTaintsPolicy) + ? globalThis.String(object.nodeTaintsPolicy) + : '', + matchLabelKeys: globalThis.Array.isArray(object?.matchLabelKeys) + ? object.matchLabelKeys.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: TopologySpreadConstraint): unknown { + const obj: any = {}; + if (message.maxSkew !== undefined && message.maxSkew !== 0) { + obj.maxSkew = Math.round(message.maxSkew); + } + if (message.topologyKey !== undefined && message.topologyKey !== '') { + obj.topologyKey = message.topologyKey; + } + if (message.whenUnsatisfiable !== undefined && message.whenUnsatisfiable !== '') { + obj.whenUnsatisfiable = message.whenUnsatisfiable; + } + if (message.labelSelector !== undefined) { + obj.labelSelector = LabelSelector.toJSON(message.labelSelector); + } + if (message.minDomains !== undefined && message.minDomains !== 0) { + obj.minDomains = Math.round(message.minDomains); + } + if (message.nodeAffinityPolicy !== undefined && message.nodeAffinityPolicy !== '') { + obj.nodeAffinityPolicy = message.nodeAffinityPolicy; + } + if (message.nodeTaintsPolicy !== undefined && message.nodeTaintsPolicy !== '') { + obj.nodeTaintsPolicy = message.nodeTaintsPolicy; + } + if (message.matchLabelKeys?.length) { + obj.matchLabelKeys = message.matchLabelKeys; + } + return obj; + }, + + create, I>>(base?: I): TopologySpreadConstraint { + return TopologySpreadConstraint.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): TopologySpreadConstraint { + const message = createBaseTopologySpreadConstraint(); + message.maxSkew = object.maxSkew ?? 0; + message.topologyKey = object.topologyKey ?? ''; + message.whenUnsatisfiable = object.whenUnsatisfiable ?? ''; + message.labelSelector = + object.labelSelector !== undefined && object.labelSelector !== null + ? LabelSelector.fromPartial(object.labelSelector) + : undefined; + message.minDomains = object.minDomains ?? 0; + message.nodeAffinityPolicy = object.nodeAffinityPolicy ?? ''; + message.nodeTaintsPolicy = object.nodeTaintsPolicy ?? ''; + message.matchLabelKeys = object.matchLabelKeys?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTypedLocalObjectReference(): TypedLocalObjectReference { + return { apiGroup: '', kind: '', name: '' }; +} + +export const TypedLocalObjectReference: MessageFns = { + encode(message: TypedLocalObjectReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.apiGroup !== undefined && message.apiGroup !== '') { + writer.uint32(10).string(message.apiGroup); + } + if (message.kind !== undefined && message.kind !== '') { + writer.uint32(18).string(message.kind); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(26).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TypedLocalObjectReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTypedLocalObjectReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.apiGroup = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.kind = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TypedLocalObjectReference { + return { + apiGroup: isSet(object.apiGroup) ? globalThis.String(object.apiGroup) : '', + kind: isSet(object.kind) ? globalThis.String(object.kind) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + }; + }, + + toJSON(message: TypedLocalObjectReference): unknown { + const obj: any = {}; + if (message.apiGroup !== undefined && message.apiGroup !== '') { + obj.apiGroup = message.apiGroup; + } + if (message.kind !== undefined && message.kind !== '') { + obj.kind = message.kind; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): TypedLocalObjectReference { + return TypedLocalObjectReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): TypedLocalObjectReference { + const message = createBaseTypedLocalObjectReference(); + message.apiGroup = object.apiGroup ?? ''; + message.kind = object.kind ?? ''; + message.name = object.name ?? ''; + return message; + }, +}; + +function createBaseTypedObjectReference(): TypedObjectReference { + return { apiGroup: '', kind: '', name: '', namespace: '' }; +} + +export const TypedObjectReference: MessageFns = { + encode(message: TypedObjectReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.apiGroup !== undefined && message.apiGroup !== '') { + writer.uint32(10).string(message.apiGroup); + } + if (message.kind !== undefined && message.kind !== '') { + writer.uint32(18).string(message.kind); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(26).string(message.name); + } + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(34).string(message.namespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TypedObjectReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTypedObjectReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.apiGroup = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.kind = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.namespace = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TypedObjectReference { + return { + apiGroup: isSet(object.apiGroup) ? globalThis.String(object.apiGroup) : '', + kind: isSet(object.kind) ? globalThis.String(object.kind) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + }; + }, + + toJSON(message: TypedObjectReference): unknown { + const obj: any = {}; + if (message.apiGroup !== undefined && message.apiGroup !== '') { + obj.apiGroup = message.apiGroup; + } + if (message.kind !== undefined && message.kind !== '') { + obj.kind = message.kind; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + return obj; + }, + + create, I>>(base?: I): TypedObjectReference { + return TypedObjectReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TypedObjectReference { + const message = createBaseTypedObjectReference(); + message.apiGroup = object.apiGroup ?? ''; + message.kind = object.kind ?? ''; + message.name = object.name ?? ''; + message.namespace = object.namespace ?? ''; + return message; + }, +}; + +function createBaseVolume(): Volume { + return { name: '', volumeSource: undefined }; +} + +export const Volume: MessageFns = { + encode(message: Volume, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.volumeSource !== undefined) { + VolumeSource.encode(message.volumeSource, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Volume { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolume(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.volumeSource = VolumeSource.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Volume { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + volumeSource: isSet(object.volumeSource) ? VolumeSource.fromJSON(object.volumeSource) : undefined, + }; + }, + + toJSON(message: Volume): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.volumeSource !== undefined) { + obj.volumeSource = VolumeSource.toJSON(message.volumeSource); + } + return obj; + }, + + create, I>>(base?: I): Volume { + return Volume.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Volume { + const message = createBaseVolume(); + message.name = object.name ?? ''; + message.volumeSource = + object.volumeSource !== undefined && object.volumeSource !== null + ? VolumeSource.fromPartial(object.volumeSource) + : undefined; + return message; + }, +}; + +function createBaseVolumeDevice(): VolumeDevice { + return { name: '', devicePath: '' }; +} + +export const VolumeDevice: MessageFns = { + encode(message: VolumeDevice, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.devicePath !== undefined && message.devicePath !== '') { + writer.uint32(18).string(message.devicePath); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VolumeDevice { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolumeDevice(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.devicePath = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VolumeDevice { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + devicePath: isSet(object.devicePath) ? globalThis.String(object.devicePath) : '', + }; + }, + + toJSON(message: VolumeDevice): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.devicePath !== undefined && message.devicePath !== '') { + obj.devicePath = message.devicePath; + } + return obj; + }, + + create, I>>(base?: I): VolumeDevice { + return VolumeDevice.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VolumeDevice { + const message = createBaseVolumeDevice(); + message.name = object.name ?? ''; + message.devicePath = object.devicePath ?? ''; + return message; + }, +}; + +function createBaseVolumeHealthCondition(): VolumeHealthCondition { + return { status: '', reason: '', message: '' }; +} + +export const VolumeHealthCondition: MessageFns = { + encode(message: VolumeHealthCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== undefined && message.status !== '') { + writer.uint32(10).string(message.status); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(18).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VolumeHealthCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolumeHealthCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.status = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.reason = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VolumeHealthCondition { + return { + status: isSet(object.status) ? globalThis.String(object.status) : '', + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: VolumeHealthCondition): unknown { + const obj: any = {}; + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): VolumeHealthCondition { + return VolumeHealthCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VolumeHealthCondition { + const message = createBaseVolumeHealthCondition(); + message.status = object.status ?? ''; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseVolumeHealthStatus(): VolumeHealthStatus { + return { healthConditions: [], lastTransitionTime: undefined }; +} + +export const VolumeHealthStatus: MessageFns = { + encode(message: VolumeHealthStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.healthConditions) { + VolumeHealthCondition.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VolumeHealthStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolumeHealthStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.healthConditions.push(VolumeHealthCondition.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VolumeHealthStatus { + return { + healthConditions: globalThis.Array.isArray(object?.healthConditions) + ? object.healthConditions.map((e: any) => VolumeHealthCondition.fromJSON(e)) + : [], + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + }; + }, + + toJSON(message: VolumeHealthStatus): unknown { + const obj: any = {}; + if (message.healthConditions?.length) { + obj.healthConditions = message.healthConditions.map((e) => VolumeHealthCondition.toJSON(e)); + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + return obj; + }, + + create, I>>(base?: I): VolumeHealthStatus { + return VolumeHealthStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VolumeHealthStatus { + const message = createBaseVolumeHealthStatus(); + message.healthConditions = + object.healthConditions?.map((e) => VolumeHealthCondition.fromPartial(e)) || []; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + return message; + }, +}; + +function createBaseVolumeMount(): VolumeMount { + return { + name: '', + readOnly: false, + recursiveReadOnly: '', + mountPath: '', + subPath: '', + mountPropagation: '', + subPathExpr: '', + bindMountOptions: [], + }; +} + +export const VolumeMount: MessageFns = { + encode(message: VolumeMount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(16).bool(message.readOnly); + } + if (message.recursiveReadOnly !== undefined && message.recursiveReadOnly !== '') { + writer.uint32(58).string(message.recursiveReadOnly); + } + if (message.mountPath !== undefined && message.mountPath !== '') { + writer.uint32(26).string(message.mountPath); + } + if (message.subPath !== undefined && message.subPath !== '') { + writer.uint32(34).string(message.subPath); + } + if (message.mountPropagation !== undefined && message.mountPropagation !== '') { + writer.uint32(42).string(message.mountPropagation); + } + if (message.subPathExpr !== undefined && message.subPathExpr !== '') { + writer.uint32(50).string(message.subPathExpr); + } + for (const v of message.bindMountOptions) { + writer.uint32(66).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VolumeMount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolumeMount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.recursiveReadOnly = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.mountPath = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.subPath = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.mountPropagation = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.subPathExpr = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.bindMountOptions.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VolumeMount { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + recursiveReadOnly: isSet(object.recursiveReadOnly) + ? globalThis.String(object.recursiveReadOnly) + : '', + mountPath: isSet(object.mountPath) ? globalThis.String(object.mountPath) : '', + subPath: isSet(object.subPath) ? globalThis.String(object.subPath) : '', + mountPropagation: isSet(object.mountPropagation) + ? globalThis.String(object.mountPropagation) + : '', + subPathExpr: isSet(object.subPathExpr) ? globalThis.String(object.subPathExpr) : '', + bindMountOptions: globalThis.Array.isArray(object?.bindMountOptions) + ? object.bindMountOptions.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: VolumeMount): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.recursiveReadOnly !== undefined && message.recursiveReadOnly !== '') { + obj.recursiveReadOnly = message.recursiveReadOnly; + } + if (message.mountPath !== undefined && message.mountPath !== '') { + obj.mountPath = message.mountPath; + } + if (message.subPath !== undefined && message.subPath !== '') { + obj.subPath = message.subPath; + } + if (message.mountPropagation !== undefined && message.mountPropagation !== '') { + obj.mountPropagation = message.mountPropagation; + } + if (message.subPathExpr !== undefined && message.subPathExpr !== '') { + obj.subPathExpr = message.subPathExpr; + } + if (message.bindMountOptions?.length) { + obj.bindMountOptions = message.bindMountOptions; + } + return obj; + }, + + create, I>>(base?: I): VolumeMount { + return VolumeMount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VolumeMount { + const message = createBaseVolumeMount(); + message.name = object.name ?? ''; + message.readOnly = object.readOnly ?? false; + message.recursiveReadOnly = object.recursiveReadOnly ?? ''; + message.mountPath = object.mountPath ?? ''; + message.subPath = object.subPath ?? ''; + message.mountPropagation = object.mountPropagation ?? ''; + message.subPathExpr = object.subPathExpr ?? ''; + message.bindMountOptions = object.bindMountOptions?.map((e) => e) || []; + return message; + }, +}; + +function createBaseVolumeMountStatus(): VolumeMountStatus { + return { name: '', mountPath: '', readOnly: false, recursiveReadOnly: '', volumeStatus: undefined }; +} + +export const VolumeMountStatus: MessageFns = { + encode(message: VolumeMountStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.mountPath !== undefined && message.mountPath !== '') { + writer.uint32(18).string(message.mountPath); + } + if (message.readOnly !== undefined && message.readOnly !== false) { + writer.uint32(24).bool(message.readOnly); + } + if (message.recursiveReadOnly !== undefined && message.recursiveReadOnly !== '') { + writer.uint32(34).string(message.recursiveReadOnly); + } + if (message.volumeStatus !== undefined) { + VolumeStatus.encode(message.volumeStatus, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VolumeMountStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolumeMountStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.mountPath = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.readOnly = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.recursiveReadOnly = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.volumeStatus = VolumeStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VolumeMountStatus { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + mountPath: isSet(object.mountPath) ? globalThis.String(object.mountPath) : '', + readOnly: isSet(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + recursiveReadOnly: isSet(object.recursiveReadOnly) + ? globalThis.String(object.recursiveReadOnly) + : '', + volumeStatus: isSet(object.volumeStatus) ? VolumeStatus.fromJSON(object.volumeStatus) : undefined, + }; + }, + + toJSON(message: VolumeMountStatus): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.mountPath !== undefined && message.mountPath !== '') { + obj.mountPath = message.mountPath; + } + if (message.readOnly !== undefined && message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.recursiveReadOnly !== undefined && message.recursiveReadOnly !== '') { + obj.recursiveReadOnly = message.recursiveReadOnly; + } + if (message.volumeStatus !== undefined) { + obj.volumeStatus = VolumeStatus.toJSON(message.volumeStatus); + } + return obj; + }, + + create, I>>(base?: I): VolumeMountStatus { + return VolumeMountStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VolumeMountStatus { + const message = createBaseVolumeMountStatus(); + message.name = object.name ?? ''; + message.mountPath = object.mountPath ?? ''; + message.readOnly = object.readOnly ?? false; + message.recursiveReadOnly = object.recursiveReadOnly ?? ''; + message.volumeStatus = + object.volumeStatus !== undefined && object.volumeStatus !== null + ? VolumeStatus.fromPartial(object.volumeStatus) + : undefined; + return message; + }, +}; + +function createBaseVolumeNodeAffinity(): VolumeNodeAffinity { + return { required: undefined }; +} + +export const VolumeNodeAffinity: MessageFns = { + encode(message: VolumeNodeAffinity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.required !== undefined) { + NodeSelector.encode(message.required, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VolumeNodeAffinity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolumeNodeAffinity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.required = NodeSelector.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VolumeNodeAffinity { + return { required: isSet(object.required) ? NodeSelector.fromJSON(object.required) : undefined }; + }, + + toJSON(message: VolumeNodeAffinity): unknown { + const obj: any = {}; + if (message.required !== undefined) { + obj.required = NodeSelector.toJSON(message.required); + } + return obj; + }, + + create, I>>(base?: I): VolumeNodeAffinity { + return VolumeNodeAffinity.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VolumeNodeAffinity { + const message = createBaseVolumeNodeAffinity(); + message.required = + object.required !== undefined && object.required !== null + ? NodeSelector.fromPartial(object.required) + : undefined; + return message; + }, +}; + +function createBaseVolumeProjection(): VolumeProjection { + return { + secret: undefined, + downwardAPI: undefined, + configMap: undefined, + serviceAccountToken: undefined, + clusterTrustBundle: undefined, + podCertificate: undefined, + }; +} + +export const VolumeProjection: MessageFns = { + encode(message: VolumeProjection, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.secret !== undefined) { + SecretProjection.encode(message.secret, writer.uint32(10).fork()).join(); + } + if (message.downwardAPI !== undefined) { + DownwardAPIProjection.encode(message.downwardAPI, writer.uint32(18).fork()).join(); + } + if (message.configMap !== undefined) { + ConfigMapProjection.encode(message.configMap, writer.uint32(26).fork()).join(); + } + if (message.serviceAccountToken !== undefined) { + ServiceAccountTokenProjection.encode( + message.serviceAccountToken, + writer.uint32(34).fork(), + ).join(); + } + if (message.clusterTrustBundle !== undefined) { + ClusterTrustBundleProjection.encode(message.clusterTrustBundle, writer.uint32(42).fork()).join(); + } + if (message.podCertificate !== undefined) { + PodCertificateProjection.encode(message.podCertificate, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VolumeProjection { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolumeProjection(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.secret = SecretProjection.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.downwardAPI = DownwardAPIProjection.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.configMap = ConfigMapProjection.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.serviceAccountToken = ServiceAccountTokenProjection.decode( + reader, + reader.uint32(), + ); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.clusterTrustBundle = ClusterTrustBundleProjection.decode( + reader, + reader.uint32(), + ); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.podCertificate = PodCertificateProjection.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VolumeProjection { + return { + secret: isSet(object.secret) ? SecretProjection.fromJSON(object.secret) : undefined, + downwardAPI: isSet(object.downwardAPI) + ? DownwardAPIProjection.fromJSON(object.downwardAPI) + : undefined, + configMap: isSet(object.configMap) ? ConfigMapProjection.fromJSON(object.configMap) : undefined, + serviceAccountToken: isSet(object.serviceAccountToken) + ? ServiceAccountTokenProjection.fromJSON(object.serviceAccountToken) + : undefined, + clusterTrustBundle: isSet(object.clusterTrustBundle) + ? ClusterTrustBundleProjection.fromJSON(object.clusterTrustBundle) + : undefined, + podCertificate: isSet(object.podCertificate) + ? PodCertificateProjection.fromJSON(object.podCertificate) + : undefined, + }; + }, + + toJSON(message: VolumeProjection): unknown { + const obj: any = {}; + if (message.secret !== undefined) { + obj.secret = SecretProjection.toJSON(message.secret); + } + if (message.downwardAPI !== undefined) { + obj.downwardAPI = DownwardAPIProjection.toJSON(message.downwardAPI); + } + if (message.configMap !== undefined) { + obj.configMap = ConfigMapProjection.toJSON(message.configMap); + } + if (message.serviceAccountToken !== undefined) { + obj.serviceAccountToken = ServiceAccountTokenProjection.toJSON(message.serviceAccountToken); + } + if (message.clusterTrustBundle !== undefined) { + obj.clusterTrustBundle = ClusterTrustBundleProjection.toJSON(message.clusterTrustBundle); + } + if (message.podCertificate !== undefined) { + obj.podCertificate = PodCertificateProjection.toJSON(message.podCertificate); + } + return obj; + }, + + create, I>>(base?: I): VolumeProjection { + return VolumeProjection.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VolumeProjection { + const message = createBaseVolumeProjection(); + message.secret = + object.secret !== undefined && object.secret !== null + ? SecretProjection.fromPartial(object.secret) + : undefined; + message.downwardAPI = + object.downwardAPI !== undefined && object.downwardAPI !== null + ? DownwardAPIProjection.fromPartial(object.downwardAPI) + : undefined; + message.configMap = + object.configMap !== undefined && object.configMap !== null + ? ConfigMapProjection.fromPartial(object.configMap) + : undefined; + message.serviceAccountToken = + object.serviceAccountToken !== undefined && object.serviceAccountToken !== null + ? ServiceAccountTokenProjection.fromPartial(object.serviceAccountToken) + : undefined; + message.clusterTrustBundle = + object.clusterTrustBundle !== undefined && object.clusterTrustBundle !== null + ? ClusterTrustBundleProjection.fromPartial(object.clusterTrustBundle) + : undefined; + message.podCertificate = + object.podCertificate !== undefined && object.podCertificate !== null + ? PodCertificateProjection.fromPartial(object.podCertificate) + : undefined; + return message; + }, +}; + +function createBaseVolumeResourceRequirements(): VolumeResourceRequirements { + return { limits: {}, requests: {} }; +} + +export const VolumeResourceRequirements: MessageFns = { + encode(message: VolumeResourceRequirements, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + globalThis.Object.entries(message.limits).forEach(([key, value]: [string, Quantity]) => { + VolumeResourceRequirements_LimitsEntry.encode( + { key: key as any, value }, + writer.uint32(10).fork(), + ).join(); + }); + globalThis.Object.entries(message.requests).forEach(([key, value]: [string, Quantity]) => { + VolumeResourceRequirements_RequestsEntry.encode( + { key: key as any, value }, + writer.uint32(18).fork(), + ).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VolumeResourceRequirements { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolumeResourceRequirements(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + const entry1 = VolumeResourceRequirements_LimitsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.limits[entry1.key] = entry1.value; + } + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = VolumeResourceRequirements_RequestsEntry.decode( + reader, + reader.uint32(), + ); + if (entry2.value !== undefined) { + message.requests[entry2.key] = entry2.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VolumeResourceRequirements { + return { + limits: isObject(object.limits) + ? (globalThis.Object.entries(object.limits) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + requests: isObject(object.requests) + ? (globalThis.Object.entries(object.requests) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: VolumeResourceRequirements): unknown { + const obj: any = {}; + if (message.limits) { + const entries = globalThis.Object.entries(message.limits) as [string, Quantity][]; + if (entries.length > 0) { + obj.limits = {}; + entries.forEach(([k, v]) => { + obj.limits[k] = Quantity.toJSON(v); + }); + } + } + if (message.requests) { + const entries = globalThis.Object.entries(message.requests) as [string, Quantity][]; + if (entries.length > 0) { + obj.requests = {}; + entries.forEach(([k, v]) => { + obj.requests[k] = Quantity.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>( + base?: I, + ): VolumeResourceRequirements { + return VolumeResourceRequirements.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): VolumeResourceRequirements { + const message = createBaseVolumeResourceRequirements(); + message.limits = (globalThis.Object.entries(object.limits ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + message.requests = (globalThis.Object.entries(object.requests ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseVolumeResourceRequirements_LimitsEntry(): VolumeResourceRequirements_LimitsEntry { + return { key: '', value: undefined }; +} + +export const VolumeResourceRequirements_LimitsEntry: MessageFns = { + encode( + message: VolumeResourceRequirements_LimitsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VolumeResourceRequirements_LimitsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolumeResourceRequirements_LimitsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VolumeResourceRequirements_LimitsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: VolumeResourceRequirements_LimitsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): VolumeResourceRequirements_LimitsEntry { + return VolumeResourceRequirements_LimitsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): VolumeResourceRequirements_LimitsEntry { + const message = createBaseVolumeResourceRequirements_LimitsEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseVolumeResourceRequirements_RequestsEntry(): VolumeResourceRequirements_RequestsEntry { + return { key: '', value: undefined }; +} + +export const VolumeResourceRequirements_RequestsEntry: MessageFns = + { + encode( + message: VolumeResourceRequirements_RequestsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VolumeResourceRequirements_RequestsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolumeResourceRequirements_RequestsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VolumeResourceRequirements_RequestsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: VolumeResourceRequirements_RequestsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): VolumeResourceRequirements_RequestsEntry { + return VolumeResourceRequirements_RequestsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): VolumeResourceRequirements_RequestsEntry { + const message = createBaseVolumeResourceRequirements_RequestsEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, + }; + +function createBaseVolumeSource(): VolumeSource { + return { + hostPath: undefined, + emptyDir: undefined, + gcePersistentDisk: undefined, + awsElasticBlockStore: undefined, + gitRepo: undefined, + secret: undefined, + nfs: undefined, + iscsi: undefined, + glusterfs: undefined, + persistentVolumeClaim: undefined, + rbd: undefined, + flexVolume: undefined, + cinder: undefined, + cephfs: undefined, + flocker: undefined, + downwardAPI: undefined, + fc: undefined, + azureFile: undefined, + configMap: undefined, + vsphereVolume: undefined, + quobyte: undefined, + azureDisk: undefined, + photonPersistentDisk: undefined, + projected: undefined, + portworxVolume: undefined, + scaleIO: undefined, + storageos: undefined, + csi: undefined, + ephemeral: undefined, + image: undefined, + }; +} + +export const VolumeSource: MessageFns = { + encode(message: VolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hostPath !== undefined) { + HostPathVolumeSource.encode(message.hostPath, writer.uint32(10).fork()).join(); + } + if (message.emptyDir !== undefined) { + EmptyDirVolumeSource.encode(message.emptyDir, writer.uint32(18).fork()).join(); + } + if (message.gcePersistentDisk !== undefined) { + GCEPersistentDiskVolumeSource.encode(message.gcePersistentDisk, writer.uint32(26).fork()).join(); + } + if (message.awsElasticBlockStore !== undefined) { + AWSElasticBlockStoreVolumeSource.encode( + message.awsElasticBlockStore, + writer.uint32(34).fork(), + ).join(); + } + if (message.gitRepo !== undefined) { + GitRepoVolumeSource.encode(message.gitRepo, writer.uint32(42).fork()).join(); + } + if (message.secret !== undefined) { + SecretVolumeSource.encode(message.secret, writer.uint32(50).fork()).join(); + } + if (message.nfs !== undefined) { + NFSVolumeSource.encode(message.nfs, writer.uint32(58).fork()).join(); + } + if (message.iscsi !== undefined) { + ISCSIVolumeSource.encode(message.iscsi, writer.uint32(66).fork()).join(); + } + if (message.glusterfs !== undefined) { + GlusterfsVolumeSource.encode(message.glusterfs, writer.uint32(74).fork()).join(); + } + if (message.persistentVolumeClaim !== undefined) { + PersistentVolumeClaimVolumeSource.encode( + message.persistentVolumeClaim, + writer.uint32(82).fork(), + ).join(); + } + if (message.rbd !== undefined) { + RBDVolumeSource.encode(message.rbd, writer.uint32(90).fork()).join(); + } + if (message.flexVolume !== undefined) { + FlexVolumeSource.encode(message.flexVolume, writer.uint32(98).fork()).join(); + } + if (message.cinder !== undefined) { + CinderVolumeSource.encode(message.cinder, writer.uint32(106).fork()).join(); + } + if (message.cephfs !== undefined) { + CephFSVolumeSource.encode(message.cephfs, writer.uint32(114).fork()).join(); + } + if (message.flocker !== undefined) { + FlockerVolumeSource.encode(message.flocker, writer.uint32(122).fork()).join(); + } + if (message.downwardAPI !== undefined) { + DownwardAPIVolumeSource.encode(message.downwardAPI, writer.uint32(130).fork()).join(); + } + if (message.fc !== undefined) { + FCVolumeSource.encode(message.fc, writer.uint32(138).fork()).join(); + } + if (message.azureFile !== undefined) { + AzureFileVolumeSource.encode(message.azureFile, writer.uint32(146).fork()).join(); + } + if (message.configMap !== undefined) { + ConfigMapVolumeSource.encode(message.configMap, writer.uint32(154).fork()).join(); + } + if (message.vsphereVolume !== undefined) { + VsphereVirtualDiskVolumeSource.encode(message.vsphereVolume, writer.uint32(162).fork()).join(); + } + if (message.quobyte !== undefined) { + QuobyteVolumeSource.encode(message.quobyte, writer.uint32(170).fork()).join(); + } + if (message.azureDisk !== undefined) { + AzureDiskVolumeSource.encode(message.azureDisk, writer.uint32(178).fork()).join(); + } + if (message.photonPersistentDisk !== undefined) { + PhotonPersistentDiskVolumeSource.encode( + message.photonPersistentDisk, + writer.uint32(186).fork(), + ).join(); + } + if (message.projected !== undefined) { + ProjectedVolumeSource.encode(message.projected, writer.uint32(210).fork()).join(); + } + if (message.portworxVolume !== undefined) { + PortworxVolumeSource.encode(message.portworxVolume, writer.uint32(194).fork()).join(); + } + if (message.scaleIO !== undefined) { + ScaleIOVolumeSource.encode(message.scaleIO, writer.uint32(202).fork()).join(); + } + if (message.storageos !== undefined) { + StorageOSVolumeSource.encode(message.storageos, writer.uint32(218).fork()).join(); + } + if (message.csi !== undefined) { + CSIVolumeSource.encode(message.csi, writer.uint32(226).fork()).join(); + } + if (message.ephemeral !== undefined) { + EphemeralVolumeSource.encode(message.ephemeral, writer.uint32(234).fork()).join(); + } + if (message.image !== undefined) { + ImageVolumeSource.encode(message.image, writer.uint32(242).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.hostPath = HostPathVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.emptyDir = EmptyDirVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.gcePersistentDisk = GCEPersistentDiskVolumeSource.decode( + reader, + reader.uint32(), + ); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.awsElasticBlockStore = AWSElasticBlockStoreVolumeSource.decode( + reader, + reader.uint32(), + ); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.gitRepo = GitRepoVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.secret = SecretVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.nfs = NFSVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.iscsi = ISCSIVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.glusterfs = GlusterfsVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.persistentVolumeClaim = PersistentVolumeClaimVolumeSource.decode( + reader, + reader.uint32(), + ); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.rbd = RBDVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.flexVolume = FlexVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.cinder = CinderVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.cephfs = CephFSVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.flocker = FlockerVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + + message.downwardAPI = DownwardAPIVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + + message.fc = FCVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + + message.azureFile = AzureFileVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + + message.configMap = ConfigMapVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + + message.vsphereVolume = VsphereVirtualDiskVolumeSource.decode( + reader, + reader.uint32(), + ); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + + message.quobyte = QuobyteVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + + message.azureDisk = AzureDiskVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + + message.photonPersistentDisk = PhotonPersistentDiskVolumeSource.decode( + reader, + reader.uint32(), + ); + continue; + } + case 26: { + if (tag !== 210) { + break; + } + + message.projected = ProjectedVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 24: { + if (tag !== 194) { + break; + } + + message.portworxVolume = PortworxVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 25: { + if (tag !== 202) { + break; + } + + message.scaleIO = ScaleIOVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 27: { + if (tag !== 218) { + break; + } + + message.storageos = StorageOSVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 28: { + if (tag !== 226) { + break; + } + + message.csi = CSIVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 29: { + if (tag !== 234) { + break; + } + + message.ephemeral = EphemeralVolumeSource.decode(reader, reader.uint32()); + continue; + } + case 30: { + if (tag !== 242) { + break; + } + + message.image = ImageVolumeSource.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VolumeSource { + return { + hostPath: isSet(object.hostPath) ? HostPathVolumeSource.fromJSON(object.hostPath) : undefined, + emptyDir: isSet(object.emptyDir) ? EmptyDirVolumeSource.fromJSON(object.emptyDir) : undefined, + gcePersistentDisk: isSet(object.gcePersistentDisk) + ? GCEPersistentDiskVolumeSource.fromJSON(object.gcePersistentDisk) + : undefined, + awsElasticBlockStore: isSet(object.awsElasticBlockStore) + ? AWSElasticBlockStoreVolumeSource.fromJSON(object.awsElasticBlockStore) + : undefined, + gitRepo: isSet(object.gitRepo) ? GitRepoVolumeSource.fromJSON(object.gitRepo) : undefined, + secret: isSet(object.secret) ? SecretVolumeSource.fromJSON(object.secret) : undefined, + nfs: isSet(object.nfs) ? NFSVolumeSource.fromJSON(object.nfs) : undefined, + iscsi: isSet(object.iscsi) ? ISCSIVolumeSource.fromJSON(object.iscsi) : undefined, + glusterfs: isSet(object.glusterfs) ? GlusterfsVolumeSource.fromJSON(object.glusterfs) : undefined, + persistentVolumeClaim: isSet(object.persistentVolumeClaim) + ? PersistentVolumeClaimVolumeSource.fromJSON(object.persistentVolumeClaim) + : undefined, + rbd: isSet(object.rbd) ? RBDVolumeSource.fromJSON(object.rbd) : undefined, + flexVolume: isSet(object.flexVolume) ? FlexVolumeSource.fromJSON(object.flexVolume) : undefined, + cinder: isSet(object.cinder) ? CinderVolumeSource.fromJSON(object.cinder) : undefined, + cephfs: isSet(object.cephfs) ? CephFSVolumeSource.fromJSON(object.cephfs) : undefined, + flocker: isSet(object.flocker) ? FlockerVolumeSource.fromJSON(object.flocker) : undefined, + downwardAPI: isSet(object.downwardAPI) + ? DownwardAPIVolumeSource.fromJSON(object.downwardAPI) + : undefined, + fc: isSet(object.fc) ? FCVolumeSource.fromJSON(object.fc) : undefined, + azureFile: isSet(object.azureFile) ? AzureFileVolumeSource.fromJSON(object.azureFile) : undefined, + configMap: isSet(object.configMap) ? ConfigMapVolumeSource.fromJSON(object.configMap) : undefined, + vsphereVolume: isSet(object.vsphereVolume) + ? VsphereVirtualDiskVolumeSource.fromJSON(object.vsphereVolume) + : undefined, + quobyte: isSet(object.quobyte) ? QuobyteVolumeSource.fromJSON(object.quobyte) : undefined, + azureDisk: isSet(object.azureDisk) ? AzureDiskVolumeSource.fromJSON(object.azureDisk) : undefined, + photonPersistentDisk: isSet(object.photonPersistentDisk) + ? PhotonPersistentDiskVolumeSource.fromJSON(object.photonPersistentDisk) + : undefined, + projected: isSet(object.projected) ? ProjectedVolumeSource.fromJSON(object.projected) : undefined, + portworxVolume: isSet(object.portworxVolume) + ? PortworxVolumeSource.fromJSON(object.portworxVolume) + : undefined, + scaleIO: isSet(object.scaleIO) ? ScaleIOVolumeSource.fromJSON(object.scaleIO) : undefined, + storageos: isSet(object.storageos) ? StorageOSVolumeSource.fromJSON(object.storageos) : undefined, + csi: isSet(object.csi) ? CSIVolumeSource.fromJSON(object.csi) : undefined, + ephemeral: isSet(object.ephemeral) ? EphemeralVolumeSource.fromJSON(object.ephemeral) : undefined, + image: isSet(object.image) ? ImageVolumeSource.fromJSON(object.image) : undefined, + }; + }, + + toJSON(message: VolumeSource): unknown { + const obj: any = {}; + if (message.hostPath !== undefined) { + obj.hostPath = HostPathVolumeSource.toJSON(message.hostPath); + } + if (message.emptyDir !== undefined) { + obj.emptyDir = EmptyDirVolumeSource.toJSON(message.emptyDir); + } + if (message.gcePersistentDisk !== undefined) { + obj.gcePersistentDisk = GCEPersistentDiskVolumeSource.toJSON(message.gcePersistentDisk); + } + if (message.awsElasticBlockStore !== undefined) { + obj.awsElasticBlockStore = AWSElasticBlockStoreVolumeSource.toJSON(message.awsElasticBlockStore); + } + if (message.gitRepo !== undefined) { + obj.gitRepo = GitRepoVolumeSource.toJSON(message.gitRepo); + } + if (message.secret !== undefined) { + obj.secret = SecretVolumeSource.toJSON(message.secret); + } + if (message.nfs !== undefined) { + obj.nfs = NFSVolumeSource.toJSON(message.nfs); + } + if (message.iscsi !== undefined) { + obj.iscsi = ISCSIVolumeSource.toJSON(message.iscsi); + } + if (message.glusterfs !== undefined) { + obj.glusterfs = GlusterfsVolumeSource.toJSON(message.glusterfs); + } + if (message.persistentVolumeClaim !== undefined) { + obj.persistentVolumeClaim = PersistentVolumeClaimVolumeSource.toJSON( + message.persistentVolumeClaim, + ); + } + if (message.rbd !== undefined) { + obj.rbd = RBDVolumeSource.toJSON(message.rbd); + } + if (message.flexVolume !== undefined) { + obj.flexVolume = FlexVolumeSource.toJSON(message.flexVolume); + } + if (message.cinder !== undefined) { + obj.cinder = CinderVolumeSource.toJSON(message.cinder); + } + if (message.cephfs !== undefined) { + obj.cephfs = CephFSVolumeSource.toJSON(message.cephfs); + } + if (message.flocker !== undefined) { + obj.flocker = FlockerVolumeSource.toJSON(message.flocker); + } + if (message.downwardAPI !== undefined) { + obj.downwardAPI = DownwardAPIVolumeSource.toJSON(message.downwardAPI); + } + if (message.fc !== undefined) { + obj.fc = FCVolumeSource.toJSON(message.fc); + } + if (message.azureFile !== undefined) { + obj.azureFile = AzureFileVolumeSource.toJSON(message.azureFile); + } + if (message.configMap !== undefined) { + obj.configMap = ConfigMapVolumeSource.toJSON(message.configMap); + } + if (message.vsphereVolume !== undefined) { + obj.vsphereVolume = VsphereVirtualDiskVolumeSource.toJSON(message.vsphereVolume); + } + if (message.quobyte !== undefined) { + obj.quobyte = QuobyteVolumeSource.toJSON(message.quobyte); + } + if (message.azureDisk !== undefined) { + obj.azureDisk = AzureDiskVolumeSource.toJSON(message.azureDisk); + } + if (message.photonPersistentDisk !== undefined) { + obj.photonPersistentDisk = PhotonPersistentDiskVolumeSource.toJSON(message.photonPersistentDisk); + } + if (message.projected !== undefined) { + obj.projected = ProjectedVolumeSource.toJSON(message.projected); + } + if (message.portworxVolume !== undefined) { + obj.portworxVolume = PortworxVolumeSource.toJSON(message.portworxVolume); + } + if (message.scaleIO !== undefined) { + obj.scaleIO = ScaleIOVolumeSource.toJSON(message.scaleIO); + } + if (message.storageos !== undefined) { + obj.storageos = StorageOSVolumeSource.toJSON(message.storageos); + } + if (message.csi !== undefined) { + obj.csi = CSIVolumeSource.toJSON(message.csi); + } + if (message.ephemeral !== undefined) { + obj.ephemeral = EphemeralVolumeSource.toJSON(message.ephemeral); + } + if (message.image !== undefined) { + obj.image = ImageVolumeSource.toJSON(message.image); + } + return obj; + }, + + create, I>>(base?: I): VolumeSource { + return VolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VolumeSource { + const message = createBaseVolumeSource(); + message.hostPath = + object.hostPath !== undefined && object.hostPath !== null + ? HostPathVolumeSource.fromPartial(object.hostPath) + : undefined; + message.emptyDir = + object.emptyDir !== undefined && object.emptyDir !== null + ? EmptyDirVolumeSource.fromPartial(object.emptyDir) + : undefined; + message.gcePersistentDisk = + object.gcePersistentDisk !== undefined && object.gcePersistentDisk !== null + ? GCEPersistentDiskVolumeSource.fromPartial(object.gcePersistentDisk) + : undefined; + message.awsElasticBlockStore = + object.awsElasticBlockStore !== undefined && object.awsElasticBlockStore !== null + ? AWSElasticBlockStoreVolumeSource.fromPartial(object.awsElasticBlockStore) + : undefined; + message.gitRepo = + object.gitRepo !== undefined && object.gitRepo !== null + ? GitRepoVolumeSource.fromPartial(object.gitRepo) + : undefined; + message.secret = + object.secret !== undefined && object.secret !== null + ? SecretVolumeSource.fromPartial(object.secret) + : undefined; + message.nfs = + object.nfs !== undefined && object.nfs !== null + ? NFSVolumeSource.fromPartial(object.nfs) + : undefined; + message.iscsi = + object.iscsi !== undefined && object.iscsi !== null + ? ISCSIVolumeSource.fromPartial(object.iscsi) + : undefined; + message.glusterfs = + object.glusterfs !== undefined && object.glusterfs !== null + ? GlusterfsVolumeSource.fromPartial(object.glusterfs) + : undefined; + message.persistentVolumeClaim = + object.persistentVolumeClaim !== undefined && object.persistentVolumeClaim !== null + ? PersistentVolumeClaimVolumeSource.fromPartial(object.persistentVolumeClaim) + : undefined; + message.rbd = + object.rbd !== undefined && object.rbd !== null + ? RBDVolumeSource.fromPartial(object.rbd) + : undefined; + message.flexVolume = + object.flexVolume !== undefined && object.flexVolume !== null + ? FlexVolumeSource.fromPartial(object.flexVolume) + : undefined; + message.cinder = + object.cinder !== undefined && object.cinder !== null + ? CinderVolumeSource.fromPartial(object.cinder) + : undefined; + message.cephfs = + object.cephfs !== undefined && object.cephfs !== null + ? CephFSVolumeSource.fromPartial(object.cephfs) + : undefined; + message.flocker = + object.flocker !== undefined && object.flocker !== null + ? FlockerVolumeSource.fromPartial(object.flocker) + : undefined; + message.downwardAPI = + object.downwardAPI !== undefined && object.downwardAPI !== null + ? DownwardAPIVolumeSource.fromPartial(object.downwardAPI) + : undefined; + message.fc = + object.fc !== undefined && object.fc !== null ? FCVolumeSource.fromPartial(object.fc) : undefined; + message.azureFile = + object.azureFile !== undefined && object.azureFile !== null + ? AzureFileVolumeSource.fromPartial(object.azureFile) + : undefined; + message.configMap = + object.configMap !== undefined && object.configMap !== null + ? ConfigMapVolumeSource.fromPartial(object.configMap) + : undefined; + message.vsphereVolume = + object.vsphereVolume !== undefined && object.vsphereVolume !== null + ? VsphereVirtualDiskVolumeSource.fromPartial(object.vsphereVolume) + : undefined; + message.quobyte = + object.quobyte !== undefined && object.quobyte !== null + ? QuobyteVolumeSource.fromPartial(object.quobyte) + : undefined; + message.azureDisk = + object.azureDisk !== undefined && object.azureDisk !== null + ? AzureDiskVolumeSource.fromPartial(object.azureDisk) + : undefined; + message.photonPersistentDisk = + object.photonPersistentDisk !== undefined && object.photonPersistentDisk !== null + ? PhotonPersistentDiskVolumeSource.fromPartial(object.photonPersistentDisk) + : undefined; + message.projected = + object.projected !== undefined && object.projected !== null + ? ProjectedVolumeSource.fromPartial(object.projected) + : undefined; + message.portworxVolume = + object.portworxVolume !== undefined && object.portworxVolume !== null + ? PortworxVolumeSource.fromPartial(object.portworxVolume) + : undefined; + message.scaleIO = + object.scaleIO !== undefined && object.scaleIO !== null + ? ScaleIOVolumeSource.fromPartial(object.scaleIO) + : undefined; + message.storageos = + object.storageos !== undefined && object.storageos !== null + ? StorageOSVolumeSource.fromPartial(object.storageos) + : undefined; + message.csi = + object.csi !== undefined && object.csi !== null + ? CSIVolumeSource.fromPartial(object.csi) + : undefined; + message.ephemeral = + object.ephemeral !== undefined && object.ephemeral !== null + ? EphemeralVolumeSource.fromPartial(object.ephemeral) + : undefined; + message.image = + object.image !== undefined && object.image !== null + ? ImageVolumeSource.fromPartial(object.image) + : undefined; + return message; + }, +}; + +function createBaseVolumeStatus(): VolumeStatus { + return { image: undefined }; +} + +export const VolumeStatus: MessageFns = { + encode(message: VolumeStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.image !== undefined) { + ImageVolumeStatus.encode(message.image, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VolumeStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVolumeStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.image = ImageVolumeStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VolumeStatus { + return { image: isSet(object.image) ? ImageVolumeStatus.fromJSON(object.image) : undefined }; + }, + + toJSON(message: VolumeStatus): unknown { + const obj: any = {}; + if (message.image !== undefined) { + obj.image = ImageVolumeStatus.toJSON(message.image); + } + return obj; + }, + + create, I>>(base?: I): VolumeStatus { + return VolumeStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VolumeStatus { + const message = createBaseVolumeStatus(); + message.image = + object.image !== undefined && object.image !== null + ? ImageVolumeStatus.fromPartial(object.image) + : undefined; + return message; + }, +}; + +function createBaseVsphereVirtualDiskVolumeSource(): VsphereVirtualDiskVolumeSource { + return { volumePath: '', fsType: '', storagePolicyName: '', storagePolicyID: '' }; +} + +export const VsphereVirtualDiskVolumeSource: MessageFns = { + encode(message: VsphereVirtualDiskVolumeSource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.volumePath !== undefined && message.volumePath !== '') { + writer.uint32(10).string(message.volumePath); + } + if (message.fsType !== undefined && message.fsType !== '') { + writer.uint32(18).string(message.fsType); + } + if (message.storagePolicyName !== undefined && message.storagePolicyName !== '') { + writer.uint32(26).string(message.storagePolicyName); + } + if (message.storagePolicyID !== undefined && message.storagePolicyID !== '') { + writer.uint32(34).string(message.storagePolicyID); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VsphereVirtualDiskVolumeSource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVsphereVirtualDiskVolumeSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.volumePath = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fsType = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.storagePolicyName = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.storagePolicyID = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): VsphereVirtualDiskVolumeSource { + return { + volumePath: isSet(object.volumePath) ? globalThis.String(object.volumePath) : '', + fsType: isSet(object.fsType) ? globalThis.String(object.fsType) : '', + storagePolicyName: isSet(object.storagePolicyName) + ? globalThis.String(object.storagePolicyName) + : '', + storagePolicyID: isSet(object.storagePolicyID) ? globalThis.String(object.storagePolicyID) : '', + }; + }, + + toJSON(message: VsphereVirtualDiskVolumeSource): unknown { + const obj: any = {}; + if (message.volumePath !== undefined && message.volumePath !== '') { + obj.volumePath = message.volumePath; + } + if (message.fsType !== undefined && message.fsType !== '') { + obj.fsType = message.fsType; + } + if (message.storagePolicyName !== undefined && message.storagePolicyName !== '') { + obj.storagePolicyName = message.storagePolicyName; + } + if (message.storagePolicyID !== undefined && message.storagePolicyID !== '') { + obj.storagePolicyID = message.storagePolicyID; + } + return obj; + }, + + create, I>>( + base?: I, + ): VsphereVirtualDiskVolumeSource { + return VsphereVirtualDiskVolumeSource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): VsphereVirtualDiskVolumeSource { + const message = createBaseVsphereVirtualDiskVolumeSource(); + message.volumePath = object.volumePath ?? ''; + message.fsType = object.fsType ?? ''; + message.storagePolicyName = object.storagePolicyName ?? ''; + message.storagePolicyID = object.storagePolicyID ?? ''; + return message; + }, +}; + +function createBaseWeightedPodAffinityTerm(): WeightedPodAffinityTerm { + return { weight: 0, podAffinityTerm: undefined }; +} + +export const WeightedPodAffinityTerm: MessageFns = { + encode(message: WeightedPodAffinityTerm, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.weight !== undefined && message.weight !== 0) { + writer.uint32(8).int32(message.weight); + } + if (message.podAffinityTerm !== undefined) { + PodAffinityTerm.encode(message.podAffinityTerm, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeightedPodAffinityTerm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedPodAffinityTerm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.weight = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.podAffinityTerm = PodAffinityTerm.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): WeightedPodAffinityTerm { + return { + weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, + podAffinityTerm: isSet(object.podAffinityTerm) + ? PodAffinityTerm.fromJSON(object.podAffinityTerm) + : undefined, + }; + }, + + toJSON(message: WeightedPodAffinityTerm): unknown { + const obj: any = {}; + if (message.weight !== undefined && message.weight !== 0) { + obj.weight = Math.round(message.weight); + } + if (message.podAffinityTerm !== undefined) { + obj.podAffinityTerm = PodAffinityTerm.toJSON(message.podAffinityTerm); + } + return obj; + }, + + create, I>>(base?: I): WeightedPodAffinityTerm { + return WeightedPodAffinityTerm.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): WeightedPodAffinityTerm { + const message = createBaseWeightedPodAffinityTerm(); + message.weight = object.weight ?? 0; + message.podAffinityTerm = + object.podAffinityTerm !== undefined && object.podAffinityTerm !== null + ? PodAffinityTerm.fromPartial(object.podAffinityTerm) + : undefined; + return message; + }, +}; + +function createBaseWindowsSecurityContextOptions(): WindowsSecurityContextOptions { + return { gmsaCredentialSpecName: '', gmsaCredentialSpec: '', runAsUserName: '', hostProcess: false }; +} + +export const WindowsSecurityContextOptions: MessageFns = { + encode(message: WindowsSecurityContextOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gmsaCredentialSpecName !== undefined && message.gmsaCredentialSpecName !== '') { + writer.uint32(10).string(message.gmsaCredentialSpecName); + } + if (message.gmsaCredentialSpec !== undefined && message.gmsaCredentialSpec !== '') { + writer.uint32(18).string(message.gmsaCredentialSpec); + } + if (message.runAsUserName !== undefined && message.runAsUserName !== '') { + writer.uint32(26).string(message.runAsUserName); + } + if (message.hostProcess !== undefined && message.hostProcess !== false) { + writer.uint32(32).bool(message.hostProcess); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WindowsSecurityContextOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWindowsSecurityContextOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.gmsaCredentialSpecName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.gmsaCredentialSpec = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.runAsUserName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.hostProcess = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): WindowsSecurityContextOptions { + return { + gmsaCredentialSpecName: isSet(object.gmsaCredentialSpecName) + ? globalThis.String(object.gmsaCredentialSpecName) + : '', + gmsaCredentialSpec: isSet(object.gmsaCredentialSpec) + ? globalThis.String(object.gmsaCredentialSpec) + : '', + runAsUserName: isSet(object.runAsUserName) ? globalThis.String(object.runAsUserName) : '', + hostProcess: isSet(object.hostProcess) ? globalThis.Boolean(object.hostProcess) : false, + }; + }, + + toJSON(message: WindowsSecurityContextOptions): unknown { + const obj: any = {}; + if (message.gmsaCredentialSpecName !== undefined && message.gmsaCredentialSpecName !== '') { + obj.gmsaCredentialSpecName = message.gmsaCredentialSpecName; + } + if (message.gmsaCredentialSpec !== undefined && message.gmsaCredentialSpec !== '') { + obj.gmsaCredentialSpec = message.gmsaCredentialSpec; + } + if (message.runAsUserName !== undefined && message.runAsUserName !== '') { + obj.runAsUserName = message.runAsUserName; + } + if (message.hostProcess !== undefined && message.hostProcess !== false) { + obj.hostProcess = message.hostProcess; + } + return obj; + }, + + create, I>>( + base?: I, + ): WindowsSecurityContextOptions { + return WindowsSecurityContextOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): WindowsSecurityContextOptions { + const message = createBaseWindowsSecurityContextOptions(); + message.gmsaCredentialSpecName = object.gmsaCredentialSpecName ?? ''; + message.gmsaCredentialSpec = object.gmsaCredentialSpec ?? ''; + message.runAsUserName = object.runAsUserName ?? ''; + message.hostProcess = object.hostProcess ?? false; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from((globalThis as any).Buffer.from(b64, 'base64')); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return (globalThis as any).Buffer.from(arr).toString('base64'); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join('')); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error('Value is smaller than Number.MIN_SAFE_INTEGER'); + } + return num; +} + +function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/discovery/v1/generated.ts b/src/proto/generated/k8s.io/api/discovery/v1/generated.ts new file mode 100644 index 00000000000..1e882e95fa9 --- /dev/null +++ b/src/proto/generated/k8s.io/api/discovery/v1/generated.ts @@ -0,0 +1,1272 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/discovery/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { ListMeta, ObjectMeta } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; +import { ObjectReference } from '../../core/v1/generated.js'; + +/** Endpoint represents a single logical "backend" implementing a service. */ +export interface Endpoint { + /** + * addresses of this endpoint. For EndpointSlices of addressType "IPv4" or "IPv6", + * the values are IP addresses in canonical form. The syntax and semantics of + * other addressType values are not defined. This must contain at least one + * address but no more than 100. EndpointSlices generated by the EndpointSlice + * controller will always have exactly 1 address. No semantics are defined for + * additional addresses beyond the first, and kube-proxy does not look at them. + * +listType=set + * +required + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:maxItems=100 + */ + addresses: string[]; + /** + * conditions contains information about the current status of the endpoint. + * +optional + */ + conditions?: EndpointConditions | undefined; + /** + * hostname of this endpoint. This field may be used by consumers of + * endpoints to distinguish endpoints from each other (e.g. in DNS names). + * Multiple endpoints which use the same hostname should be considered + * fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS + * Label (RFC 1123) validation. + * +optional + */ + hostname?: string | undefined; + /** + * targetRef is a reference to a Kubernetes object that represents this + * endpoint. + * +optional + */ + targetRef?: ObjectReference | undefined; + /** + * deprecatedTopology contains topology information part of the v1beta1 + * API. This field is deprecated, and will be removed when the v1beta1 + * API is removed (no sooner than kubernetes v1.24). While this field can + * hold values, it is not writable through the v1 API, and any attempts to + * write to it will be silently ignored. Topology information can be found + * in the zone and nodeName fields instead. + * +optional + */ + deprecatedTopology: { [key: string]: string }; + /** + * nodeName represents the name of the Node hosting this endpoint. This can + * be used to determine endpoints local to a Node. + * +optional + */ + nodeName?: string | undefined; + /** + * zone is the name of the Zone this endpoint exists in. + * +optional + */ + zone?: string | undefined; + /** + * hints contains information associated with how an endpoint should be + * consumed. + * +optional + */ + hints?: EndpointHints | undefined; +} + +export interface Endpoint_DeprecatedTopologyEntry { + key: string; + value: string; +} + +/** EndpointConditions represents the current condition of an endpoint. */ +export interface EndpointConditions { + /** + * ready indicates that this endpoint is ready to receive traffic, + * according to whatever system is managing the endpoint. A nil value + * should be interpreted as "true". In general, an endpoint should be + * marked ready if it is serving and not terminating, though this can + * be overridden in some cases, such as when the associated Service has + * set the publishNotReadyAddresses flag. + * +optional + */ + ready?: boolean | undefined; + /** + * serving indicates that this endpoint is able to receive traffic, + * according to whatever system is managing the endpoint. For endpoints + * backed by pods, the EndpointSlice controller will mark the endpoint + * as serving if the pod's Ready condition is True. A nil value should be + * interpreted as "true". + * +optional + */ + serving?: boolean | undefined; + /** + * terminating indicates that this endpoint is terminating. A nil value + * should be interpreted as "false". + * +optional + */ + terminating?: boolean | undefined; +} + +/** EndpointHints provides hints describing how an endpoint should be consumed. */ +export interface EndpointHints { + /** + * forZones indicates the zone(s) this endpoint should be consumed by when + * using topology aware routing. May contain a maximum of 8 entries. + * +optional + * +listType=atomic + */ + forZones: ForZone[]; + /** + * forNodes indicates the node(s) this endpoint should be consumed by when + * using topology aware routing. May contain a maximum of 8 entries. + * +optional + * +listType=atomic + */ + forNodes: ForNode[]; +} + +/** + * EndpointPort represents a Port used by an EndpointSlice + * +structType=atomic + */ +export interface EndpointPort { + /** + * name represents the name of this port. All ports in an EndpointSlice must have a unique name. + * If the EndpointSlice is derived from a Kubernetes service, this corresponds to the Service.ports[].name. + * Name must either be an empty string or pass DNS_LABEL validation: + * * must be no more than 63 characters long. + * * must consist of lower case alphanumeric characters or '-'. + * * must start and end with an alphanumeric character. + * Default is empty string. + * +optional + */ + name?: string | undefined; + /** + * protocol represents the IP protocol for this port. + * Must be UDP, TCP, or SCTP. + * Default is TCP. + * +optional + */ + protocol?: string | undefined; + /** + * port represents the port number of the endpoint. + * If the EndpointSlice is derived from a Kubernetes service, this must be set + * to the service's target port. EndpointSlices used for other purposes may have + * a nil port. + * +optional + */ + port?: number | undefined; + /** + * The application protocol for this port. + * This is used as a hint for implementations to offer richer behavior for protocols that they understand. + * This field follows standard Kubernetes label syntax. + * Valid values are either: + * + * * Un-prefixed protocol names - reserved for IANA standard service names (as per + * RFC-6335 and https://www.iana.org/assignments/service-names). + * + * * Kubernetes-defined prefixed names: + * * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- + * * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 + * * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 + * + * * Other protocols should use implementation-defined prefixed names such as + * mycompany.com/my-custom-protocol. + * +optional + */ + appProtocol?: string | undefined; +} + +/** + * EndpointSlice represents a set of service endpoints. Most EndpointSlices are created by + * the EndpointSlice controller to represent the Pods selected by Service objects. For a + * given service there may be multiple EndpointSlice objects which must be joined to + * produce the full set of endpoints; you can find all of the slices for a given service + * by listing EndpointSlices in the service's namespace whose `kubernetes.io/service-name` + * label contains the service's name. + */ +export interface EndpointSlice { + /** + * Standard object's metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * addressType specifies the type of address carried by this EndpointSlice. + * All addresses in this slice must be the same type. This field is + * immutable after creation. The following address types are currently + * supported: + * * IPv4: Represents an IPv4 Address. + * * IPv6: Represents an IPv6 Address. + * * FQDN: Represents a Fully Qualified Domain Name. (Deprecated) + * The EndpointSlice controller only generates, and kube-proxy only processes, + * slices of addressType "IPv4" and "IPv6". No semantics are defined for + * the "FQDN" type. + * +required + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:immutable + */ + addressType?: string | undefined; + /** + * endpoints is a list of unique endpoints in this slice. Each slice may + * include a maximum of 1000 endpoints. + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + endpoints: Endpoint[]; + /** + * ports specifies the list of network ports exposed by each endpoint in + * this slice. Each port must have a unique name. Each slice may include a + * maximum of 100 ports. + * Services always have at least 1 port, so EndpointSlices generated by the + * EndpointSlice controller will likewise always have at least 1 port. + * EndpointSlices used for other purposes may have an empty ports list. + * +optional + * +listType=atomic + */ + ports: EndpointPort[]; +} + +/** EndpointSliceList represents a list of endpoint slices */ +export interface EndpointSliceList { + /** + * Standard list metadata. + * +optional + */ + metadata?: ListMeta | undefined; + /** items is the list of endpoint slices */ + items: EndpointSlice[]; +} + +/** ForNode provides information about which nodes should consume this endpoint. */ +export interface ForNode { + /** + * name represents the name of the node. + * +required + */ + name?: string | undefined; +} + +/** ForZone provides information about which zones should consume this endpoint. */ +export interface ForZone { + /** + * name represents the name of the zone. + * +required + */ + name?: string | undefined; +} + +function createBaseEndpoint(): Endpoint { + return { + addresses: [], + conditions: undefined, + hostname: '', + targetRef: undefined, + deprecatedTopology: {}, + nodeName: '', + zone: '', + hints: undefined, + }; +} + +export const Endpoint: MessageFns = { + encode(message: Endpoint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + if (message.conditions !== undefined) { + EndpointConditions.encode(message.conditions, writer.uint32(18).fork()).join(); + } + if (message.hostname !== undefined && message.hostname !== '') { + writer.uint32(26).string(message.hostname); + } + if (message.targetRef !== undefined) { + ObjectReference.encode(message.targetRef, writer.uint32(34).fork()).join(); + } + globalThis.Object.entries(message.deprecatedTopology).forEach(([key, value]: [string, string]) => { + Endpoint_DeprecatedTopologyEntry.encode( + { key: key as any, value }, + writer.uint32(42).fork(), + ).join(); + }); + if (message.nodeName !== undefined && message.nodeName !== '') { + writer.uint32(50).string(message.nodeName); + } + if (message.zone !== undefined && message.zone !== '') { + writer.uint32(58).string(message.zone); + } + if (message.hints !== undefined) { + EndpointHints.encode(message.hints, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Endpoint { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndpoint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.addresses.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.conditions = EndpointConditions.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.hostname = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.targetRef = ObjectReference.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + const entry5 = Endpoint_DeprecatedTopologyEntry.decode(reader, reader.uint32()); + if (entry5.value !== undefined) { + message.deprecatedTopology[entry5.key] = entry5.value; + } + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.nodeName = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.zone = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.hints = EndpointHints.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Endpoint { + return { + addresses: globalThis.Array.isArray(object?.addresses) + ? object.addresses.map((e: any) => globalThis.String(e)) + : [], + conditions: isSet(object.conditions) ? EndpointConditions.fromJSON(object.conditions) : undefined, + hostname: isSet(object.hostname) ? globalThis.String(object.hostname) : '', + targetRef: isSet(object.targetRef) ? ObjectReference.fromJSON(object.targetRef) : undefined, + deprecatedTopology: isObject(object.deprecatedTopology) + ? (globalThis.Object.entries(object.deprecatedTopology) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + nodeName: isSet(object.nodeName) ? globalThis.String(object.nodeName) : '', + zone: isSet(object.zone) ? globalThis.String(object.zone) : '', + hints: isSet(object.hints) ? EndpointHints.fromJSON(object.hints) : undefined, + }; + }, + + toJSON(message: Endpoint): unknown { + const obj: any = {}; + if (message.addresses?.length) { + obj.addresses = message.addresses; + } + if (message.conditions !== undefined) { + obj.conditions = EndpointConditions.toJSON(message.conditions); + } + if (message.hostname !== undefined && message.hostname !== '') { + obj.hostname = message.hostname; + } + if (message.targetRef !== undefined) { + obj.targetRef = ObjectReference.toJSON(message.targetRef); + } + if (message.deprecatedTopology) { + const entries = globalThis.Object.entries(message.deprecatedTopology) as [string, string][]; + if (entries.length > 0) { + obj.deprecatedTopology = {}; + entries.forEach(([k, v]) => { + obj.deprecatedTopology[k] = v; + }); + } + } + if (message.nodeName !== undefined && message.nodeName !== '') { + obj.nodeName = message.nodeName; + } + if (message.zone !== undefined && message.zone !== '') { + obj.zone = message.zone; + } + if (message.hints !== undefined) { + obj.hints = EndpointHints.toJSON(message.hints); + } + return obj; + }, + + create, I>>(base?: I): Endpoint { + return Endpoint.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Endpoint { + const message = createBaseEndpoint(); + message.addresses = object.addresses?.map((e) => e) || []; + message.conditions = + object.conditions !== undefined && object.conditions !== null + ? EndpointConditions.fromPartial(object.conditions) + : undefined; + message.hostname = object.hostname ?? ''; + message.targetRef = + object.targetRef !== undefined && object.targetRef !== null + ? ObjectReference.fromPartial(object.targetRef) + : undefined; + message.deprecatedTopology = ( + globalThis.Object.entries(object.deprecatedTopology ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.nodeName = object.nodeName ?? ''; + message.zone = object.zone ?? ''; + message.hints = + object.hints !== undefined && object.hints !== null + ? EndpointHints.fromPartial(object.hints) + : undefined; + return message; + }, +}; + +function createBaseEndpoint_DeprecatedTopologyEntry(): Endpoint_DeprecatedTopologyEntry { + return { key: '', value: '' }; +} + +export const Endpoint_DeprecatedTopologyEntry: MessageFns = { + encode( + message: Endpoint_DeprecatedTopologyEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Endpoint_DeprecatedTopologyEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndpoint_DeprecatedTopologyEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Endpoint_DeprecatedTopologyEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: Endpoint_DeprecatedTopologyEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): Endpoint_DeprecatedTopologyEntry { + return Endpoint_DeprecatedTopologyEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): Endpoint_DeprecatedTopologyEntry { + const message = createBaseEndpoint_DeprecatedTopologyEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBaseEndpointConditions(): EndpointConditions { + return { ready: false, serving: false, terminating: false }; +} + +export const EndpointConditions: MessageFns = { + encode(message: EndpointConditions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ready !== undefined && message.ready !== false) { + writer.uint32(8).bool(message.ready); + } + if (message.serving !== undefined && message.serving !== false) { + writer.uint32(16).bool(message.serving); + } + if (message.terminating !== undefined && message.terminating !== false) { + writer.uint32(24).bool(message.terminating); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EndpointConditions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndpointConditions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.ready = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.serving = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.terminating = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EndpointConditions { + return { + ready: isSet(object.ready) ? globalThis.Boolean(object.ready) : false, + serving: isSet(object.serving) ? globalThis.Boolean(object.serving) : false, + terminating: isSet(object.terminating) ? globalThis.Boolean(object.terminating) : false, + }; + }, + + toJSON(message: EndpointConditions): unknown { + const obj: any = {}; + if (message.ready !== undefined && message.ready !== false) { + obj.ready = message.ready; + } + if (message.serving !== undefined && message.serving !== false) { + obj.serving = message.serving; + } + if (message.terminating !== undefined && message.terminating !== false) { + obj.terminating = message.terminating; + } + return obj; + }, + + create, I>>(base?: I): EndpointConditions { + return EndpointConditions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EndpointConditions { + const message = createBaseEndpointConditions(); + message.ready = object.ready ?? false; + message.serving = object.serving ?? false; + message.terminating = object.terminating ?? false; + return message; + }, +}; + +function createBaseEndpointHints(): EndpointHints { + return { forZones: [], forNodes: [] }; +} + +export const EndpointHints: MessageFns = { + encode(message: EndpointHints, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.forZones) { + ForZone.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.forNodes) { + ForNode.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EndpointHints { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndpointHints(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.forZones.push(ForZone.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.forNodes.push(ForNode.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EndpointHints { + return { + forZones: globalThis.Array.isArray(object?.forZones) + ? object.forZones.map((e: any) => ForZone.fromJSON(e)) + : [], + forNodes: globalThis.Array.isArray(object?.forNodes) + ? object.forNodes.map((e: any) => ForNode.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EndpointHints): unknown { + const obj: any = {}; + if (message.forZones?.length) { + obj.forZones = message.forZones.map((e) => ForZone.toJSON(e)); + } + if (message.forNodes?.length) { + obj.forNodes = message.forNodes.map((e) => ForNode.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EndpointHints { + return EndpointHints.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EndpointHints { + const message = createBaseEndpointHints(); + message.forZones = object.forZones?.map((e) => ForZone.fromPartial(e)) || []; + message.forNodes = object.forNodes?.map((e) => ForNode.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEndpointPort(): EndpointPort { + return { name: '', protocol: '', port: 0, appProtocol: '' }; +} + +export const EndpointPort: MessageFns = { + encode(message: EndpointPort, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.protocol !== undefined && message.protocol !== '') { + writer.uint32(18).string(message.protocol); + } + if (message.port !== undefined && message.port !== 0) { + writer.uint32(24).int32(message.port); + } + if (message.appProtocol !== undefined && message.appProtocol !== '') { + writer.uint32(34).string(message.appProtocol); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EndpointPort { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndpointPort(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.protocol = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.port = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.appProtocol = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EndpointPort { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + protocol: isSet(object.protocol) ? globalThis.String(object.protocol) : '', + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + appProtocol: isSet(object.appProtocol) ? globalThis.String(object.appProtocol) : '', + }; + }, + + toJSON(message: EndpointPort): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.protocol !== undefined && message.protocol !== '') { + obj.protocol = message.protocol; + } + if (message.port !== undefined && message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.appProtocol !== undefined && message.appProtocol !== '') { + obj.appProtocol = message.appProtocol; + } + return obj; + }, + + create, I>>(base?: I): EndpointPort { + return EndpointPort.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EndpointPort { + const message = createBaseEndpointPort(); + message.name = object.name ?? ''; + message.protocol = object.protocol ?? ''; + message.port = object.port ?? 0; + message.appProtocol = object.appProtocol ?? ''; + return message; + }, +}; + +function createBaseEndpointSlice(): EndpointSlice { + return { metadata: undefined, addressType: '', endpoints: [], ports: [] }; +} + +export const EndpointSlice: MessageFns = { + encode(message: EndpointSlice, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.addressType !== undefined && message.addressType !== '') { + writer.uint32(34).string(message.addressType); + } + for (const v of message.endpoints) { + Endpoint.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.ports) { + EndpointPort.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EndpointSlice { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndpointSlice(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.addressType = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.endpoints.push(Endpoint.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.ports.push(EndpointPort.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EndpointSlice { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + addressType: isSet(object.addressType) ? globalThis.String(object.addressType) : '', + endpoints: globalThis.Array.isArray(object?.endpoints) + ? object.endpoints.map((e: any) => Endpoint.fromJSON(e)) + : [], + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => EndpointPort.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EndpointSlice): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.addressType !== undefined && message.addressType !== '') { + obj.addressType = message.addressType; + } + if (message.endpoints?.length) { + obj.endpoints = message.endpoints.map((e) => Endpoint.toJSON(e)); + } + if (message.ports?.length) { + obj.ports = message.ports.map((e) => EndpointPort.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EndpointSlice { + return EndpointSlice.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EndpointSlice { + const message = createBaseEndpointSlice(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.addressType = object.addressType ?? ''; + message.endpoints = object.endpoints?.map((e) => Endpoint.fromPartial(e)) || []; + message.ports = object.ports?.map((e) => EndpointPort.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEndpointSliceList(): EndpointSliceList { + return { metadata: undefined, items: [] }; +} + +export const EndpointSliceList: MessageFns = { + encode(message: EndpointSliceList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + EndpointSlice.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EndpointSliceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndpointSliceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(EndpointSlice.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EndpointSliceList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => EndpointSlice.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EndpointSliceList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => EndpointSlice.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EndpointSliceList { + return EndpointSliceList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EndpointSliceList { + const message = createBaseEndpointSliceList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => EndpointSlice.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseForNode(): ForNode { + return { name: '' }; +} + +export const ForNode: MessageFns = { + encode(message: ForNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ForNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseForNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ForNode { + return { name: isSet(object.name) ? globalThis.String(object.name) : '' }; + }, + + toJSON(message: ForNode): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): ForNode { + return ForNode.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ForNode { + const message = createBaseForNode(); + message.name = object.name ?? ''; + return message; + }, +}; + +function createBaseForZone(): ForZone { + return { name: '' }; +} + +export const ForZone: MessageFns = { + encode(message: ForZone, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ForZone { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseForZone(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ForZone { + return { name: isSet(object.name) ? globalThis.String(object.name) : '' }; + }, + + toJSON(message: ForZone): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): ForZone { + return ForZone.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ForZone { + const message = createBaseForZone(); + message.name = object.name ?? ''; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/events/v1/generated.ts b/src/proto/generated/k8s.io/api/events/v1/generated.ts new file mode 100644 index 00000000000..ada572a001a --- /dev/null +++ b/src/proto/generated/k8s.io/api/events/v1/generated.ts @@ -0,0 +1,692 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/events/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { ListMeta, MicroTime, ObjectMeta, Time } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; +import { EventSource, ObjectReference } from '../../core/v1/generated.js'; + +/** + * Event is a report of an event somewhere in the cluster. It generally denotes some state change in the system. + * 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 { + /** + * metadata is the standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * eventTime is the time when this Event was first observed. It is required. + * +required + */ + eventTime?: MicroTime | undefined; + /** + * series is data about the Event series this event represents or nil if it's a singleton Event. + * +optional + */ + series?: EventSeries | undefined; + /** + * reportingController is the name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`. + * This field cannot be empty for new Events. + * +required + */ + reportingController?: string | undefined; + /** + * reportingInstance is the ID of the controller instance, e.g. `kubelet-xyzf`. + * This field cannot be empty for new Events and it can have at most 128 characters. + * +required + */ + reportingInstance?: string | undefined; + /** + * action is what action was taken/failed regarding to the regarding object. It is machine-readable. + * This field cannot be empty for new Events and it can have at most 128 characters. + * +required + */ + action?: string | undefined; + /** + * reason is why the action was taken. It is human-readable. + * This field cannot be empty for new Events and it can have at most 128 characters. + * +required + */ + reason?: string | undefined; + /** + * regarding contains the object this Event is about. In most cases it's an Object reporting controller + * implements, e.g. ReplicaSetController implements ReplicaSets and this event is emitted because + * it acts on some changes in a ReplicaSet object. + * +optional + */ + regarding?: ObjectReference | undefined; + /** + * related is the optional secondary object for more complex actions. E.g. when regarding object triggers + * a creation or deletion of related object. + * +optional + */ + related?: ObjectReference | undefined; + /** + * note is a human-readable description of the status of this operation. + * Maximal length of the note is 1kB, but libraries should be prepared to + * handle values up to 64kB. + * +optional + */ + note?: string | undefined; + /** + * type is the type of this event (Normal, Warning), new types could be added in the future. + * It is machine-readable. + * This field cannot be empty for new Events. + * +required + */ + type?: string | undefined; + /** + * deprecatedSource is the deprecated field assuring backward compatibility with core.v1 Event type. + * +optional + */ + deprecatedSource?: EventSource | undefined; + /** + * deprecatedFirstTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type. + * +optional + */ + deprecatedFirstTimestamp?: Time | undefined; + /** + * deprecatedLastTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type. + * +optional + */ + deprecatedLastTimestamp?: Time | undefined; + /** + * deprecatedCount is the deprecated field assuring backward compatibility with core.v1 Event type. + * +optional + */ + deprecatedCount?: number | undefined; +} + +/** EventList is a list of Event objects. */ +export interface EventList { + /** + * metadata is the standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** items is a list of schema objects. */ + items: Event[]; +} + +/** + * EventSeries contain information on series of events, i.e. thing that was/is happening + * continuously for some time. How often to update the EventSeries is up to the event reporters. + * The default event reporter in "k8s.io/client-go/tools/events/event_broadcaster.go" shows + * how this struct is updated on heartbeats and can guide customized reporter implementations. + */ +export interface EventSeries { + /** + * count is the number of occurrences in this series up to the last heartbeat time. + * +required + */ + count?: number | undefined; + /** + * lastObservedTime is the time when last Event from the series was seen before last heartbeat. + * +required + */ + lastObservedTime?: MicroTime | undefined; +} + +function createBaseEvent(): Event { + return { + metadata: undefined, + eventTime: undefined, + series: undefined, + reportingController: '', + reportingInstance: '', + action: '', + reason: '', + regarding: undefined, + related: undefined, + note: '', + type: '', + deprecatedSource: undefined, + deprecatedFirstTimestamp: undefined, + deprecatedLastTimestamp: undefined, + deprecatedCount: 0, + }; +} + +export const Event: MessageFns = { + encode(message: Event, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.eventTime !== undefined) { + MicroTime.encode(message.eventTime, writer.uint32(18).fork()).join(); + } + if (message.series !== undefined) { + EventSeries.encode(message.series, writer.uint32(26).fork()).join(); + } + if (message.reportingController !== undefined && message.reportingController !== '') { + writer.uint32(34).string(message.reportingController); + } + if (message.reportingInstance !== undefined && message.reportingInstance !== '') { + writer.uint32(42).string(message.reportingInstance); + } + if (message.action !== undefined && message.action !== '') { + writer.uint32(50).string(message.action); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(58).string(message.reason); + } + if (message.regarding !== undefined) { + ObjectReference.encode(message.regarding, writer.uint32(66).fork()).join(); + } + if (message.related !== undefined) { + ObjectReference.encode(message.related, writer.uint32(74).fork()).join(); + } + if (message.note !== undefined && message.note !== '') { + writer.uint32(82).string(message.note); + } + if (message.type !== undefined && message.type !== '') { + writer.uint32(90).string(message.type); + } + if (message.deprecatedSource !== undefined) { + EventSource.encode(message.deprecatedSource, writer.uint32(98).fork()).join(); + } + if (message.deprecatedFirstTimestamp !== undefined) { + Time.encode(message.deprecatedFirstTimestamp, writer.uint32(106).fork()).join(); + } + if (message.deprecatedLastTimestamp !== undefined) { + Time.encode(message.deprecatedLastTimestamp, writer.uint32(114).fork()).join(); + } + if (message.deprecatedCount !== undefined && message.deprecatedCount !== 0) { + writer.uint32(120).int32(message.deprecatedCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.eventTime = MicroTime.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.series = EventSeries.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reportingController = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.reportingInstance = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.action = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.reason = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.regarding = ObjectReference.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.related = ObjectReference.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.note = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.type = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.deprecatedSource = EventSource.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.deprecatedFirstTimestamp = Time.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.deprecatedLastTimestamp = Time.decode(reader, reader.uint32()); + continue; + } + case 15: { + if (tag !== 120) { + break; + } + + message.deprecatedCount = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Event { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + eventTime: isSet(object.eventTime) ? MicroTime.fromJSON(object.eventTime) : undefined, + series: isSet(object.series) ? EventSeries.fromJSON(object.series) : undefined, + reportingController: isSet(object.reportingController) + ? globalThis.String(object.reportingController) + : '', + reportingInstance: isSet(object.reportingInstance) + ? globalThis.String(object.reportingInstance) + : '', + action: isSet(object.action) ? globalThis.String(object.action) : '', + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + regarding: isSet(object.regarding) ? ObjectReference.fromJSON(object.regarding) : undefined, + related: isSet(object.related) ? ObjectReference.fromJSON(object.related) : undefined, + note: isSet(object.note) ? globalThis.String(object.note) : '', + type: isSet(object.type) ? globalThis.String(object.type) : '', + deprecatedSource: isSet(object.deprecatedSource) + ? EventSource.fromJSON(object.deprecatedSource) + : undefined, + deprecatedFirstTimestamp: isSet(object.deprecatedFirstTimestamp) + ? Time.fromJSON(object.deprecatedFirstTimestamp) + : undefined, + deprecatedLastTimestamp: isSet(object.deprecatedLastTimestamp) + ? Time.fromJSON(object.deprecatedLastTimestamp) + : undefined, + deprecatedCount: isSet(object.deprecatedCount) ? globalThis.Number(object.deprecatedCount) : 0, + }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.eventTime !== undefined) { + obj.eventTime = MicroTime.toJSON(message.eventTime); + } + if (message.series !== undefined) { + obj.series = EventSeries.toJSON(message.series); + } + if (message.reportingController !== undefined && message.reportingController !== '') { + obj.reportingController = message.reportingController; + } + if (message.reportingInstance !== undefined && message.reportingInstance !== '') { + obj.reportingInstance = message.reportingInstance; + } + if (message.action !== undefined && message.action !== '') { + obj.action = message.action; + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.regarding !== undefined) { + obj.regarding = ObjectReference.toJSON(message.regarding); + } + if (message.related !== undefined) { + obj.related = ObjectReference.toJSON(message.related); + } + if (message.note !== undefined && message.note !== '') { + obj.note = message.note; + } + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.deprecatedSource !== undefined) { + obj.deprecatedSource = EventSource.toJSON(message.deprecatedSource); + } + if (message.deprecatedFirstTimestamp !== undefined) { + obj.deprecatedFirstTimestamp = Time.toJSON(message.deprecatedFirstTimestamp); + } + if (message.deprecatedLastTimestamp !== undefined) { + obj.deprecatedLastTimestamp = Time.toJSON(message.deprecatedLastTimestamp); + } + if (message.deprecatedCount !== undefined && message.deprecatedCount !== 0) { + obj.deprecatedCount = Math.round(message.deprecatedCount); + } + return obj; + }, + + create, I>>(base?: I): Event { + return Event.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Event { + const message = createBaseEvent(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.eventTime = + object.eventTime !== undefined && object.eventTime !== null + ? MicroTime.fromPartial(object.eventTime) + : undefined; + message.series = + object.series !== undefined && object.series !== null + ? EventSeries.fromPartial(object.series) + : undefined; + message.reportingController = object.reportingController ?? ''; + message.reportingInstance = object.reportingInstance ?? ''; + message.action = object.action ?? ''; + message.reason = object.reason ?? ''; + message.regarding = + object.regarding !== undefined && object.regarding !== null + ? ObjectReference.fromPartial(object.regarding) + : undefined; + message.related = + object.related !== undefined && object.related !== null + ? ObjectReference.fromPartial(object.related) + : undefined; + message.note = object.note ?? ''; + message.type = object.type ?? ''; + message.deprecatedSource = + object.deprecatedSource !== undefined && object.deprecatedSource !== null + ? EventSource.fromPartial(object.deprecatedSource) + : undefined; + message.deprecatedFirstTimestamp = + object.deprecatedFirstTimestamp !== undefined && object.deprecatedFirstTimestamp !== null + ? Time.fromPartial(object.deprecatedFirstTimestamp) + : undefined; + message.deprecatedLastTimestamp = + object.deprecatedLastTimestamp !== undefined && object.deprecatedLastTimestamp !== null + ? Time.fromPartial(object.deprecatedLastTimestamp) + : undefined; + message.deprecatedCount = object.deprecatedCount ?? 0; + return message; + }, +}; + +function createBaseEventList(): EventList { + return { metadata: undefined, items: [] }; +} + +export const EventList: MessageFns = { + encode(message: EventList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Event.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Event.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EventList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Event.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EventList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Event.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EventList { + return EventList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventList { + const message = createBaseEventList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Event.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEventSeries(): EventSeries { + return { count: 0, lastObservedTime: undefined }; +} + +export const EventSeries: MessageFns = { + encode(message: EventSeries, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.count !== undefined && message.count !== 0) { + writer.uint32(8).int32(message.count); + } + if (message.lastObservedTime !== undefined) { + MicroTime.encode(message.lastObservedTime, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventSeries { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSeries(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.count = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.lastObservedTime = MicroTime.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): EventSeries { + return { + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + lastObservedTime: isSet(object.lastObservedTime) + ? MicroTime.fromJSON(object.lastObservedTime) + : undefined, + }; + }, + + toJSON(message: EventSeries): unknown { + const obj: any = {}; + if (message.count !== undefined && message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.lastObservedTime !== undefined) { + obj.lastObservedTime = MicroTime.toJSON(message.lastObservedTime); + } + return obj; + }, + + create, I>>(base?: I): EventSeries { + return EventSeries.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventSeries { + const message = createBaseEventSeries(); + message.count = object.count ?? 0; + message.lastObservedTime = + object.lastObservedTime !== undefined && object.lastObservedTime !== null + ? MicroTime.fromPartial(object.lastObservedTime) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/extensions/v1beta1/generated.ts b/src/proto/generated/k8s.io/api/extensions/v1beta1/generated.ts new file mode 100644 index 00000000000..93c0cbf8561 --- /dev/null +++ b/src/proto/generated/k8s.io/api/extensions/v1beta1/generated.ts @@ -0,0 +1,6563 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/extensions/v1beta1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { + LabelSelector, + ListMeta, + ObjectMeta, + Time, +} from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; +import { IntOrString } from '../../../apimachinery/pkg/util/intstr/generated.js'; +import { PodTemplateSpec, TypedLocalObjectReference } from '../../core/v1/generated.js'; + +/** + * DEPRECATED - This group version of DaemonSet is deprecated by apps/v1beta2/DaemonSet. See the release notes for + * more information. + * DaemonSet represents the configuration of a daemon set. + * +k8s:supportsSubresource="/status" + */ +export interface DaemonSet { + /** + * metadata is the standard object metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec is the desired behavior of this daemon set. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: DaemonSetSpec | undefined; + /** + * status is the current status of this daemon set. This data may be + * out of date by some window of time. + * Populated by the system. + * Read-only. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: DaemonSetStatus | undefined; +} + +/** DaemonSetCondition describes the state of a DaemonSet at a certain point. */ +export interface DaemonSetCondition { + /** type is the type of DaemonSet condition. */ + type?: string | undefined; + /** status is the status of the condition, one of True, False, Unknown. */ + status?: string | undefined; + /** + * lastTransitionTime is the last time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * reason is the reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * message is a human readable message indicating details about the transition. + * +optional + */ + message?: string | undefined; +} + +/** DaemonSetList is a collection of daemon sets. */ +export interface DaemonSetList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** A list of daemon sets. */ + items: DaemonSet[]; +} + +/** DaemonSetSpec is the specification of a daemon set. */ +export interface DaemonSetSpec { + /** + * selector is a label query over pods that are managed by the daemon set. + * Must match in order to be controlled. + * If empty, defaulted to labels on Pod template. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + * +optional + */ + selector?: LabelSelector | undefined; + /** + * template is an object that describes the pod that will be created. + * The DaemonSet will create exactly one copy of this pod on every node + * that matches the template's node selector (or on every node if no node + * selector is specified). + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + */ + template?: PodTemplateSpec | undefined; + /** + * updateStrategy is an update strategy to replace existing DaemonSet pods with new pods. + * +optional + */ + updateStrategy?: DaemonSetUpdateStrategy | undefined; + /** + * minReadySeconds is the minimum number of seconds for which a newly created DaemonSet pod should + * be ready without any of its container crashing, for it to be considered + * available. Defaults to 0 (pod will be considered available as soon as it + * is ready). + * +optional + */ + minReadySeconds?: number | undefined; + /** + * templateGeneration is a sequence number representing a specific generation of the template, it is DEPRECATED. + * Populated by the system. It can be set only during the creation. + * +optional + */ + templateGeneration?: number | undefined; + /** + * revisionHistoryLimit is the number of old history to retain to allow rollback. + * This is a pointer to distinguish between explicit zero and not specified. + * Defaults to 10. + * +optional + */ + revisionHistoryLimit?: number | undefined; +} + +/** DaemonSetStatus represents the current status of a daemon set. */ +export interface DaemonSetStatus { + /** + * The number of nodes that are running at least 1 + * daemon pod and are supposed to run the daemon pod. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ + */ + currentNumberScheduled?: number | undefined; + /** + * The number of nodes that are running the daemon pod, but are + * not supposed to run the daemon pod. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ + */ + numberMisscheduled?: number | undefined; + /** + * The total number of nodes that should be running the daemon + * pod (including nodes correctly running the daemon pod). + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ + */ + desiredNumberScheduled?: number | undefined; + /** + * The number of nodes that should be running the daemon pod and have one + * or more of the daemon pod running and ready. + */ + numberReady?: number | undefined; + /** + * The most recent generation observed by the daemon set controller. + * +optional + */ + observedGeneration?: number | undefined; + /** + * The total number of nodes that are running updated daemon pod + * +optional + */ + updatedNumberScheduled?: number | undefined; + /** + * The number of nodes that should be running the + * daemon pod and have one or more of the daemon pod running and + * available (ready for at least spec.minReadySeconds) + * +optional + */ + numberAvailable?: number | undefined; + /** + * The number of nodes that should be running the + * daemon pod and have none of the daemon pod running and available + * (ready for at least spec.minReadySeconds) + * +optional + */ + numberUnavailable?: number | undefined; + /** + * Count of hash collisions for the DaemonSet. The DaemonSet controller + * uses this field as a collision avoidance mechanism when it needs to + * create the name for the newest ControllerRevision. + * +optional + */ + collisionCount?: number | undefined; + /** + * Represents the latest available observations of a DaemonSet's current state. + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: DaemonSetCondition[]; +} + +/** + * DaemonSetUpdateStrategy indicates the strategy that the DaemonSet + * controller will use to perform updates. It includes any additional parameters + * necessary to perform the update for the indicated strategy. + */ +export interface DaemonSetUpdateStrategy { + /** + * type is the type of daemon set update. Can be "RollingUpdate" or "OnDelete". + * Default is OnDelete. + * +optional + */ + type?: string | undefined; + /** + * rollingUpdate is the rolling update config params. Present only if type = "RollingUpdate". + * --- + * TODO: Update this to follow our convention for oneOf, whatever we decide it + * to be. Same as Deployment `strategy.rollingUpdate`. + * See https://github.com/kubernetes/kubernetes/issues/35345 + * +optional + */ + rollingUpdate?: RollingUpdateDaemonSet | undefined; +} + +/** + * DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for + * more information. + * Deployment enables declarative updates for Pods and ReplicaSets. + * +k8s:supportsSubresource="/status" + */ +export interface Deployment { + /** + * metadata is the standard object metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec is the specification of the desired behavior of the Deployment. + * +optional + */ + spec?: DeploymentSpec | undefined; + /** + * status is the most recently observed status of the Deployment. + * +optional + */ + status?: DeploymentStatus | undefined; +} + +/** DeploymentCondition describes the state of a deployment at a certain point. */ +export interface DeploymentCondition { + /** type is the type of deployment condition. */ + type?: string | undefined; + /** status is the status of the condition, one of True, False, Unknown. */ + status?: string | undefined; + /** lastUpdateTime is the last time this condition was updated. */ + lastUpdateTime?: Time | undefined; + /** lastTransitionTime is the last time the condition transitioned from one status to another. */ + lastTransitionTime?: Time | undefined; + /** reason is the reason for the condition's last transition. */ + reason?: string | undefined; + /** message is a human readable message indicating details about the transition. */ + message?: string | undefined; +} + +/** DeploymentList is a list of Deployments. */ +export interface DeploymentList { + /** + * Standard list metadata. + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is the list of Deployments. */ + items: Deployment[]; +} + +/** + * DEPRECATED. + * DeploymentRollback stores the information required to rollback a deployment. + */ +export interface DeploymentRollback { + /** name is required: This must match the Name of a deployment. */ + name?: string | undefined; + /** + * updatedAnnotations are the annotations to be updated to a deployment + * +optional + */ + updatedAnnotations: { [key: string]: string }; + /** rollbackTo is the config of this deployment rollback. */ + rollbackTo?: RollbackConfig | undefined; +} + +export interface DeploymentRollback_UpdatedAnnotationsEntry { + key: string; + value: string; +} + +/** DeploymentSpec is the specification of the desired behavior of the Deployment. */ +export interface DeploymentSpec { + /** + * replicas is the number of desired pods. This is a pointer to distinguish between explicit + * zero and not specified. Defaults to 1. + * +optional + */ + replicas?: number | undefined; + /** + * selector is the label selector for pods. Existing ReplicaSets whose pods are + * selected by this will be the ones affected by this deployment. + * +optional + */ + selector?: LabelSelector | undefined; + /** template describes the pods that will be created. */ + template?: PodTemplateSpec | undefined; + /** + * strategy is the deployment strategy to use to replace existing pods with new ones. + * +optional + * +patchStrategy=retainKeys + */ + strategy?: DeploymentStrategy | undefined; + /** + * minReadySeconds is the minimum number of seconds for which a newly created pod should be ready + * without any of its container crashing, for it to be considered available. + * Defaults to 0 (pod will be considered available as soon as it is ready) + * +optional + */ + minReadySeconds?: number | undefined; + /** + * revisionHistoryLimit is the number of old ReplicaSets to retain to allow rollback. + * This is a pointer to distinguish between explicit zero and not specified. + * This is set to the max value of int32 (i.e. 2147483647) by default, which + * means "retaining all old ReplicaSets". + * +optional + */ + revisionHistoryLimit?: number | undefined; + /** + * paused indicates that the deployment is paused and will not be processed by the + * deployment controller. + * +optional + */ + paused?: boolean | undefined; + /** + * rollbackTo is the config this deployment is rolling back to. Will be cleared after rollback is done. it is DEPRECATED. + * +optional + */ + rollbackTo?: RollbackConfig | undefined; + /** + * progressDeadlineSeconds is the maximum time in seconds for a deployment to make progress before it + * is considered to be failed. The deployment controller will continue to + * process failed deployments and a condition with a ProgressDeadlineExceeded + * reason will be surfaced in the deployment status. Note that progress will + * not be estimated during the time a deployment is paused. This is set to + * the max value of int32 (i.e. 2147483647) by default, which means "no deadline". + * +optional + */ + progressDeadlineSeconds?: number | undefined; +} + +/** DeploymentStatus is the most recently observed status of the Deployment. */ +export interface DeploymentStatus { + /** + * The generation observed by the deployment controller. + * +optional + */ + observedGeneration?: number | undefined; + /** + * Total number of non-terminating pods targeted by this deployment (their labels match the selector). + * +optional + */ + replicas?: number | undefined; + /** + * Total number of non-terminating pods targeted by this deployment that have the desired template spec. + * +optional + */ + updatedReplicas?: number | undefined; + /** + * Total number of non-terminating pods targeted by this Deployment with a Ready Condition. + * +optional + */ + readyReplicas?: number | undefined; + /** + * Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment. + * +optional + */ + availableReplicas?: number | undefined; + /** + * Total number of unavailable pods targeted by this deployment. This is the total number of + * pods that are still required for the deployment to have 100% available capacity. They may + * either be pods that are running but not yet available or pods that still have not been created. + * +optional + */ + unavailableReplicas?: number | undefined; + /** + * Total number of terminating pods targeted by this deployment. Terminating pods have a non-null + * .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase. + * + * This is a beta field and requires enabling DeploymentReplicaSetTerminatingReplicas feature (enabled by default). + * +optional + */ + terminatingReplicas?: number | undefined; + /** + * Represents the latest available observations of a deployment's current state. + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: DeploymentCondition[]; + /** + * Count of hash collisions for the Deployment. The Deployment controller uses this + * field as a collision avoidance mechanism when it needs to create the name for the + * newest ReplicaSet. + * +optional + */ + collisionCount?: number | undefined; +} + +/** DeploymentStrategy describes how to replace existing pods with new ones. */ +export interface DeploymentStrategy { + /** + * type is the type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate. + * +optional + */ + type?: string | undefined; + /** + * rollingUpdate is the rolling update config params. Present only if DeploymentStrategyType = + * RollingUpdate. + * --- + * TODO: Update this to follow our convention for oneOf, whatever we decide it + * to be. + * +optional + */ + rollingUpdate?: RollingUpdateDeployment | undefined; +} + +/** + * HTTPIngressPath associates a path with a backend. Incoming urls matching the + * path are forwarded to the backend. + */ +export interface HTTPIngressPath { + /** + * path is matched against the path of an incoming request. Currently it can + * contain characters disallowed from the conventional "path" part of a URL + * as defined by RFC 3986. Paths must begin with a '/'. When unspecified, + * all paths from incoming requests are matched. + * +optional + */ + path?: string | undefined; + /** + * pathType determines the interpretation of the Path matching. PathType can + * be one of the following values: + * * Exact: Matches the URL path exactly. + * * Prefix: Matches based on a URL path prefix split by '/'. Matching is + * done on a path element by element basis. A path element refers is the + * list of labels in the path split by the '/' separator. A request is a + * match for path p if every p is an element-wise prefix of p of the + * request path. Note that if the last element of the path is a substring + * of the last element in request path, it is not a match (e.g. /foo/bar + * matches /foo/bar/baz, but does not match /foo/barbaz). + * * ImplementationSpecific: Interpretation of the Path matching is up to + * the IngressClass. Implementations can treat this as a separate PathType + * or treat it identically to Prefix or Exact path types. + * Implementations are required to support all path types. + * Defaults to ImplementationSpecific. + */ + pathType?: string | undefined; + /** + * backend defines the referenced service endpoint to which the traffic + * will be forwarded to. + */ + backend?: IngressBackend | undefined; +} + +/** + * HTTPIngressRuleValue is a list of http selectors pointing to backends. + * In the example: http:///? -> backend where + * where parts of the url correspond to RFC 3986, this resource will be used + * to match against everything after the last '/' and before the first '?' + * or '#'. + */ +export interface HTTPIngressRuleValue { + /** + * paths is a collection of paths that map requests to backends. + * +listType=atomic + */ + paths: HTTPIngressPath[]; +} + +/** + * DEPRECATED 1.9 - This group version of IPBlock is deprecated by networking/v1/IPBlock. + * IPBlock describes a particular CIDR (Ex. "192.168.1.0/24","2001:db8::/64") that is allowed + * to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs + * that should not be included within this rule. + */ +export interface IPBlock { + /** + * cidr is a string representing the IP Block + * Valid examples are "192.168.1.0/24" or "2001:db8::/64" + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + cidr?: string | undefined; + /** + * except is a slice of CIDRs that should not be included within an IP Block + * Valid examples are "192.168.1.0/24" or "2001:db8::/64" + * Except values will be rejected if they are outside the CIDR range + * +optional + * +listType=atomic + */ + except: string[]; +} + +/** + * Ingress is a collection of rules that allow inbound connections to reach the + * endpoints defined by a backend. An Ingress can be configured to give services + * externally-reachable urls, load balance traffic, terminate SSL, offer name + * based virtual hosting etc. + * DEPRECATED - This group version of Ingress is deprecated by networking.k8s.io/v1beta1 Ingress. See the release notes for more information. + * +k8s:supportsSubresource="/status" + */ +export interface Ingress { + /** + * metadata is the standard object metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec is the desired state of the Ingress. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: IngressSpec | undefined; + /** + * status is the current state of the Ingress. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: IngressStatus | undefined; +} + +/** IngressBackend describes all endpoints for a given service and port. */ +export interface IngressBackend { + /** + * serviceName specifies the name of the referenced service. + * +optional + */ + serviceName?: string | undefined; + /** + * servicePort specifies the port of the referenced service. + * +optional + */ + servicePort?: IntOrString | undefined; + /** + * resource is an ObjectRef to another Kubernetes resource in the namespace + * of the Ingress object. If resource is specified, serviceName and servicePort + * must not be specified. + * +optional + */ + resource?: TypedLocalObjectReference | undefined; +} + +/** IngressList is a collection of Ingress. */ +export interface IngressList { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is the list of Ingress. */ + items: Ingress[]; +} + +/** IngressLoadBalancerIngress represents the status of a load-balancer ingress point. */ +export interface IngressLoadBalancerIngress { + /** + * ip is set for load-balancer ingress points that are IP based. + * +optional + */ + ip?: string | undefined; + /** + * hostname is set for load-balancer ingress points that are DNS based. + * +optional + */ + hostname?: string | undefined; + /** + * ports provides information about the ports exposed by this LoadBalancer. + * +listType=atomic + * +optional + */ + ports: IngressPortStatus[]; +} + +/** LoadBalancerStatus represents the status of a load-balancer. */ +export interface IngressLoadBalancerStatus { + /** + * ingress is a list containing ingress points for the load-balancer. + * +optional + * +listType=atomic + */ + ingress: IngressLoadBalancerIngress[]; +} + +/** IngressPortStatus represents the error condition of a service port */ +export interface IngressPortStatus { + /** port is the port number of the ingress port. */ + port?: number | undefined; + /** + * protocol is the protocol of the ingress port. + * The supported values are: "TCP", "UDP", "SCTP" + */ + protocol?: string | undefined; + /** + * error is to record the problem with the service port + * The format of the error shall comply with the following rules: + * - built-in error values shall be specified in this file and those shall use + * CamelCase names + * - cloud provider specific error values must have names that comply with the + * format foo.example.com/CamelCase. + * --- + * The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + * +optional + * +kubebuilder:validation:Required + * +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)* /)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` + * +kubebuilder:validation:MaxLength=316 + */ + error?: string | undefined; +} + +/** + * IngressRule represents the rules mapping the paths under a specified host to + * the related backend services. Incoming requests are first evaluated for a host + * match, then routed to the backend associated with the matching IngressRuleValue. + */ +export interface IngressRule { + /** + * host is the fully qualified domain name of a network host, as defined by RFC 3986. + * Note the following deviations from the "host" part of the + * URI as defined in RFC 3986: + * 1. IPs are not allowed. Currently an IngressRuleValue can only apply to + * the IP in the Spec of the parent Ingress. + * 2. The `:` delimiter is not respected because ports are not allowed. + * Currently the port of an Ingress is implicitly :80 for http and + * :443 for https. + * Both these may change in the future. + * Incoming requests are matched against the host before the + * IngressRuleValue. If the host is unspecified, the Ingress routes all + * traffic based on the specified IngressRuleValue. + * + * Host can be "precise" which is a domain name without the terminating dot of + * a network host (e.g. "foo.bar.com") or "wildcard", which is a domain name + * prefixed with a single wildcard label (e.g. "*.foo.com"). + * The wildcard character '*' must appear by itself as the first DNS label and + * matches only a single label. You cannot have a wildcard label by itself (e.g. Host == "*"). + * Requests will be matched against the Host field in the following way: + * 1. If Host is precise, the request matches this rule if the http host header is equal to Host. + * 2. If Host is a wildcard, then the request matches this rule if the http host header + * is to equal to the suffix (removing the first label) of the wildcard rule. + * +optional + */ + host?: string | undefined; + /** + * IngressRuleValue represents a rule to route requests for this IngressRule. + * If unspecified, the rule defaults to a http catch-all. Whether that sends + * just traffic matching the host to the default backend or all traffic to the + * default backend, is left to the controller fulfilling the Ingress. Http is + * currently the only supported IngressRuleValue. + * +optional + */ + ingressRuleValue?: IngressRuleValue | undefined; +} + +/** + * IngressRuleValue represents a rule to apply against incoming requests. If the + * rule is satisfied, the request is routed to the specified backend. Currently + * mixing different types of rules in a single Ingress is disallowed, so exactly + * one of the following must be set. + */ +export interface IngressRuleValue { + /** + * http is a list of http selectors pointing to backends. + * A path is matched against the path of an incoming request. Currently it can + * contain characters disallowed from the conventional "path" part of a URL + * as defined by RFC 3986. Paths must begin with a '/'. + * A backend defines the referenced service endpoint to which the traffic + * will be forwarded to. + */ + http?: HTTPIngressRuleValue | undefined; +} + +/** IngressSpec describes the Ingress the user wishes to exist. */ +export interface IngressSpec { + /** + * ingressClassName is the name of the IngressClass cluster resource. The + * associated IngressClass defines which controller will implement the + * resource. This replaces the deprecated `kubernetes.io/ingress.class` + * annotation. For backwards compatibility, when that annotation is set, it + * must be given precedence over this field. The controller may emit a + * warning if the field and annotation have different values. + * Implementations of this API should ignore Ingresses without a class + * specified. An IngressClass resource may be marked as default, which can + * be used to set a default value for this field. For more information, + * refer to the IngressClass documentation. + * +optional + */ + ingressClassName?: string | undefined; + /** + * backend is a default backend capable of servicing requests that don't match any + * rule. At least one of 'backend' or 'rules' must be specified. This field + * is optional to allow the loadbalancer controller or defaulting logic to + * specify a global default. + * +optional + */ + backend?: IngressBackend | undefined; + /** + * tls is TLS configuration. Currently the Ingress only supports a single TLS + * port, 443. If multiple members of this list specify different hosts, they + * will be multiplexed on the same port according to the hostname specified + * through the SNI TLS extension, if the ingress controller fulfilling the + * ingress supports SNI. + * +optional + * +listType=atomic + */ + tls: IngressTLS[]; + /** + * rules is a list of host rules used to configure the Ingress. If unspecified, or + * no rule matches, all traffic is sent to the default backend. + * +optional + * +listType=atomic + */ + rules: IngressRule[]; +} + +/** ingressStatus describe the current state of the Ingress. */ +export interface IngressStatus { + /** + * loadBalancer contains the current status of the load-balancer. + * +optional + */ + loadBalancer?: IngressLoadBalancerStatus | undefined; +} + +/** IngressTLS describes the transport layer security associated with an Ingress. */ +export interface IngressTLS { + /** + * hosts are a list of hosts included in the TLS certificate. The values in + * this list must match the name/s used in the tlsSecret. Defaults to the + * wildcard host setting for the loadbalancer controller fulfilling this + * Ingress, if left unspecified. + * +optional + * +listType=atomic + */ + hosts: string[]; + /** + * secretName is the name of the secret used to terminate SSL traffic on 443. + * Field is left optional to allow SSL routing based on SNI hostname alone. + * If the SNI host in a listener conflicts with the "Host" header field used + * by an IngressRule, the SNI host is used for termination and value of the + * Host header is used for routing. + * +optional + */ + secretName?: string | undefined; +} + +/** + * DEPRECATED 1.9 - This group version of NetworkPolicy is deprecated by networking/v1/NetworkPolicy. + * NetworkPolicy describes what network traffic is allowed for a set of Pods + */ +export interface NetworkPolicy { + /** + * metadata is the standard object metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec is the specification of the desired behavior for this NetworkPolicy. + * +optional + */ + spec?: NetworkPolicySpec | undefined; +} + +/** + * DEPRECATED 1.9 - This group version of NetworkPolicyEgressRule is deprecated by networking/v1/NetworkPolicyEgressRule. + * NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods + * matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to. + * This type is beta-level in 1.8 + */ +export interface NetworkPolicyEgressRule { + /** + * ports is the list of destination ports for outgoing traffic. + * Each item in this list is combined using a logical OR. If this field is + * empty or missing, this rule matches all ports (traffic not restricted by port). + * If this field is present and contains at least one item, then this rule allows + * traffic only if the traffic matches at least one port in the list. + * +optional + * +listType=atomic + */ + ports: NetworkPolicyPort[]; + /** + * to is the list of destinations for outgoing traffic of pods selected for this rule. + * Items in this list are combined using a logical OR operation. If this field is + * empty or missing, this rule matches all destinations (traffic not restricted by + * destination). If this field is present and contains at least one item, this rule + * allows traffic only if the traffic matches at least one item in the to list. + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + to: NetworkPolicyPeer[]; +} + +/** + * DEPRECATED 1.9 - This group version of NetworkPolicyIngressRule is deprecated by networking/v1/NetworkPolicyIngressRule. + * This NetworkPolicyIngressRule matches traffic if and only if the traffic matches both ports AND from. + */ +export interface NetworkPolicyIngressRule { + /** + * ports is the list of ports which should be made accessible on the pods selected for this rule. + * Each item in this list is combined using a logical OR. + * If this field is empty or missing, this rule matches all ports (traffic not restricted by port). + * If this field is present and contains at least one item, then this rule allows traffic + * only if the traffic matches at least one port in the list. + * +optional + * +listType=atomic + */ + ports: NetworkPolicyPort[]; + /** + * from is the list of sources which should be able to access the pods selected for this rule. + * Items in this list are combined using a logical OR operation. + * If this field is empty or missing, this rule matches all sources (traffic not restricted by source). + * If this field is present and contains at least one item, this rule allows traffic only if the + * traffic matches at least one item in the from list. + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + from: NetworkPolicyPeer[]; +} + +/** + * DEPRECATED 1.9 - This group version of NetworkPolicyList is deprecated by networking/v1/NetworkPolicyList. + * Network Policy List is a list of NetworkPolicy objects. + */ +export interface NetworkPolicyList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is a list of schema objects. */ + items: NetworkPolicy[]; +} + +/** DEPRECATED 1.9 - This group version of NetworkPolicyPeer is deprecated by networking/v1/NetworkPolicyPeer. */ +export interface NetworkPolicyPeer { + /** + * podSelector is a label selector which selects Pods. This field follows standard label + * selector semantics; if present but empty, it selects all pods. + * + * If NamespaceSelector is also set, then the NetworkPolicyPeer as a whole selects + * the Pods matching PodSelector in the Namespaces selected by NamespaceSelector. + * Otherwise it selects the Pods matching PodSelector in the policy's own Namespace. + * +optional + */ + podSelector?: LabelSelector | undefined; + /** + * namespaceSelector selects Namespaces using cluster-scoped labels. This field follows standard label + * selector semantics; if present but empty, it selects all namespaces. + * + * If PodSelector is also set, then the NetworkPolicyPeer as a whole selects + * the Pods matching PodSelector in the Namespaces selected by NamespaceSelector. + * Otherwise it selects all Pods in the Namespaces selected by NamespaceSelector. + * +optional + */ + namespaceSelector?: LabelSelector | undefined; + /** + * ipBlock defines policy on a particular IPBlock. If this field is set then + * neither of the other fields can be. + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + */ + ipBlock?: IPBlock | undefined; +} + +/** DEPRECATED 1.9 - This group version of NetworkPolicyPort is deprecated by networking/v1/NetworkPolicyPort. */ +export interface NetworkPolicyPort { + /** + * protocol is the protocol (TCP, UDP, or SCTP) which traffic must match. + * If not specified, this field defaults to TCP. + * +optional + */ + protocol?: string | undefined; + /** + * port is the port on the given protocol. This can either be a numerical or named + * port on a pod. If this field is not provided, this matches all port names and + * numbers. + * If present, only traffic on the specified protocol AND port will be matched. + * +optional + */ + port?: IntOrString | undefined; + /** + * endPort indicates that the range of ports from port to endPort, inclusive, + * should be allowed by the policy. This field cannot be defined if the port field + * is not defined or if the port field is defined as a named (string) port. + * The endPort must be equal or greater than port. + * +optional + */ + endPort?: number | undefined; +} + +/** DEPRECATED 1.9 - This group version of NetworkPolicySpec is deprecated by networking/v1/NetworkPolicySpec. */ +export interface NetworkPolicySpec { + /** + * podSelector selects the pods to which this NetworkPolicy object applies. The array of ingress rules + * is applied to any pods selected by this field. Multiple network policies can select the + * same set of pods. In this case, the ingress rules for each are combined additively. + * This field is NOT optional and follows standard label selector semantics. + * An empty podSelector matches all pods in this namespace. + */ + podSelector?: LabelSelector | undefined; + /** + * ingress is the list of ingress rules to be applied to the selected pods. + * Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod + * OR if the traffic source is the pod's local node, + * OR if the traffic matches at least one ingress rule across all of the NetworkPolicy + * objects whose podSelector matches the pod. + * If this field is empty then this NetworkPolicy does not allow any traffic + * (and serves solely to ensure that the pods it selects are isolated by default). + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + ingress: NetworkPolicyIngressRule[]; + /** + * egress is the list of egress rules to be applied to the selected pods. Outgoing traffic is + * allowed if there are no NetworkPolicies selecting the pod (and cluster policy + * otherwise allows the traffic), OR if the traffic matches at least one egress rule + * across all of the NetworkPolicy objects whose podSelector matches the pod. If + * this field is empty then this NetworkPolicy limits all outgoing traffic (and serves + * solely to ensure that the pods it selects are isolated by default). + * This field is beta-level in 1.8 + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + egress: NetworkPolicyEgressRule[]; + /** + * policyTypes is the list of rule types that the NetworkPolicy relates to. + * Valid options are ["Ingress"], ["Egress"], or ["Ingress", "Egress"]. + * If this field is not specified, it will default based on the existence of Ingress or Egress rules; + * policies that contain an Egress section are assumed to affect Egress, and all policies + * (whether or not they contain an Ingress section) are assumed to affect Ingress. + * If you want to write an egress-only policy, you must explicitly specify policyTypes [ "Egress" ]. + * Likewise, if you want to write a policy that specifies that no egress is allowed, + * you must specify a policyTypes value that include "Egress" (since such a policy would not include + * an Egress section and would otherwise default to just [ "Ingress" ]). + * This field is beta-level in 1.8 + * +optional + * +listType=atomic + */ + policyTypes: string[]; +} + +/** + * DEPRECATED - This group version of ReplicaSet is deprecated by apps/v1beta2/ReplicaSet. See the release notes for + * more information. + * ReplicaSet ensures that a specified number of pod replicas are running at any given time. + * +k8s:supportsSubresource="/status" + */ +export interface ReplicaSet { + /** + * metadata is the standard object metadata. + * If the Labels of a ReplicaSet are empty, they are defaulted to + * be the same as the Pod(s) that the ReplicaSet manages. + * Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec defines the specification of the desired behavior of the ReplicaSet. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: ReplicaSetSpec | undefined; + /** + * status is the most recently observed status of the ReplicaSet. + * This data may be out of date by some window of time. + * Populated by the system. + * Read-only. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: ReplicaSetStatus | undefined; +} + +/** ReplicaSetCondition describes the state of a replica set at a certain point. */ +export interface ReplicaSetCondition { + /** type of replica set condition. */ + type?: string | undefined; + /** status of the condition, one of True, False, Unknown. */ + status?: string | undefined; + /** + * lastTransitionTime is the last time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * reason is the reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * message is a human readable message indicating details about the transition. + * +optional + */ + message?: string | undefined; +} + +/** ReplicaSetList is a collection of ReplicaSets. */ +export interface ReplicaSetList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: ListMeta | undefined; + /** + * List of ReplicaSets. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset + */ + items: ReplicaSet[]; +} + +/** ReplicaSetSpec is the specification of a ReplicaSet. */ +export interface ReplicaSetSpec { + /** + * replicas is the number of desired pods. + * This is a pointer to distinguish between explicit zero and unspecified. + * Defaults to 1. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset + * +optional + */ + replicas?: number | undefined; + /** + * minReadySeconds is the minimum number of seconds for which a newly created pod should be ready + * without any of its container crashing, for it to be considered available. + * Defaults to 0 (pod will be considered available as soon as it is ready) + * +optional + */ + minReadySeconds?: number | undefined; + /** + * selector is a label query over pods that should match the replica count. + * If the selector is empty, it is defaulted to the labels present on the pod template. + * Label keys and values that must match in order to be controlled by this replica set. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + * +optional + */ + selector?: LabelSelector | undefined; + /** + * template is the object that describes the pod that will be created if + * insufficient replicas are detected. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/#pod-template + * +optional + */ + template?: PodTemplateSpec | undefined; +} + +/** ReplicaSetStatus represents the current status of a ReplicaSet. */ +export interface ReplicaSetStatus { + /** + * Replicas is the most recently observed number of non-terminating pods. + * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset + */ + replicas?: number | undefined; + /** + * The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset. + * +optional + */ + fullyLabeledReplicas?: number | undefined; + /** + * The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition. + * +optional + */ + readyReplicas?: number | undefined; + /** + * The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set. + * +optional + */ + availableReplicas?: number | undefined; + /** + * The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp + * and have not yet reached the Failed or Succeeded .status.phase. + * + * This is a beta field and requires enabling DeploymentReplicaSetTerminatingReplicas feature (enabled by default). + * +optional + */ + terminatingReplicas?: number | undefined; + /** + * ObservedGeneration reflects the generation of the most recently observed ReplicaSet. + * +optional + */ + observedGeneration?: number | undefined; + /** + * Represents the latest available observations of a replica set's current state. + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + */ + conditions: ReplicaSetCondition[]; +} + +/** DEPRECATED. */ +export interface RollbackConfig { + /** + * revision is the revision to rollback to. If set to 0, rollback to the last revision. + * +optional + */ + revision?: number | undefined; +} + +/** Spec to control the desired behavior of daemon set rolling update. */ +export interface RollingUpdateDaemonSet { + /** + * maxUnavailable is the maximum number of DaemonSet pods that can be unavailable during the + * update. Value can be an absolute number (ex: 5) or a percentage of total + * number of DaemonSet pods at the start of the update (ex: 10%). Absolute + * number is calculated from percentage by rounding up. + * This cannot be 0 if MaxSurge is 0 + * Default value is 1. + * Example: when this is set to 30%, at most 30% of the total number of nodes + * that should be running the daemon pod (i.e. status.desiredNumberScheduled) + * can have their pods stopped for an update at any given time. The update + * starts by stopping at most 30% of those DaemonSet pods and then brings + * up new DaemonSet pods in their place. Once the new pods are available, + * it then proceeds onto other DaemonSet pods, thus ensuring that at least + * 70% of original number of DaemonSet pods are available at all times during + * the update. + * +optional + */ + maxUnavailable?: IntOrString | undefined; + /** + * maxSurge is the maximum number of nodes with an existing available DaemonSet pod that + * can have an updated DaemonSet pod during during an update. + * Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). + * This can not be 0 if MaxUnavailable is 0. + * Absolute number is calculated from percentage by rounding up to a minimum of 1. + * Default value is 0. + * Example: when this is set to 30%, at most 30% of the total number of nodes + * that should be running the daemon pod (i.e. status.desiredNumberScheduled) + * can have their a new pod created before the old pod is marked as deleted. + * The update starts by launching new pods on 30% of nodes. Once an updated + * pod is available (Ready for at least minReadySeconds) the old DaemonSet pod + * on that node is marked deleted. If the old pod becomes unavailable for any + * reason (Ready transitions to false, is evicted, or is drained) an updated + * pod is immediately created on that node without considering surge limits. + * Allowing surge implies the possibility that the resources consumed by the + * daemonset on any given node can double if the readiness check fails, and + * so resource intensive daemonsets should take into account that they may + * cause evictions during disruption. + * This is an alpha field and requires enabling DaemonSetUpdateSurge feature gate. + * +optional + */ + maxSurge?: IntOrString | undefined; +} + +/** Spec to control the desired behavior of rolling update. */ +export interface RollingUpdateDeployment { + /** + * maxUnavailable is the maximum number of pods that can be unavailable during the update. + * Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). + * Absolute number is calculated from percentage by rounding down. + * This can not be 0 if MaxSurge is 0. + * By default, a fixed value of 1 is used. + * Example: when this is set to 30%, the old RC can be scaled down to 70% of desired pods + * immediately when the rolling update starts. Once new pods are ready, old RC + * can be scaled down further, followed by scaling up the new RC, ensuring + * that the total number of pods available at all times during the update is at + * least 70% of desired pods. + * +optional + */ + maxUnavailable?: IntOrString | undefined; + /** + * maxSurge is the maximum number of pods that can be scheduled above the desired number of + * pods. + * Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). + * This can not be 0 if MaxUnavailable is 0. + * Absolute number is calculated from percentage by rounding up. + * By default, a value of 1 is used. + * Example: when this is set to 30%, the new RC can be scaled up immediately when + * the rolling update starts, such that the total number of old and new pods do not exceed + * 130% of desired pods. Once old pods have been killed, + * new RC can be scaled up further, ensuring that total number of pods running + * at any time during the update is at most 130% of desired pods. + * +optional + */ + maxSurge?: IntOrString | undefined; +} + +/** represents a scaling request for a resource. */ +export interface Scale { + /** + * metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. + * +optional + */ + spec?: ScaleSpec | undefined; + /** + * status is current status of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. Read-only. + * +optional + */ + status?: ScaleStatus | undefined; +} + +/** describes the attributes of a scale subresource */ +export interface ScaleSpec { + /** + * replicas is the desired number of instances for the scaled object. + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +default=0 + * +k8s:beta(since: "1.37")=+k8s:minimum=0 + */ + replicas?: number | undefined; +} + +/** represents the current status of a scale subresource. */ +export interface ScaleStatus { + /** replicas is the actual number of observed instances of the scaled object. */ + replicas?: number | undefined; + /** + * selector is a label query over pods that should match the replicas count. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + * +optional + * +mapType=atomic + */ + selector: { [key: string]: string }; + /** + * targetSelector is the label selector for pods that should match the replicas count. This is a serializated + * version of both map-based and more expressive set-based selectors. This is done to + * avoid introspection in the clients. The string will be in the same format as the + * query-param syntax. If the target type only supports map-based selectors, both this + * field and map-based selector field are populated. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + * +optional + */ + targetSelector?: string | undefined; +} + +export interface ScaleStatus_SelectorEntry { + key: string; + value: string; +} + +function createBaseDaemonSet(): DaemonSet { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const DaemonSet: MessageFns = { + encode(message: DaemonSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + DaemonSetSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + DaemonSetStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = DaemonSetSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = DaemonSetStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonSet { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? DaemonSetSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? DaemonSetStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: DaemonSet): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = DaemonSetSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = DaemonSetStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): DaemonSet { + return DaemonSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DaemonSet { + const message = createBaseDaemonSet(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? DaemonSetSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? DaemonSetStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseDaemonSetCondition(): DaemonSetCondition { + return { type: '', status: '', lastTransitionTime: undefined, reason: '', message: '' }; +} + +export const DaemonSetCondition: MessageFns = { + encode(message: DaemonSetCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(26).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(42).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonSetCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonSetCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonSetCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: DaemonSetCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): DaemonSetCondition { + return DaemonSetCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DaemonSetCondition { + const message = createBaseDaemonSetCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseDaemonSetList(): DaemonSetList { + return { metadata: undefined, items: [] }; +} + +export const DaemonSetList: MessageFns = { + encode(message: DaemonSetList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + DaemonSet.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonSetList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonSetList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(DaemonSet.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonSetList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => DaemonSet.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DaemonSetList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => DaemonSet.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DaemonSetList { + return DaemonSetList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DaemonSetList { + const message = createBaseDaemonSetList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => DaemonSet.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDaemonSetSpec(): DaemonSetSpec { + return { + selector: undefined, + template: undefined, + updateStrategy: undefined, + minReadySeconds: 0, + templateGeneration: 0, + revisionHistoryLimit: 0, + }; +} + +export const DaemonSetSpec: MessageFns = { + encode(message: DaemonSetSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(10).fork()).join(); + } + if (message.template !== undefined) { + PodTemplateSpec.encode(message.template, writer.uint32(18).fork()).join(); + } + if (message.updateStrategy !== undefined) { + DaemonSetUpdateStrategy.encode(message.updateStrategy, writer.uint32(26).fork()).join(); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + writer.uint32(32).int32(message.minReadySeconds); + } + if (message.templateGeneration !== undefined && message.templateGeneration !== 0) { + writer.uint32(40).int64(message.templateGeneration); + } + if (message.revisionHistoryLimit !== undefined && message.revisionHistoryLimit !== 0) { + writer.uint32(48).int32(message.revisionHistoryLimit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonSetSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonSetSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.template = PodTemplateSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.updateStrategy = DaemonSetUpdateStrategy.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.minReadySeconds = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.templateGeneration = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.revisionHistoryLimit = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonSetSpec { + return { + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + template: isSet(object.template) ? PodTemplateSpec.fromJSON(object.template) : undefined, + updateStrategy: isSet(object.updateStrategy) + ? DaemonSetUpdateStrategy.fromJSON(object.updateStrategy) + : undefined, + minReadySeconds: isSet(object.minReadySeconds) ? globalThis.Number(object.minReadySeconds) : 0, + templateGeneration: isSet(object.templateGeneration) + ? globalThis.Number(object.templateGeneration) + : 0, + revisionHistoryLimit: isSet(object.revisionHistoryLimit) + ? globalThis.Number(object.revisionHistoryLimit) + : 0, + }; + }, + + toJSON(message: DaemonSetSpec): unknown { + const obj: any = {}; + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.template !== undefined) { + obj.template = PodTemplateSpec.toJSON(message.template); + } + if (message.updateStrategy !== undefined) { + obj.updateStrategy = DaemonSetUpdateStrategy.toJSON(message.updateStrategy); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + obj.minReadySeconds = Math.round(message.minReadySeconds); + } + if (message.templateGeneration !== undefined && message.templateGeneration !== 0) { + obj.templateGeneration = Math.round(message.templateGeneration); + } + if (message.revisionHistoryLimit !== undefined && message.revisionHistoryLimit !== 0) { + obj.revisionHistoryLimit = Math.round(message.revisionHistoryLimit); + } + return obj; + }, + + create, I>>(base?: I): DaemonSetSpec { + return DaemonSetSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DaemonSetSpec { + const message = createBaseDaemonSetSpec(); + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.template = + object.template !== undefined && object.template !== null + ? PodTemplateSpec.fromPartial(object.template) + : undefined; + message.updateStrategy = + object.updateStrategy !== undefined && object.updateStrategy !== null + ? DaemonSetUpdateStrategy.fromPartial(object.updateStrategy) + : undefined; + message.minReadySeconds = object.minReadySeconds ?? 0; + message.templateGeneration = object.templateGeneration ?? 0; + message.revisionHistoryLimit = object.revisionHistoryLimit ?? 0; + return message; + }, +}; + +function createBaseDaemonSetStatus(): DaemonSetStatus { + return { + currentNumberScheduled: 0, + numberMisscheduled: 0, + desiredNumberScheduled: 0, + numberReady: 0, + observedGeneration: 0, + updatedNumberScheduled: 0, + numberAvailable: 0, + numberUnavailable: 0, + collisionCount: 0, + conditions: [], + }; +} + +export const DaemonSetStatus: MessageFns = { + encode(message: DaemonSetStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.currentNumberScheduled !== undefined && message.currentNumberScheduled !== 0) { + writer.uint32(8).int32(message.currentNumberScheduled); + } + if (message.numberMisscheduled !== undefined && message.numberMisscheduled !== 0) { + writer.uint32(16).int32(message.numberMisscheduled); + } + if (message.desiredNumberScheduled !== undefined && message.desiredNumberScheduled !== 0) { + writer.uint32(24).int32(message.desiredNumberScheduled); + } + if (message.numberReady !== undefined && message.numberReady !== 0) { + writer.uint32(32).int32(message.numberReady); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(40).int64(message.observedGeneration); + } + if (message.updatedNumberScheduled !== undefined && message.updatedNumberScheduled !== 0) { + writer.uint32(48).int32(message.updatedNumberScheduled); + } + if (message.numberAvailable !== undefined && message.numberAvailable !== 0) { + writer.uint32(56).int32(message.numberAvailable); + } + if (message.numberUnavailable !== undefined && message.numberUnavailable !== 0) { + writer.uint32(64).int32(message.numberUnavailable); + } + if (message.collisionCount !== undefined && message.collisionCount !== 0) { + writer.uint32(72).int32(message.collisionCount); + } + for (const v of message.conditions) { + DaemonSetCondition.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonSetStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonSetStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.currentNumberScheduled = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.numberMisscheduled = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.desiredNumberScheduled = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.numberReady = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.updatedNumberScheduled = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.numberAvailable = reader.int32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.numberUnavailable = reader.int32(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.collisionCount = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.conditions.push(DaemonSetCondition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonSetStatus { + return { + currentNumberScheduled: isSet(object.currentNumberScheduled) + ? globalThis.Number(object.currentNumberScheduled) + : 0, + numberMisscheduled: isSet(object.numberMisscheduled) + ? globalThis.Number(object.numberMisscheduled) + : 0, + desiredNumberScheduled: isSet(object.desiredNumberScheduled) + ? globalThis.Number(object.desiredNumberScheduled) + : 0, + numberReady: isSet(object.numberReady) ? globalThis.Number(object.numberReady) : 0, + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + updatedNumberScheduled: isSet(object.updatedNumberScheduled) + ? globalThis.Number(object.updatedNumberScheduled) + : 0, + numberAvailable: isSet(object.numberAvailable) ? globalThis.Number(object.numberAvailable) : 0, + numberUnavailable: isSet(object.numberUnavailable) + ? globalThis.Number(object.numberUnavailable) + : 0, + collisionCount: isSet(object.collisionCount) ? globalThis.Number(object.collisionCount) : 0, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => DaemonSetCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DaemonSetStatus): unknown { + const obj: any = {}; + if (message.currentNumberScheduled !== undefined && message.currentNumberScheduled !== 0) { + obj.currentNumberScheduled = Math.round(message.currentNumberScheduled); + } + if (message.numberMisscheduled !== undefined && message.numberMisscheduled !== 0) { + obj.numberMisscheduled = Math.round(message.numberMisscheduled); + } + if (message.desiredNumberScheduled !== undefined && message.desiredNumberScheduled !== 0) { + obj.desiredNumberScheduled = Math.round(message.desiredNumberScheduled); + } + if (message.numberReady !== undefined && message.numberReady !== 0) { + obj.numberReady = Math.round(message.numberReady); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.updatedNumberScheduled !== undefined && message.updatedNumberScheduled !== 0) { + obj.updatedNumberScheduled = Math.round(message.updatedNumberScheduled); + } + if (message.numberAvailable !== undefined && message.numberAvailable !== 0) { + obj.numberAvailable = Math.round(message.numberAvailable); + } + if (message.numberUnavailable !== undefined && message.numberUnavailable !== 0) { + obj.numberUnavailable = Math.round(message.numberUnavailable); + } + if (message.collisionCount !== undefined && message.collisionCount !== 0) { + obj.collisionCount = Math.round(message.collisionCount); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => DaemonSetCondition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DaemonSetStatus { + return DaemonSetStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DaemonSetStatus { + const message = createBaseDaemonSetStatus(); + message.currentNumberScheduled = object.currentNumberScheduled ?? 0; + message.numberMisscheduled = object.numberMisscheduled ?? 0; + message.desiredNumberScheduled = object.desiredNumberScheduled ?? 0; + message.numberReady = object.numberReady ?? 0; + message.observedGeneration = object.observedGeneration ?? 0; + message.updatedNumberScheduled = object.updatedNumberScheduled ?? 0; + message.numberAvailable = object.numberAvailable ?? 0; + message.numberUnavailable = object.numberUnavailable ?? 0; + message.collisionCount = object.collisionCount ?? 0; + message.conditions = object.conditions?.map((e) => DaemonSetCondition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDaemonSetUpdateStrategy(): DaemonSetUpdateStrategy { + return { type: '', rollingUpdate: undefined }; +} + +export const DaemonSetUpdateStrategy: MessageFns = { + encode(message: DaemonSetUpdateStrategy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.rollingUpdate !== undefined) { + RollingUpdateDaemonSet.encode(message.rollingUpdate, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DaemonSetUpdateStrategy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDaemonSetUpdateStrategy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.rollingUpdate = RollingUpdateDaemonSet.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DaemonSetUpdateStrategy { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + rollingUpdate: isSet(object.rollingUpdate) + ? RollingUpdateDaemonSet.fromJSON(object.rollingUpdate) + : undefined, + }; + }, + + toJSON(message: DaemonSetUpdateStrategy): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.rollingUpdate !== undefined) { + obj.rollingUpdate = RollingUpdateDaemonSet.toJSON(message.rollingUpdate); + } + return obj; + }, + + create, I>>(base?: I): DaemonSetUpdateStrategy { + return DaemonSetUpdateStrategy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): DaemonSetUpdateStrategy { + const message = createBaseDaemonSetUpdateStrategy(); + message.type = object.type ?? ''; + message.rollingUpdate = + object.rollingUpdate !== undefined && object.rollingUpdate !== null + ? RollingUpdateDaemonSet.fromPartial(object.rollingUpdate) + : undefined; + return message; + }, +}; + +function createBaseDeployment(): Deployment { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const Deployment: MessageFns = { + encode(message: Deployment, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + DeploymentSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + DeploymentStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deployment { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeployment(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = DeploymentSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = DeploymentStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Deployment { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? DeploymentSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? DeploymentStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: Deployment): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = DeploymentSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = DeploymentStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): Deployment { + return Deployment.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Deployment { + const message = createBaseDeployment(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? DeploymentSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? DeploymentStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseDeploymentCondition(): DeploymentCondition { + return { + type: '', + status: '', + lastUpdateTime: undefined, + lastTransitionTime: undefined, + reason: '', + message: '', + }; +} + +export const DeploymentCondition: MessageFns = { + encode(message: DeploymentCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastUpdateTime !== undefined) { + Time.encode(message.lastUpdateTime, writer.uint32(50).fork()).join(); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(58).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(42).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeploymentCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeploymentCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.lastUpdateTime = Time.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeploymentCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastUpdateTime: isSet(object.lastUpdateTime) ? Time.fromJSON(object.lastUpdateTime) : undefined, + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: DeploymentCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastUpdateTime !== undefined) { + obj.lastUpdateTime = Time.toJSON(message.lastUpdateTime); + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): DeploymentCondition { + return DeploymentCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeploymentCondition { + const message = createBaseDeploymentCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastUpdateTime = + object.lastUpdateTime !== undefined && object.lastUpdateTime !== null + ? Time.fromPartial(object.lastUpdateTime) + : undefined; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseDeploymentList(): DeploymentList { + return { metadata: undefined, items: [] }; +} + +export const DeploymentList: MessageFns = { + encode(message: DeploymentList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Deployment.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeploymentList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeploymentList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Deployment.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeploymentList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Deployment.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DeploymentList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Deployment.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DeploymentList { + return DeploymentList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeploymentList { + const message = createBaseDeploymentList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Deployment.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDeploymentRollback(): DeploymentRollback { + return { name: '', updatedAnnotations: {}, rollbackTo: undefined }; +} + +export const DeploymentRollback: MessageFns = { + encode(message: DeploymentRollback, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + globalThis.Object.entries(message.updatedAnnotations).forEach(([key, value]: [string, string]) => { + DeploymentRollback_UpdatedAnnotationsEntry.encode( + { key: key as any, value }, + writer.uint32(18).fork(), + ).join(); + }); + if (message.rollbackTo !== undefined) { + RollbackConfig.encode(message.rollbackTo, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeploymentRollback { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeploymentRollback(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = DeploymentRollback_UpdatedAnnotationsEntry.decode( + reader, + reader.uint32(), + ); + if (entry2.value !== undefined) { + message.updatedAnnotations[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.rollbackTo = RollbackConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeploymentRollback { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + updatedAnnotations: isObject(object.updatedAnnotations) + ? (globalThis.Object.entries(object.updatedAnnotations) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + rollbackTo: isSet(object.rollbackTo) ? RollbackConfig.fromJSON(object.rollbackTo) : undefined, + }; + }, + + toJSON(message: DeploymentRollback): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.updatedAnnotations) { + const entries = globalThis.Object.entries(message.updatedAnnotations) as [string, string][]; + if (entries.length > 0) { + obj.updatedAnnotations = {}; + entries.forEach(([k, v]) => { + obj.updatedAnnotations[k] = v; + }); + } + } + if (message.rollbackTo !== undefined) { + obj.rollbackTo = RollbackConfig.toJSON(message.rollbackTo); + } + return obj; + }, + + create, I>>(base?: I): DeploymentRollback { + return DeploymentRollback.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeploymentRollback { + const message = createBaseDeploymentRollback(); + message.name = object.name ?? ''; + message.updatedAnnotations = ( + globalThis.Object.entries(object.updatedAnnotations ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.rollbackTo = + object.rollbackTo !== undefined && object.rollbackTo !== null + ? RollbackConfig.fromPartial(object.rollbackTo) + : undefined; + return message; + }, +}; + +function createBaseDeploymentRollback_UpdatedAnnotationsEntry(): DeploymentRollback_UpdatedAnnotationsEntry { + return { key: '', value: '' }; +} + +export const DeploymentRollback_UpdatedAnnotationsEntry: MessageFns = + { + encode( + message: DeploymentRollback_UpdatedAnnotationsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): DeploymentRollback_UpdatedAnnotationsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeploymentRollback_UpdatedAnnotationsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeploymentRollback_UpdatedAnnotationsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: DeploymentRollback_UpdatedAnnotationsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): DeploymentRollback_UpdatedAnnotationsEntry { + return DeploymentRollback_UpdatedAnnotationsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): DeploymentRollback_UpdatedAnnotationsEntry { + const message = createBaseDeploymentRollback_UpdatedAnnotationsEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, + }; + +function createBaseDeploymentSpec(): DeploymentSpec { + return { + replicas: 0, + selector: undefined, + template: undefined, + strategy: undefined, + minReadySeconds: 0, + revisionHistoryLimit: 0, + paused: false, + rollbackTo: undefined, + progressDeadlineSeconds: 0, + }; +} + +export const DeploymentSpec: MessageFns = { + encode(message: DeploymentSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(18).fork()).join(); + } + if (message.template !== undefined) { + PodTemplateSpec.encode(message.template, writer.uint32(26).fork()).join(); + } + if (message.strategy !== undefined) { + DeploymentStrategy.encode(message.strategy, writer.uint32(34).fork()).join(); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + writer.uint32(40).int32(message.minReadySeconds); + } + if (message.revisionHistoryLimit !== undefined && message.revisionHistoryLimit !== 0) { + writer.uint32(48).int32(message.revisionHistoryLimit); + } + if (message.paused !== undefined && message.paused !== false) { + writer.uint32(56).bool(message.paused); + } + if (message.rollbackTo !== undefined) { + RollbackConfig.encode(message.rollbackTo, writer.uint32(66).fork()).join(); + } + if (message.progressDeadlineSeconds !== undefined && message.progressDeadlineSeconds !== 0) { + writer.uint32(72).int32(message.progressDeadlineSeconds); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeploymentSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeploymentSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.template = PodTemplateSpec.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.strategy = DeploymentStrategy.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.minReadySeconds = reader.int32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.revisionHistoryLimit = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.paused = reader.bool(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.rollbackTo = RollbackConfig.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.progressDeadlineSeconds = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeploymentSpec { + return { + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + template: isSet(object.template) ? PodTemplateSpec.fromJSON(object.template) : undefined, + strategy: isSet(object.strategy) ? DeploymentStrategy.fromJSON(object.strategy) : undefined, + minReadySeconds: isSet(object.minReadySeconds) ? globalThis.Number(object.minReadySeconds) : 0, + revisionHistoryLimit: isSet(object.revisionHistoryLimit) + ? globalThis.Number(object.revisionHistoryLimit) + : 0, + paused: isSet(object.paused) ? globalThis.Boolean(object.paused) : false, + rollbackTo: isSet(object.rollbackTo) ? RollbackConfig.fromJSON(object.rollbackTo) : undefined, + progressDeadlineSeconds: isSet(object.progressDeadlineSeconds) + ? globalThis.Number(object.progressDeadlineSeconds) + : 0, + }; + }, + + toJSON(message: DeploymentSpec): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.template !== undefined) { + obj.template = PodTemplateSpec.toJSON(message.template); + } + if (message.strategy !== undefined) { + obj.strategy = DeploymentStrategy.toJSON(message.strategy); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + obj.minReadySeconds = Math.round(message.minReadySeconds); + } + if (message.revisionHistoryLimit !== undefined && message.revisionHistoryLimit !== 0) { + obj.revisionHistoryLimit = Math.round(message.revisionHistoryLimit); + } + if (message.paused !== undefined && message.paused !== false) { + obj.paused = message.paused; + } + if (message.rollbackTo !== undefined) { + obj.rollbackTo = RollbackConfig.toJSON(message.rollbackTo); + } + if (message.progressDeadlineSeconds !== undefined && message.progressDeadlineSeconds !== 0) { + obj.progressDeadlineSeconds = Math.round(message.progressDeadlineSeconds); + } + return obj; + }, + + create, I>>(base?: I): DeploymentSpec { + return DeploymentSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeploymentSpec { + const message = createBaseDeploymentSpec(); + message.replicas = object.replicas ?? 0; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.template = + object.template !== undefined && object.template !== null + ? PodTemplateSpec.fromPartial(object.template) + : undefined; + message.strategy = + object.strategy !== undefined && object.strategy !== null + ? DeploymentStrategy.fromPartial(object.strategy) + : undefined; + message.minReadySeconds = object.minReadySeconds ?? 0; + message.revisionHistoryLimit = object.revisionHistoryLimit ?? 0; + message.paused = object.paused ?? false; + message.rollbackTo = + object.rollbackTo !== undefined && object.rollbackTo !== null + ? RollbackConfig.fromPartial(object.rollbackTo) + : undefined; + message.progressDeadlineSeconds = object.progressDeadlineSeconds ?? 0; + return message; + }, +}; + +function createBaseDeploymentStatus(): DeploymentStatus { + return { + observedGeneration: 0, + replicas: 0, + updatedReplicas: 0, + readyReplicas: 0, + availableReplicas: 0, + unavailableReplicas: 0, + terminatingReplicas: 0, + conditions: [], + collisionCount: 0, + }; +} + +export const DeploymentStatus: MessageFns = { + encode(message: DeploymentStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(8).int64(message.observedGeneration); + } + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(16).int32(message.replicas); + } + if (message.updatedReplicas !== undefined && message.updatedReplicas !== 0) { + writer.uint32(24).int32(message.updatedReplicas); + } + if (message.readyReplicas !== undefined && message.readyReplicas !== 0) { + writer.uint32(56).int32(message.readyReplicas); + } + if (message.availableReplicas !== undefined && message.availableReplicas !== 0) { + writer.uint32(32).int32(message.availableReplicas); + } + if (message.unavailableReplicas !== undefined && message.unavailableReplicas !== 0) { + writer.uint32(40).int32(message.unavailableReplicas); + } + if (message.terminatingReplicas !== undefined && message.terminatingReplicas !== 0) { + writer.uint32(72).int32(message.terminatingReplicas); + } + for (const v of message.conditions) { + DeploymentCondition.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.collisionCount !== undefined && message.collisionCount !== 0) { + writer.uint32(64).int32(message.collisionCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeploymentStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeploymentStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.updatedReplicas = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.readyReplicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.availableReplicas = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.unavailableReplicas = reader.int32(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.terminatingReplicas = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.conditions.push(DeploymentCondition.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.collisionCount = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeploymentStatus { + return { + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + updatedReplicas: isSet(object.updatedReplicas) ? globalThis.Number(object.updatedReplicas) : 0, + readyReplicas: isSet(object.readyReplicas) ? globalThis.Number(object.readyReplicas) : 0, + availableReplicas: isSet(object.availableReplicas) + ? globalThis.Number(object.availableReplicas) + : 0, + unavailableReplicas: isSet(object.unavailableReplicas) + ? globalThis.Number(object.unavailableReplicas) + : 0, + terminatingReplicas: isSet(object.terminatingReplicas) + ? globalThis.Number(object.terminatingReplicas) + : 0, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => DeploymentCondition.fromJSON(e)) + : [], + collisionCount: isSet(object.collisionCount) ? globalThis.Number(object.collisionCount) : 0, + }; + }, + + toJSON(message: DeploymentStatus): unknown { + const obj: any = {}; + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.updatedReplicas !== undefined && message.updatedReplicas !== 0) { + obj.updatedReplicas = Math.round(message.updatedReplicas); + } + if (message.readyReplicas !== undefined && message.readyReplicas !== 0) { + obj.readyReplicas = Math.round(message.readyReplicas); + } + if (message.availableReplicas !== undefined && message.availableReplicas !== 0) { + obj.availableReplicas = Math.round(message.availableReplicas); + } + if (message.unavailableReplicas !== undefined && message.unavailableReplicas !== 0) { + obj.unavailableReplicas = Math.round(message.unavailableReplicas); + } + if (message.terminatingReplicas !== undefined && message.terminatingReplicas !== 0) { + obj.terminatingReplicas = Math.round(message.terminatingReplicas); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => DeploymentCondition.toJSON(e)); + } + if (message.collisionCount !== undefined && message.collisionCount !== 0) { + obj.collisionCount = Math.round(message.collisionCount); + } + return obj; + }, + + create, I>>(base?: I): DeploymentStatus { + return DeploymentStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeploymentStatus { + const message = createBaseDeploymentStatus(); + message.observedGeneration = object.observedGeneration ?? 0; + message.replicas = object.replicas ?? 0; + message.updatedReplicas = object.updatedReplicas ?? 0; + message.readyReplicas = object.readyReplicas ?? 0; + message.availableReplicas = object.availableReplicas ?? 0; + message.unavailableReplicas = object.unavailableReplicas ?? 0; + message.terminatingReplicas = object.terminatingReplicas ?? 0; + message.conditions = object.conditions?.map((e) => DeploymentCondition.fromPartial(e)) || []; + message.collisionCount = object.collisionCount ?? 0; + return message; + }, +}; + +function createBaseDeploymentStrategy(): DeploymentStrategy { + return { type: '', rollingUpdate: undefined }; +} + +export const DeploymentStrategy: MessageFns = { + encode(message: DeploymentStrategy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.rollingUpdate !== undefined) { + RollingUpdateDeployment.encode(message.rollingUpdate, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeploymentStrategy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeploymentStrategy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.rollingUpdate = RollingUpdateDeployment.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeploymentStrategy { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + rollingUpdate: isSet(object.rollingUpdate) + ? RollingUpdateDeployment.fromJSON(object.rollingUpdate) + : undefined, + }; + }, + + toJSON(message: DeploymentStrategy): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.rollingUpdate !== undefined) { + obj.rollingUpdate = RollingUpdateDeployment.toJSON(message.rollingUpdate); + } + return obj; + }, + + create, I>>(base?: I): DeploymentStrategy { + return DeploymentStrategy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeploymentStrategy { + const message = createBaseDeploymentStrategy(); + message.type = object.type ?? ''; + message.rollingUpdate = + object.rollingUpdate !== undefined && object.rollingUpdate !== null + ? RollingUpdateDeployment.fromPartial(object.rollingUpdate) + : undefined; + return message; + }, +}; + +function createBaseHTTPIngressPath(): HTTPIngressPath { + return { path: '', pathType: '', backend: undefined }; +} + +export const HTTPIngressPath: MessageFns = { + encode(message: HTTPIngressPath, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined && message.path !== '') { + writer.uint32(10).string(message.path); + } + if (message.pathType !== undefined && message.pathType !== '') { + writer.uint32(26).string(message.pathType); + } + if (message.backend !== undefined) { + IngressBackend.encode(message.backend, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HTTPIngressPath { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHTTPIngressPath(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.pathType = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.backend = IngressBackend.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HTTPIngressPath { + return { + path: isSet(object.path) ? globalThis.String(object.path) : '', + pathType: isSet(object.pathType) ? globalThis.String(object.pathType) : '', + backend: isSet(object.backend) ? IngressBackend.fromJSON(object.backend) : undefined, + }; + }, + + toJSON(message: HTTPIngressPath): unknown { + const obj: any = {}; + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.pathType !== undefined && message.pathType !== '') { + obj.pathType = message.pathType; + } + if (message.backend !== undefined) { + obj.backend = IngressBackend.toJSON(message.backend); + } + return obj; + }, + + create, I>>(base?: I): HTTPIngressPath { + return HTTPIngressPath.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HTTPIngressPath { + const message = createBaseHTTPIngressPath(); + message.path = object.path ?? ''; + message.pathType = object.pathType ?? ''; + message.backend = + object.backend !== undefined && object.backend !== null + ? IngressBackend.fromPartial(object.backend) + : undefined; + return message; + }, +}; + +function createBaseHTTPIngressRuleValue(): HTTPIngressRuleValue { + return { paths: [] }; +} + +export const HTTPIngressRuleValue: MessageFns = { + encode(message: HTTPIngressRuleValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.paths) { + HTTPIngressPath.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HTTPIngressRuleValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHTTPIngressRuleValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.paths.push(HTTPIngressPath.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HTTPIngressRuleValue { + return { + paths: globalThis.Array.isArray(object?.paths) + ? object.paths.map((e: any) => HTTPIngressPath.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HTTPIngressRuleValue): unknown { + const obj: any = {}; + if (message.paths?.length) { + obj.paths = message.paths.map((e) => HTTPIngressPath.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): HTTPIngressRuleValue { + return HTTPIngressRuleValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HTTPIngressRuleValue { + const message = createBaseHTTPIngressRuleValue(); + message.paths = object.paths?.map((e) => HTTPIngressPath.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIPBlock(): IPBlock { + return { cidr: '', except: [] }; +} + +export const IPBlock: MessageFns = { + encode(message: IPBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.cidr !== undefined && message.cidr !== '') { + writer.uint32(10).string(message.cidr); + } + for (const v of message.except) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IPBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIPBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.cidr = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.except.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IPBlock { + return { + cidr: isSet(object.cidr) ? globalThis.String(object.cidr) : '', + except: globalThis.Array.isArray(object?.except) + ? object.except.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: IPBlock): unknown { + const obj: any = {}; + if (message.cidr !== undefined && message.cidr !== '') { + obj.cidr = message.cidr; + } + if (message.except?.length) { + obj.except = message.except; + } + return obj; + }, + + create, I>>(base?: I): IPBlock { + return IPBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IPBlock { + const message = createBaseIPBlock(); + message.cidr = object.cidr ?? ''; + message.except = object.except?.map((e) => e) || []; + return message; + }, +}; + +function createBaseIngress(): Ingress { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const Ingress: MessageFns = { + encode(message: Ingress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + IngressSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + IngressStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Ingress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = IngressSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = IngressStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Ingress { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? IngressSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? IngressStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: Ingress): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = IngressSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = IngressStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): Ingress { + return Ingress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Ingress { + const message = createBaseIngress(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? IngressSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? IngressStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseIngressBackend(): IngressBackend { + return { serviceName: '', servicePort: undefined, resource: undefined }; +} + +export const IngressBackend: MessageFns = { + encode(message: IngressBackend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.serviceName !== undefined && message.serviceName !== '') { + writer.uint32(10).string(message.serviceName); + } + if (message.servicePort !== undefined) { + IntOrString.encode(message.servicePort, writer.uint32(18).fork()).join(); + } + if (message.resource !== undefined) { + TypedLocalObjectReference.encode(message.resource, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressBackend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressBackend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.serviceName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.servicePort = IntOrString.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.resource = TypedLocalObjectReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressBackend { + return { + serviceName: isSet(object.serviceName) ? globalThis.String(object.serviceName) : '', + servicePort: isSet(object.servicePort) ? IntOrString.fromJSON(object.servicePort) : undefined, + resource: isSet(object.resource) + ? TypedLocalObjectReference.fromJSON(object.resource) + : undefined, + }; + }, + + toJSON(message: IngressBackend): unknown { + const obj: any = {}; + if (message.serviceName !== undefined && message.serviceName !== '') { + obj.serviceName = message.serviceName; + } + if (message.servicePort !== undefined) { + obj.servicePort = IntOrString.toJSON(message.servicePort); + } + if (message.resource !== undefined) { + obj.resource = TypedLocalObjectReference.toJSON(message.resource); + } + return obj; + }, + + create, I>>(base?: I): IngressBackend { + return IngressBackend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressBackend { + const message = createBaseIngressBackend(); + message.serviceName = object.serviceName ?? ''; + message.servicePort = + object.servicePort !== undefined && object.servicePort !== null + ? IntOrString.fromPartial(object.servicePort) + : undefined; + message.resource = + object.resource !== undefined && object.resource !== null + ? TypedLocalObjectReference.fromPartial(object.resource) + : undefined; + return message; + }, +}; + +function createBaseIngressList(): IngressList { + return { metadata: undefined, items: [] }; +} + +export const IngressList: MessageFns = { + encode(message: IngressList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Ingress.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Ingress.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Ingress.fromJSON(e)) + : [], + }; + }, + + toJSON(message: IngressList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Ingress.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): IngressList { + return IngressList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressList { + const message = createBaseIngressList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Ingress.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIngressLoadBalancerIngress(): IngressLoadBalancerIngress { + return { ip: '', hostname: '', ports: [] }; +} + +export const IngressLoadBalancerIngress: MessageFns = { + encode(message: IngressLoadBalancerIngress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ip !== undefined && message.ip !== '') { + writer.uint32(10).string(message.ip); + } + if (message.hostname !== undefined && message.hostname !== '') { + writer.uint32(18).string(message.hostname); + } + for (const v of message.ports) { + IngressPortStatus.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressLoadBalancerIngress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressLoadBalancerIngress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ip = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hostname = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.ports.push(IngressPortStatus.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressLoadBalancerIngress { + return { + ip: isSet(object.ip) ? globalThis.String(object.ip) : '', + hostname: isSet(object.hostname) ? globalThis.String(object.hostname) : '', + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => IngressPortStatus.fromJSON(e)) + : [], + }; + }, + + toJSON(message: IngressLoadBalancerIngress): unknown { + const obj: any = {}; + if (message.ip !== undefined && message.ip !== '') { + obj.ip = message.ip; + } + if (message.hostname !== undefined && message.hostname !== '') { + obj.hostname = message.hostname; + } + if (message.ports?.length) { + obj.ports = message.ports.map((e) => IngressPortStatus.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): IngressLoadBalancerIngress { + return IngressLoadBalancerIngress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): IngressLoadBalancerIngress { + const message = createBaseIngressLoadBalancerIngress(); + message.ip = object.ip ?? ''; + message.hostname = object.hostname ?? ''; + message.ports = object.ports?.map((e) => IngressPortStatus.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIngressLoadBalancerStatus(): IngressLoadBalancerStatus { + return { ingress: [] }; +} + +export const IngressLoadBalancerStatus: MessageFns = { + encode(message: IngressLoadBalancerStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ingress) { + IngressLoadBalancerIngress.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressLoadBalancerStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressLoadBalancerStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ingress.push(IngressLoadBalancerIngress.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressLoadBalancerStatus { + return { + ingress: globalThis.Array.isArray(object?.ingress) + ? object.ingress.map((e: any) => IngressLoadBalancerIngress.fromJSON(e)) + : [], + }; + }, + + toJSON(message: IngressLoadBalancerStatus): unknown { + const obj: any = {}; + if (message.ingress?.length) { + obj.ingress = message.ingress.map((e) => IngressLoadBalancerIngress.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): IngressLoadBalancerStatus { + return IngressLoadBalancerStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): IngressLoadBalancerStatus { + const message = createBaseIngressLoadBalancerStatus(); + message.ingress = object.ingress?.map((e) => IngressLoadBalancerIngress.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIngressPortStatus(): IngressPortStatus { + return { port: 0, protocol: '', error: '' }; +} + +export const IngressPortStatus: MessageFns = { + encode(message: IngressPortStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.port !== undefined && message.port !== 0) { + writer.uint32(8).int32(message.port); + } + if (message.protocol !== undefined && message.protocol !== '') { + writer.uint32(18).string(message.protocol); + } + if (message.error !== undefined && message.error !== '') { + writer.uint32(26).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressPortStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressPortStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.port = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.protocol = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.error = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressPortStatus { + return { + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + protocol: isSet(object.protocol) ? globalThis.String(object.protocol) : '', + error: isSet(object.error) ? globalThis.String(object.error) : '', + }; + }, + + toJSON(message: IngressPortStatus): unknown { + const obj: any = {}; + if (message.port !== undefined && message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.protocol !== undefined && message.protocol !== '') { + obj.protocol = message.protocol; + } + if (message.error !== undefined && message.error !== '') { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): IngressPortStatus { + return IngressPortStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressPortStatus { + const message = createBaseIngressPortStatus(); + message.port = object.port ?? 0; + message.protocol = object.protocol ?? ''; + message.error = object.error ?? ''; + return message; + }, +}; + +function createBaseIngressRule(): IngressRule { + return { host: '', ingressRuleValue: undefined }; +} + +export const IngressRule: MessageFns = { + encode(message: IngressRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.host !== undefined && message.host !== '') { + writer.uint32(10).string(message.host); + } + if (message.ingressRuleValue !== undefined) { + IngressRuleValue.encode(message.ingressRuleValue, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.host = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.ingressRuleValue = IngressRuleValue.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressRule { + return { + host: isSet(object.host) ? globalThis.String(object.host) : '', + ingressRuleValue: isSet(object.ingressRuleValue) + ? IngressRuleValue.fromJSON(object.ingressRuleValue) + : undefined, + }; + }, + + toJSON(message: IngressRule): unknown { + const obj: any = {}; + if (message.host !== undefined && message.host !== '') { + obj.host = message.host; + } + if (message.ingressRuleValue !== undefined) { + obj.ingressRuleValue = IngressRuleValue.toJSON(message.ingressRuleValue); + } + return obj; + }, + + create, I>>(base?: I): IngressRule { + return IngressRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressRule { + const message = createBaseIngressRule(); + message.host = object.host ?? ''; + message.ingressRuleValue = + object.ingressRuleValue !== undefined && object.ingressRuleValue !== null + ? IngressRuleValue.fromPartial(object.ingressRuleValue) + : undefined; + return message; + }, +}; + +function createBaseIngressRuleValue(): IngressRuleValue { + return { http: undefined }; +} + +export const IngressRuleValue: MessageFns = { + encode(message: IngressRuleValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.http !== undefined) { + HTTPIngressRuleValue.encode(message.http, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressRuleValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressRuleValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.http = HTTPIngressRuleValue.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressRuleValue { + return { http: isSet(object.http) ? HTTPIngressRuleValue.fromJSON(object.http) : undefined }; + }, + + toJSON(message: IngressRuleValue): unknown { + const obj: any = {}; + if (message.http !== undefined) { + obj.http = HTTPIngressRuleValue.toJSON(message.http); + } + return obj; + }, + + create, I>>(base?: I): IngressRuleValue { + return IngressRuleValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressRuleValue { + const message = createBaseIngressRuleValue(); + message.http = + object.http !== undefined && object.http !== null + ? HTTPIngressRuleValue.fromPartial(object.http) + : undefined; + return message; + }, +}; + +function createBaseIngressSpec(): IngressSpec { + return { ingressClassName: '', backend: undefined, tls: [], rules: [] }; +} + +export const IngressSpec: MessageFns = { + encode(message: IngressSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ingressClassName !== undefined && message.ingressClassName !== '') { + writer.uint32(34).string(message.ingressClassName); + } + if (message.backend !== undefined) { + IngressBackend.encode(message.backend, writer.uint32(10).fork()).join(); + } + for (const v of message.tls) { + IngressTLS.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.rules) { + IngressRule.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + if (tag !== 34) { + break; + } + + message.ingressClassName = reader.string(); + continue; + } + case 1: { + if (tag !== 10) { + break; + } + + message.backend = IngressBackend.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.tls.push(IngressTLS.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.rules.push(IngressRule.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressSpec { + return { + ingressClassName: isSet(object.ingressClassName) + ? globalThis.String(object.ingressClassName) + : '', + backend: isSet(object.backend) ? IngressBackend.fromJSON(object.backend) : undefined, + tls: globalThis.Array.isArray(object?.tls) + ? object.tls.map((e: any) => IngressTLS.fromJSON(e)) + : [], + rules: globalThis.Array.isArray(object?.rules) + ? object.rules.map((e: any) => IngressRule.fromJSON(e)) + : [], + }; + }, + + toJSON(message: IngressSpec): unknown { + const obj: any = {}; + if (message.ingressClassName !== undefined && message.ingressClassName !== '') { + obj.ingressClassName = message.ingressClassName; + } + if (message.backend !== undefined) { + obj.backend = IngressBackend.toJSON(message.backend); + } + if (message.tls?.length) { + obj.tls = message.tls.map((e) => IngressTLS.toJSON(e)); + } + if (message.rules?.length) { + obj.rules = message.rules.map((e) => IngressRule.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): IngressSpec { + return IngressSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressSpec { + const message = createBaseIngressSpec(); + message.ingressClassName = object.ingressClassName ?? ''; + message.backend = + object.backend !== undefined && object.backend !== null + ? IngressBackend.fromPartial(object.backend) + : undefined; + message.tls = object.tls?.map((e) => IngressTLS.fromPartial(e)) || []; + message.rules = object.rules?.map((e) => IngressRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIngressStatus(): IngressStatus { + return { loadBalancer: undefined }; +} + +export const IngressStatus: MessageFns = { + encode(message: IngressStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.loadBalancer !== undefined) { + IngressLoadBalancerStatus.encode(message.loadBalancer, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.loadBalancer = IngressLoadBalancerStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressStatus { + return { + loadBalancer: isSet(object.loadBalancer) + ? IngressLoadBalancerStatus.fromJSON(object.loadBalancer) + : undefined, + }; + }, + + toJSON(message: IngressStatus): unknown { + const obj: any = {}; + if (message.loadBalancer !== undefined) { + obj.loadBalancer = IngressLoadBalancerStatus.toJSON(message.loadBalancer); + } + return obj; + }, + + create, I>>(base?: I): IngressStatus { + return IngressStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressStatus { + const message = createBaseIngressStatus(); + message.loadBalancer = + object.loadBalancer !== undefined && object.loadBalancer !== null + ? IngressLoadBalancerStatus.fromPartial(object.loadBalancer) + : undefined; + return message; + }, +}; + +function createBaseIngressTLS(): IngressTLS { + return { hosts: [], secretName: '' }; +} + +export const IngressTLS: MessageFns = { + encode(message: IngressTLS, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.hosts) { + writer.uint32(10).string(v!); + } + if (message.secretName !== undefined && message.secretName !== '') { + writer.uint32(18).string(message.secretName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressTLS { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressTLS(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.hosts.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.secretName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressTLS { + return { + hosts: globalThis.Array.isArray(object?.hosts) + ? object.hosts.map((e: any) => globalThis.String(e)) + : [], + secretName: isSet(object.secretName) ? globalThis.String(object.secretName) : '', + }; + }, + + toJSON(message: IngressTLS): unknown { + const obj: any = {}; + if (message.hosts?.length) { + obj.hosts = message.hosts; + } + if (message.secretName !== undefined && message.secretName !== '') { + obj.secretName = message.secretName; + } + return obj; + }, + + create, I>>(base?: I): IngressTLS { + return IngressTLS.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressTLS { + const message = createBaseIngressTLS(); + message.hosts = object.hosts?.map((e) => e) || []; + message.secretName = object.secretName ?? ''; + return message; + }, +}; + +function createBaseNetworkPolicy(): NetworkPolicy { + return { metadata: undefined, spec: undefined }; +} + +export const NetworkPolicy: MessageFns = { + encode(message: NetworkPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + NetworkPolicySpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = NetworkPolicySpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicy { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? NetworkPolicySpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: NetworkPolicy): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = NetworkPolicySpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicy { + return NetworkPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetworkPolicy { + const message = createBaseNetworkPolicy(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? NetworkPolicySpec.fromPartial(object.spec) + : undefined; + return message; + }, +}; + +function createBaseNetworkPolicyEgressRule(): NetworkPolicyEgressRule { + return { ports: [], to: [] }; +} + +export const NetworkPolicyEgressRule: MessageFns = { + encode(message: NetworkPolicyEgressRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ports) { + NetworkPolicyPort.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.to) { + NetworkPolicyPeer.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicyEgressRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicyEgressRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ports.push(NetworkPolicyPort.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.to.push(NetworkPolicyPeer.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicyEgressRule { + return { + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => NetworkPolicyPort.fromJSON(e)) + : [], + to: globalThis.Array.isArray(object?.to) + ? object.to.map((e: any) => NetworkPolicyPeer.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NetworkPolicyEgressRule): unknown { + const obj: any = {}; + if (message.ports?.length) { + obj.ports = message.ports.map((e) => NetworkPolicyPort.toJSON(e)); + } + if (message.to?.length) { + obj.to = message.to.map((e) => NetworkPolicyPeer.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicyEgressRule { + return NetworkPolicyEgressRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NetworkPolicyEgressRule { + const message = createBaseNetworkPolicyEgressRule(); + message.ports = object.ports?.map((e) => NetworkPolicyPort.fromPartial(e)) || []; + message.to = object.to?.map((e) => NetworkPolicyPeer.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNetworkPolicyIngressRule(): NetworkPolicyIngressRule { + return { ports: [], from: [] }; +} + +export const NetworkPolicyIngressRule: MessageFns = { + encode(message: NetworkPolicyIngressRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ports) { + NetworkPolicyPort.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.from) { + NetworkPolicyPeer.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicyIngressRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicyIngressRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ports.push(NetworkPolicyPort.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.from.push(NetworkPolicyPeer.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicyIngressRule { + return { + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => NetworkPolicyPort.fromJSON(e)) + : [], + from: globalThis.Array.isArray(object?.from) + ? object.from.map((e: any) => NetworkPolicyPeer.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NetworkPolicyIngressRule): unknown { + const obj: any = {}; + if (message.ports?.length) { + obj.ports = message.ports.map((e) => NetworkPolicyPort.toJSON(e)); + } + if (message.from?.length) { + obj.from = message.from.map((e) => NetworkPolicyPeer.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicyIngressRule { + return NetworkPolicyIngressRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NetworkPolicyIngressRule { + const message = createBaseNetworkPolicyIngressRule(); + message.ports = object.ports?.map((e) => NetworkPolicyPort.fromPartial(e)) || []; + message.from = object.from?.map((e) => NetworkPolicyPeer.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNetworkPolicyList(): NetworkPolicyList { + return { metadata: undefined, items: [] }; +} + +export const NetworkPolicyList: MessageFns = { + encode(message: NetworkPolicyList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + NetworkPolicy.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicyList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicyList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(NetworkPolicy.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicyList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => NetworkPolicy.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NetworkPolicyList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => NetworkPolicy.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicyList { + return NetworkPolicyList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetworkPolicyList { + const message = createBaseNetworkPolicyList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => NetworkPolicy.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNetworkPolicyPeer(): NetworkPolicyPeer { + return { podSelector: undefined, namespaceSelector: undefined, ipBlock: undefined }; +} + +export const NetworkPolicyPeer: MessageFns = { + encode(message: NetworkPolicyPeer, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.podSelector !== undefined) { + LabelSelector.encode(message.podSelector, writer.uint32(10).fork()).join(); + } + if (message.namespaceSelector !== undefined) { + LabelSelector.encode(message.namespaceSelector, writer.uint32(18).fork()).join(); + } + if (message.ipBlock !== undefined) { + IPBlock.encode(message.ipBlock, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicyPeer { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicyPeer(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.podSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.namespaceSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.ipBlock = IPBlock.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicyPeer { + return { + podSelector: isSet(object.podSelector) ? LabelSelector.fromJSON(object.podSelector) : undefined, + namespaceSelector: isSet(object.namespaceSelector) + ? LabelSelector.fromJSON(object.namespaceSelector) + : undefined, + ipBlock: isSet(object.ipBlock) ? IPBlock.fromJSON(object.ipBlock) : undefined, + }; + }, + + toJSON(message: NetworkPolicyPeer): unknown { + const obj: any = {}; + if (message.podSelector !== undefined) { + obj.podSelector = LabelSelector.toJSON(message.podSelector); + } + if (message.namespaceSelector !== undefined) { + obj.namespaceSelector = LabelSelector.toJSON(message.namespaceSelector); + } + if (message.ipBlock !== undefined) { + obj.ipBlock = IPBlock.toJSON(message.ipBlock); + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicyPeer { + return NetworkPolicyPeer.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetworkPolicyPeer { + const message = createBaseNetworkPolicyPeer(); + message.podSelector = + object.podSelector !== undefined && object.podSelector !== null + ? LabelSelector.fromPartial(object.podSelector) + : undefined; + message.namespaceSelector = + object.namespaceSelector !== undefined && object.namespaceSelector !== null + ? LabelSelector.fromPartial(object.namespaceSelector) + : undefined; + message.ipBlock = + object.ipBlock !== undefined && object.ipBlock !== null + ? IPBlock.fromPartial(object.ipBlock) + : undefined; + return message; + }, +}; + +function createBaseNetworkPolicyPort(): NetworkPolicyPort { + return { protocol: '', port: undefined, endPort: 0 }; +} + +export const NetworkPolicyPort: MessageFns = { + encode(message: NetworkPolicyPort, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocol !== undefined && message.protocol !== '') { + writer.uint32(10).string(message.protocol); + } + if (message.port !== undefined) { + IntOrString.encode(message.port, writer.uint32(18).fork()).join(); + } + if (message.endPort !== undefined && message.endPort !== 0) { + writer.uint32(24).int32(message.endPort); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicyPort { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicyPort(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.protocol = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.port = IntOrString.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.endPort = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicyPort { + return { + protocol: isSet(object.protocol) ? globalThis.String(object.protocol) : '', + port: isSet(object.port) ? IntOrString.fromJSON(object.port) : undefined, + endPort: isSet(object.endPort) ? globalThis.Number(object.endPort) : 0, + }; + }, + + toJSON(message: NetworkPolicyPort): unknown { + const obj: any = {}; + if (message.protocol !== undefined && message.protocol !== '') { + obj.protocol = message.protocol; + } + if (message.port !== undefined) { + obj.port = IntOrString.toJSON(message.port); + } + if (message.endPort !== undefined && message.endPort !== 0) { + obj.endPort = Math.round(message.endPort); + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicyPort { + return NetworkPolicyPort.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetworkPolicyPort { + const message = createBaseNetworkPolicyPort(); + message.protocol = object.protocol ?? ''; + message.port = + object.port !== undefined && object.port !== null + ? IntOrString.fromPartial(object.port) + : undefined; + message.endPort = object.endPort ?? 0; + return message; + }, +}; + +function createBaseNetworkPolicySpec(): NetworkPolicySpec { + return { podSelector: undefined, ingress: [], egress: [], policyTypes: [] }; +} + +export const NetworkPolicySpec: MessageFns = { + encode(message: NetworkPolicySpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.podSelector !== undefined) { + LabelSelector.encode(message.podSelector, writer.uint32(10).fork()).join(); + } + for (const v of message.ingress) { + NetworkPolicyIngressRule.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.egress) { + NetworkPolicyEgressRule.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.policyTypes) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicySpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicySpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.podSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.ingress.push(NetworkPolicyIngressRule.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.egress.push(NetworkPolicyEgressRule.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.policyTypes.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicySpec { + return { + podSelector: isSet(object.podSelector) ? LabelSelector.fromJSON(object.podSelector) : undefined, + ingress: globalThis.Array.isArray(object?.ingress) + ? object.ingress.map((e: any) => NetworkPolicyIngressRule.fromJSON(e)) + : [], + egress: globalThis.Array.isArray(object?.egress) + ? object.egress.map((e: any) => NetworkPolicyEgressRule.fromJSON(e)) + : [], + policyTypes: globalThis.Array.isArray(object?.policyTypes) + ? object.policyTypes.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: NetworkPolicySpec): unknown { + const obj: any = {}; + if (message.podSelector !== undefined) { + obj.podSelector = LabelSelector.toJSON(message.podSelector); + } + if (message.ingress?.length) { + obj.ingress = message.ingress.map((e) => NetworkPolicyIngressRule.toJSON(e)); + } + if (message.egress?.length) { + obj.egress = message.egress.map((e) => NetworkPolicyEgressRule.toJSON(e)); + } + if (message.policyTypes?.length) { + obj.policyTypes = message.policyTypes; + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicySpec { + return NetworkPolicySpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetworkPolicySpec { + const message = createBaseNetworkPolicySpec(); + message.podSelector = + object.podSelector !== undefined && object.podSelector !== null + ? LabelSelector.fromPartial(object.podSelector) + : undefined; + message.ingress = object.ingress?.map((e) => NetworkPolicyIngressRule.fromPartial(e)) || []; + message.egress = object.egress?.map((e) => NetworkPolicyEgressRule.fromPartial(e)) || []; + message.policyTypes = object.policyTypes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseReplicaSet(): ReplicaSet { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const ReplicaSet: MessageFns = { + encode(message: ReplicaSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + ReplicaSetSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + ReplicaSetStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicaSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicaSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = ReplicaSetSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = ReplicaSetStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicaSet { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? ReplicaSetSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? ReplicaSetStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: ReplicaSet): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = ReplicaSetSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = ReplicaSetStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ReplicaSet { + return ReplicaSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReplicaSet { + const message = createBaseReplicaSet(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? ReplicaSetSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? ReplicaSetStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseReplicaSetCondition(): ReplicaSetCondition { + return { type: '', status: '', lastTransitionTime: undefined, reason: '', message: '' }; +} + +export const ReplicaSetCondition: MessageFns = { + encode(message: ReplicaSetCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(26).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(42).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicaSetCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicaSetCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicaSetCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: ReplicaSetCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): ReplicaSetCondition { + return ReplicaSetCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReplicaSetCondition { + const message = createBaseReplicaSetCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseReplicaSetList(): ReplicaSetList { + return { metadata: undefined, items: [] }; +} + +export const ReplicaSetList: MessageFns = { + encode(message: ReplicaSetList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ReplicaSet.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicaSetList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicaSetList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ReplicaSet.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicaSetList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ReplicaSet.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ReplicaSetList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ReplicaSet.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ReplicaSetList { + return ReplicaSetList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReplicaSetList { + const message = createBaseReplicaSetList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ReplicaSet.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseReplicaSetSpec(): ReplicaSetSpec { + return { replicas: 0, minReadySeconds: 0, selector: undefined, template: undefined }; +} + +export const ReplicaSetSpec: MessageFns = { + encode(message: ReplicaSetSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + writer.uint32(32).int32(message.minReadySeconds); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(18).fork()).join(); + } + if (message.template !== undefined) { + PodTemplateSpec.encode(message.template, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicaSetSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicaSetSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.minReadySeconds = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.template = PodTemplateSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicaSetSpec { + return { + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + minReadySeconds: isSet(object.minReadySeconds) ? globalThis.Number(object.minReadySeconds) : 0, + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + template: isSet(object.template) ? PodTemplateSpec.fromJSON(object.template) : undefined, + }; + }, + + toJSON(message: ReplicaSetSpec): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.minReadySeconds !== undefined && message.minReadySeconds !== 0) { + obj.minReadySeconds = Math.round(message.minReadySeconds); + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.template !== undefined) { + obj.template = PodTemplateSpec.toJSON(message.template); + } + return obj; + }, + + create, I>>(base?: I): ReplicaSetSpec { + return ReplicaSetSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReplicaSetSpec { + const message = createBaseReplicaSetSpec(); + message.replicas = object.replicas ?? 0; + message.minReadySeconds = object.minReadySeconds ?? 0; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.template = + object.template !== undefined && object.template !== null + ? PodTemplateSpec.fromPartial(object.template) + : undefined; + return message; + }, +}; + +function createBaseReplicaSetStatus(): ReplicaSetStatus { + return { + replicas: 0, + fullyLabeledReplicas: 0, + readyReplicas: 0, + availableReplicas: 0, + terminatingReplicas: 0, + observedGeneration: 0, + conditions: [], + }; +} + +export const ReplicaSetStatus: MessageFns = { + encode(message: ReplicaSetStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + if (message.fullyLabeledReplicas !== undefined && message.fullyLabeledReplicas !== 0) { + writer.uint32(16).int32(message.fullyLabeledReplicas); + } + if (message.readyReplicas !== undefined && message.readyReplicas !== 0) { + writer.uint32(32).int32(message.readyReplicas); + } + if (message.availableReplicas !== undefined && message.availableReplicas !== 0) { + writer.uint32(40).int32(message.availableReplicas); + } + if (message.terminatingReplicas !== undefined && message.terminatingReplicas !== 0) { + writer.uint32(56).int32(message.terminatingReplicas); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(24).int64(message.observedGeneration); + } + for (const v of message.conditions) { + ReplicaSetCondition.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicaSetStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicaSetStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.fullyLabeledReplicas = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.readyReplicas = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.availableReplicas = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.terminatingReplicas = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.conditions.push(ReplicaSetCondition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ReplicaSetStatus { + return { + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + fullyLabeledReplicas: isSet(object.fullyLabeledReplicas) + ? globalThis.Number(object.fullyLabeledReplicas) + : 0, + readyReplicas: isSet(object.readyReplicas) ? globalThis.Number(object.readyReplicas) : 0, + availableReplicas: isSet(object.availableReplicas) + ? globalThis.Number(object.availableReplicas) + : 0, + terminatingReplicas: isSet(object.terminatingReplicas) + ? globalThis.Number(object.terminatingReplicas) + : 0, + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => ReplicaSetCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ReplicaSetStatus): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.fullyLabeledReplicas !== undefined && message.fullyLabeledReplicas !== 0) { + obj.fullyLabeledReplicas = Math.round(message.fullyLabeledReplicas); + } + if (message.readyReplicas !== undefined && message.readyReplicas !== 0) { + obj.readyReplicas = Math.round(message.readyReplicas); + } + if (message.availableReplicas !== undefined && message.availableReplicas !== 0) { + obj.availableReplicas = Math.round(message.availableReplicas); + } + if (message.terminatingReplicas !== undefined && message.terminatingReplicas !== 0) { + obj.terminatingReplicas = Math.round(message.terminatingReplicas); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => ReplicaSetCondition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ReplicaSetStatus { + return ReplicaSetStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReplicaSetStatus { + const message = createBaseReplicaSetStatus(); + message.replicas = object.replicas ?? 0; + message.fullyLabeledReplicas = object.fullyLabeledReplicas ?? 0; + message.readyReplicas = object.readyReplicas ?? 0; + message.availableReplicas = object.availableReplicas ?? 0; + message.terminatingReplicas = object.terminatingReplicas ?? 0; + message.observedGeneration = object.observedGeneration ?? 0; + message.conditions = object.conditions?.map((e) => ReplicaSetCondition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRollbackConfig(): RollbackConfig { + return { revision: 0 }; +} + +export const RollbackConfig: MessageFns = { + encode(message: RollbackConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.revision !== undefined && message.revision !== 0) { + writer.uint32(8).int64(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RollbackConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRollbackConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.revision = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RollbackConfig { + return { revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0 }; + }, + + toJSON(message: RollbackConfig): unknown { + const obj: any = {}; + if (message.revision !== undefined && message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create, I>>(base?: I): RollbackConfig { + return RollbackConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RollbackConfig { + const message = createBaseRollbackConfig(); + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseRollingUpdateDaemonSet(): RollingUpdateDaemonSet { + return { maxUnavailable: undefined, maxSurge: undefined }; +} + +export const RollingUpdateDaemonSet: MessageFns = { + encode(message: RollingUpdateDaemonSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxUnavailable !== undefined) { + IntOrString.encode(message.maxUnavailable, writer.uint32(10).fork()).join(); + } + if (message.maxSurge !== undefined) { + IntOrString.encode(message.maxSurge, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RollingUpdateDaemonSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRollingUpdateDaemonSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.maxUnavailable = IntOrString.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.maxSurge = IntOrString.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RollingUpdateDaemonSet { + return { + maxUnavailable: isSet(object.maxUnavailable) + ? IntOrString.fromJSON(object.maxUnavailable) + : undefined, + maxSurge: isSet(object.maxSurge) ? IntOrString.fromJSON(object.maxSurge) : undefined, + }; + }, + + toJSON(message: RollingUpdateDaemonSet): unknown { + const obj: any = {}; + if (message.maxUnavailable !== undefined) { + obj.maxUnavailable = IntOrString.toJSON(message.maxUnavailable); + } + if (message.maxSurge !== undefined) { + obj.maxSurge = IntOrString.toJSON(message.maxSurge); + } + return obj; + }, + + create, I>>(base?: I): RollingUpdateDaemonSet { + return RollingUpdateDaemonSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RollingUpdateDaemonSet { + const message = createBaseRollingUpdateDaemonSet(); + message.maxUnavailable = + object.maxUnavailable !== undefined && object.maxUnavailable !== null + ? IntOrString.fromPartial(object.maxUnavailable) + : undefined; + message.maxSurge = + object.maxSurge !== undefined && object.maxSurge !== null + ? IntOrString.fromPartial(object.maxSurge) + : undefined; + return message; + }, +}; + +function createBaseRollingUpdateDeployment(): RollingUpdateDeployment { + return { maxUnavailable: undefined, maxSurge: undefined }; +} + +export const RollingUpdateDeployment: MessageFns = { + encode(message: RollingUpdateDeployment, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxUnavailable !== undefined) { + IntOrString.encode(message.maxUnavailable, writer.uint32(10).fork()).join(); + } + if (message.maxSurge !== undefined) { + IntOrString.encode(message.maxSurge, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RollingUpdateDeployment { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRollingUpdateDeployment(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.maxUnavailable = IntOrString.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.maxSurge = IntOrString.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RollingUpdateDeployment { + return { + maxUnavailable: isSet(object.maxUnavailable) + ? IntOrString.fromJSON(object.maxUnavailable) + : undefined, + maxSurge: isSet(object.maxSurge) ? IntOrString.fromJSON(object.maxSurge) : undefined, + }; + }, + + toJSON(message: RollingUpdateDeployment): unknown { + const obj: any = {}; + if (message.maxUnavailable !== undefined) { + obj.maxUnavailable = IntOrString.toJSON(message.maxUnavailable); + } + if (message.maxSurge !== undefined) { + obj.maxSurge = IntOrString.toJSON(message.maxSurge); + } + return obj; + }, + + create, I>>(base?: I): RollingUpdateDeployment { + return RollingUpdateDeployment.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RollingUpdateDeployment { + const message = createBaseRollingUpdateDeployment(); + message.maxUnavailable = + object.maxUnavailable !== undefined && object.maxUnavailable !== null + ? IntOrString.fromPartial(object.maxUnavailable) + : undefined; + message.maxSurge = + object.maxSurge !== undefined && object.maxSurge !== null + ? IntOrString.fromPartial(object.maxSurge) + : undefined; + return message; + }, +}; + +function createBaseScale(): Scale { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const Scale: MessageFns = { + encode(message: Scale, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + ScaleSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + ScaleStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Scale { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScale(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = ScaleSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = ScaleStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Scale { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? ScaleSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? ScaleStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: Scale): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = ScaleSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = ScaleStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): Scale { + return Scale.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Scale { + const message = createBaseScale(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? ScaleSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? ScaleStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseScaleSpec(): ScaleSpec { + return { replicas: 0 }; +} + +export const ScaleSpec: MessageFns = { + encode(message: ScaleSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScaleSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScaleSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ScaleSpec { + return { replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0 }; + }, + + toJSON(message: ScaleSpec): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + return obj; + }, + + create, I>>(base?: I): ScaleSpec { + return ScaleSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ScaleSpec { + const message = createBaseScaleSpec(); + message.replicas = object.replicas ?? 0; + return message; + }, +}; + +function createBaseScaleStatus(): ScaleStatus { + return { replicas: 0, selector: {}, targetSelector: '' }; +} + +export const ScaleStatus: MessageFns = { + encode(message: ScaleStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.replicas !== undefined && message.replicas !== 0) { + writer.uint32(8).int32(message.replicas); + } + globalThis.Object.entries(message.selector).forEach(([key, value]: [string, string]) => { + ScaleStatus_SelectorEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); + }); + if (message.targetSelector !== undefined && message.targetSelector !== '') { + writer.uint32(26).string(message.targetSelector); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScaleStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScaleStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.replicas = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = ScaleStatus_SelectorEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.selector[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.targetSelector = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ScaleStatus { + return { + replicas: isSet(object.replicas) ? globalThis.Number(object.replicas) : 0, + selector: isObject(object.selector) + ? (globalThis.Object.entries(object.selector) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + targetSelector: isSet(object.targetSelector) ? globalThis.String(object.targetSelector) : '', + }; + }, + + toJSON(message: ScaleStatus): unknown { + const obj: any = {}; + if (message.replicas !== undefined && message.replicas !== 0) { + obj.replicas = Math.round(message.replicas); + } + if (message.selector) { + const entries = globalThis.Object.entries(message.selector) as [string, string][]; + if (entries.length > 0) { + obj.selector = {}; + entries.forEach(([k, v]) => { + obj.selector[k] = v; + }); + } + } + if (message.targetSelector !== undefined && message.targetSelector !== '') { + obj.targetSelector = message.targetSelector; + } + return obj; + }, + + create, I>>(base?: I): ScaleStatus { + return ScaleStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ScaleStatus { + const message = createBaseScaleStatus(); + message.replicas = object.replicas ?? 0; + message.selector = (globalThis.Object.entries(object.selector ?? {}) as [string, string][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.targetSelector = object.targetSelector ?? ''; + return message; + }, +}; + +function createBaseScaleStatus_SelectorEntry(): ScaleStatus_SelectorEntry { + return { key: '', value: '' }; +} + +export const ScaleStatus_SelectorEntry: MessageFns = { + encode(message: ScaleStatus_SelectorEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScaleStatus_SelectorEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScaleStatus_SelectorEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ScaleStatus_SelectorEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: ScaleStatus_SelectorEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): ScaleStatus_SelectorEntry { + return ScaleStatus_SelectorEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ScaleStatus_SelectorEntry { + const message = createBaseScaleStatus_SelectorEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error('Value is smaller than Number.MIN_SAFE_INTEGER'); + } + return num; +} + +function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/flowcontrol/v1/generated.ts b/src/proto/generated/k8s.io/api/flowcontrol/v1/generated.ts new file mode 100644 index 00000000000..347c5ae7689 --- /dev/null +++ b/src/proto/generated/k8s.io/api/flowcontrol/v1/generated.ts @@ -0,0 +1,3020 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/flowcontrol/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { ListMeta, ObjectMeta, Time } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** + * ExemptPriorityLevelConfiguration describes the configurable aspects + * of the handling of exempt requests. + * In the mandatory exempt configuration object the values in the fields + * here can be modified by authorized users, unlike the rest of the `spec`. + */ +export interface ExemptPriorityLevelConfiguration { + /** + * nominalConcurrencyShares (NCS) contributes to the computation of the + * NominalConcurrencyLimit (NominalCL) of this level. + * This is the number of execution seats nominally reserved for this priority level. + * This DOES NOT limit the dispatching from this priority level + * but affects the other priority levels through the borrowing mechanism. + * The server's concurrency limit (ServerCL) is divided among all the + * priority levels in proportion to their NCS values: + * + * NominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) + * sum_ncs = sum[priority level k] NCS(k) + * + * Bigger numbers mean a larger nominal concurrency limit, + * at the expense of every other priority level. + * This field has a default value of zero. + * +optional + */ + nominalConcurrencyShares?: number | undefined; + /** + * lendablePercent prescribes the fraction of the level's NominalCL that + * can be borrowed by other priority levels. This value of this + * field must be between 0 and 100, inclusive, and it defaults to 0. + * The number of seats that other levels can borrow from this level, known + * as this level's LendableConcurrencyLimit (LendableCL), is defined as follows. + * + * LendableCL(i) = round( NominalCL(i) * lendablePercent(i)/100.0 ) + * + * +optional + */ + lendablePercent?: number | undefined; +} + +/** FlowDistinguisherMethod specifies the method of a flow distinguisher. */ +export interface FlowDistinguisherMethod { + /** + * type is the type of flow distinguisher method + * The supported types are "ByUser" and "ByNamespace". + * Required. + * +required + */ + type?: string | undefined; +} + +/** + * 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". + * +k8s:supportsSubresource="/status" + */ +export interface FlowSchema { + /** + * metadata is the standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec is the specification of the desired behavior of a FlowSchema. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +required + */ + spec?: FlowSchemaSpec | undefined; + /** + * status is the current status of a FlowSchema. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: FlowSchemaStatus | undefined; +} + +/** FlowSchemaCondition describes conditions for a FlowSchema. */ +export interface FlowSchemaCondition { + /** + * type is the type of the condition. + * Required. + * +required + */ + type?: string | undefined; + /** + * status is the status of the condition. + * Should be specified and set to one of True, False, Unknown. + * +optional + */ + status?: string | undefined; + /** + * lastTransitionTime is the last time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * reason is a unique, one-word, CamelCase reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * message is a human-readable message indicating details about last transition. + * +optional + */ + message?: string | undefined; +} + +/** FlowSchemaList is a list of FlowSchema objects. */ +export interface FlowSchemaList { + /** + * `metadata` is the standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** `items` is a list of FlowSchemas. */ + items: FlowSchema[]; +} + +/** FlowSchemaSpec describes how the FlowSchema's specification looks like. */ +export interface FlowSchemaSpec { + /** + * priorityLevelConfiguration should reference a PriorityLevelConfiguration in the cluster. If the reference cannot + * be resolved, the FlowSchema will be ignored and marked as invalid in its status. + * Required. + * +required + */ + priorityLevelConfiguration?: PriorityLevelConfigurationReference | undefined; + /** + * matchingPrecedence is used to choose among the FlowSchemas that match a given request. The chosen + * FlowSchema is among those with the numerically lowest (which we take to be logically highest) + * MatchingPrecedence. Each MatchingPrecedence value must be ranged in [1,10000]. + * Note that if the precedence is not specified, it will be set to 1000 as default. + * +optional + */ + matchingPrecedence?: number | undefined; + /** + * distinguisherMethod defines how to compute the flow distinguisher for requests that match this schema. + * `nil` specifies that the distinguisher is disabled and thus will always be the empty string. + * +optional + */ + distinguisherMethod?: FlowDistinguisherMethod | undefined; + /** + * rules describes which requests will match this flow schema. This FlowSchema matches a request if and only if + * at least one member of rules matches the request. + * if it is an empty slice, there will be no requests matching the FlowSchema. + * +listType=atomic + * +optional + */ + rules: PolicyRulesWithSubjects[]; +} + +/** FlowSchemaStatus represents the current state of a FlowSchema. */ +export interface FlowSchemaStatus { + /** + * `conditions` is a list of the current states of FlowSchema. + * +listType=map + * +listMapKey=type + * +patchMergeKey=type + * +patchStrategy=merge + * +optional + */ + conditions: FlowSchemaCondition[]; +} + +/** GroupSubject holds detailed information for group-kind subject. */ +export interface GroupSubject { + /** + * name is the user group that matches, or "*" to match all user groups. + * See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some + * well-known group names. + * Required. + * +required + */ + name?: string | undefined; +} + +/** + * LimitResponse defines how to handle requests that can not be executed right now. + * +union + */ +export interface LimitResponse { + /** + * type is "Queue" or "Reject". + * "Queue" means that requests that can not be executed upon arrival + * are held in a queue until they can be executed or a queuing limit + * is reached. + * "Reject" means that requests that can not be executed upon arrival + * are rejected. + * Required. + * +required + * +unionDiscriminator + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:modeDiscriminator + */ + type?: string | undefined; + /** + * queuing holds the configuration parameters for queuing. + * This field may be non-empty only if `type` is `"Queue"`. + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:ifMode("Queue")=+k8s:required + */ + queuing?: QueuingConfiguration | undefined; +} + +/** + * LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. + * It addresses two issues: + * - How are requests for this priority level limited? + * - What should be done with requests that exceed the limit? + */ +export interface LimitedPriorityLevelConfiguration { + /** + * nominalConcurrencyShares (NCS) contributes to the computation of the + * NominalConcurrencyLimit (NominalCL) of this level. + * This is the number of execution seats available at this priority level. + * This is used both for requests dispatched from this priority level + * as well as requests dispatched from other priority levels + * borrowing seats from this level. + * The server's concurrency limit (ServerCL) is divided among the + * Limited priority levels in proportion to their NCS values: + * + * NominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) + * sum_ncs = sum[priority level k] NCS(k) + * + * Bigger numbers mean a larger nominal concurrency limit, + * at the expense of every other priority level. + * + * If not specified, this field defaults to a value of 30. + * + * Setting this field to zero supports the construction of a + * "jail" for this priority level that is used to hold some request(s) + * + * +optional + */ + nominalConcurrencyShares?: number | undefined; + /** + * limitResponse indicates what to do with requests that can not be executed right now + * +required + */ + limitResponse?: LimitResponse | undefined; + /** + * lendablePercent prescribes the fraction of the level's NominalCL that + * can be borrowed by other priority levels. The value of this + * field must be between 0 and 100, inclusive, and it defaults to 0. + * The number of seats that other levels can borrow from this level, known + * as this level's LendableConcurrencyLimit (LendableCL), is defined as follows. + * + * LendableCL(i) = round( NominalCL(i) * lendablePercent(i)/100.0 ) + * + * +optional + */ + lendablePercent?: number | undefined; + /** + * borrowingLimitPercent configures a limit on how many + * seats this priority level can borrow from other priority levels, if present. + * The limit is known as this level's BorrowingConcurrencyLimit + * (BorrowingCL) and is a limit on the total number of seats that this + * level may borrow at any one time. + * This field holds the ratio of that limit to the level's nominal + * concurrency limit. When this field is non-nil, it must hold a + * non-negative integer and the limit is calculated as follows. + * + * BorrowingCL(i) = round( NominalCL(i) * borrowingLimitPercent(i)/100.0 ) + * + * The value of this field can be more than 100, implying that this + * priority level can borrow a number of seats that is greater than + * its own nominal concurrency limit (NominalCL). + * When this field is left `nil`, the limit is effectively infinite. + * +optional + */ + borrowingLimitPercent?: number | undefined; +} + +/** + * NonResourcePolicyRule is a predicate that matches non-resource requests according to their verb and the + * target non-resource URL. A NonResourcePolicyRule matches a request if and only if both (a) at least one member + * of verbs matches the request and (b) at least one member of nonResourceURLs matches the request. + */ +export interface NonResourcePolicyRule { + /** + * verbs is a list of matching verbs and may not be empty. + * "*" matches all verbs. If it is present, it must be the only entry. + * +listType=set + * Required. + * +required + */ + verbs: string[]; + /** + * nonResourceURLs is a set of url prefixes that a user should have access to and may not be empty. + * For example: + * - "/healthz" is legal + * - "/hea*" is illegal + * - "/hea" is legal but matches nothing + * - "/hea/*" also matches nothing + * - "/healthz/*" matches all per-component health checks. + * "*" matches all non-resource urls. if it is present, it must be the only entry. + * +listType=set + * Required. + * +required + */ + nonResourceURLs: string[]; +} + +/** + * PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. The test considers the subject + * making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches + * a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member + * of resourceRules or nonResourceRules matches the request. + */ +export interface PolicyRulesWithSubjects { + /** + * subjects is the list of normal user, serviceaccount, or group that this rule cares about. + * There must be at least one member in this slice. + * A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. + * +listType=atomic + * Required. + * +required + */ + subjects: Subject[]; + /** + * resourceRules is a slice of ResourcePolicyRules that identify matching requests according to their verb and the + * target resource. + * At least one of `resourceRules` and `nonResourceRules` has to be non-empty. + * +listType=atomic + * +optional + */ + resourceRules: ResourcePolicyRule[]; + /** + * nonResourceRules is a list of NonResourcePolicyRules that identify matching requests according to their verb + * and the target non-resource URL. + * +listType=atomic + * +optional + */ + nonResourceRules: NonResourcePolicyRule[]; +} + +/** + * PriorityLevelConfiguration represents the configuration of a priority level. + * +k8s:supportsSubresource="/status" + */ +export interface PriorityLevelConfiguration { + /** + * metadata is the standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec is the specification of the desired behavior of a "request-priority". + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +required + */ + spec?: PriorityLevelConfigurationSpec | undefined; + /** + * status is the current status of a "request-priority". + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: PriorityLevelConfigurationStatus | undefined; +} + +/** PriorityLevelConfigurationCondition defines the condition of priority level. */ +export interface PriorityLevelConfigurationCondition { + /** + * type is the type of the condition. + * Required. + * +required + */ + type?: string | undefined; + /** + * status is the status of the condition. + * Should be specified and set to one of True, False, Unknown. + * +optional + */ + status?: string | undefined; + /** + * lastTransitionTime is the last time the condition transitioned from one status to another. + * +optional + */ + lastTransitionTime?: Time | undefined; + /** + * reason is a unique, one-word, CamelCase reason for the condition's last transition. + * +optional + */ + reason?: string | undefined; + /** + * message is a human-readable message indicating details about last transition. + * +optional + */ + message?: string | undefined; +} + +/** PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects. */ +export interface PriorityLevelConfigurationList { + /** + * `metadata` is the standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** `items` is a list of request-priorities. */ + items: PriorityLevelConfiguration[]; +} + +/** PriorityLevelConfigurationReference contains information that points to the "request-priority" being used. */ +export interface PriorityLevelConfigurationReference { + /** + * name is the name of the priority level configuration being referenced + * Required. + * +required + */ + name?: string | undefined; +} + +/** + * PriorityLevelConfigurationSpec specifies the configuration of a priority level. + * +union + */ +export interface PriorityLevelConfigurationSpec { + /** + * type indicates whether this priority level is subject to + * limitation on request execution. A value of `"Exempt"` means + * that requests of this priority level are not subject to a limit + * (and thus are never queued) and do not detract from the + * capacity made available to other priority levels. A value of + * `"Limited"` means that (a) requests of this priority level + * _are_ subject to limits and (b) some of the server's limited + * capacity is made available exclusively to this priority level. + * Required. + * +required + * +unionDiscriminator + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:modeDiscriminator + */ + type?: string | undefined; + /** + * limited specifies how requests are handled for a Limited priority level. + * This field must be non-empty if and only if type is `"Limited"`. + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:ifMode("Limited")=+k8s:required + */ + limited?: LimitedPriorityLevelConfiguration | undefined; + /** + * exempt specifies how requests are handled for an exempt priority level. + * This field MUST be empty if `type` is `"Limited"`. + * This field MAY be non-empty if `type` is `"Exempt"`. + * If empty and `type` is `"Exempt"` then the default values + * for `ExemptPriorityLevelConfiguration` apply. + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:ifMode("Exempt")=+k8s:optional + */ + exempt?: ExemptPriorityLevelConfiguration | undefined; +} + +/** PriorityLevelConfigurationStatus represents the current state of a "request-priority". */ +export interface PriorityLevelConfigurationStatus { + /** + * `conditions` is the current state of "request-priority". + * +listType=map + * +listMapKey=type + * +patchMergeKey=type + * +patchStrategy=merge + * +optional + */ + conditions: PriorityLevelConfigurationCondition[]; +} + +/** QueuingConfiguration holds the configuration parameters for queuing */ +export interface QueuingConfiguration { + /** + * queues is the number of queues for this priority level. The + * queues exist independently at each apiserver. The value must be + * positive. Setting it to 1 effectively precludes + * shufflesharding and thus makes the distinguisher method of + * associated flow schemas irrelevant. This field has a default + * value of 64. + * +optional + */ + queues?: number | undefined; + /** + * handSize is a small positive number that configures the + * shuffle sharding of requests into queues. When enqueuing a request + * at this priority level the request's flow identifier (a string + * pair) is hashed and the hash value is used to shuffle the list + * of queues and deal a hand of the size specified here. The + * request is put into one of the shortest queues in that hand. + * `handSize` must be no larger than `queues`, and should be + * significantly smaller (so that a few heavy flows do not + * saturate most of the queues). See the user-facing + * documentation for more extensive guidance on setting this + * field. This field has a default value of 8. + * +optional + */ + handSize?: number | undefined; + /** + * queueLengthLimit is the maximum number of requests allowed to + * be waiting in a given queue of this priority level at a time; + * excess requests are rejected. This value must be positive. If + * not specified, it will be defaulted to 50. + * +optional + */ + queueLengthLimit?: number | undefined; +} + +/** + * ResourcePolicyRule is a predicate that matches some resource + * requests, testing the request's verb and the target resource. A + * ResourcePolicyRule matches a resource request if and only if: (a) + * at least one member of verbs matches the request, (b) at least one + * member of apiGroups matches the request, (c) at least one member of + * resources matches the request, and (d) either (d1) the request does + * not specify a namespace (i.e., `Namespace==""`) and clusterScope is + * true or (d2) the request specifies a namespace and least one member + * of namespaces matches the request's namespace. + */ +export interface ResourcePolicyRule { + /** + * verbs is a list of matching verbs and may not be empty. + * "*" matches all verbs and, if present, must be the only entry. + * +listType=set + * Required. + * +required + */ + verbs: string[]; + /** + * apiGroups is a list of matching API groups and may not be empty. + * "*" matches all API groups and, if present, must be the only entry. + * +listType=set + * Required. + * +required + */ + apiGroups: string[]; + /** + * resources is a list of matching resources (i.e., lowercase + * and plural) with, if desired, subresource. For example, [ + * "services", "nodes/status" ]. This list may not be empty. + * "*" matches all resources and, if present, must be the only entry. + * Required. + * +listType=set + * +required + */ + resources: string[]; + /** + * clusterScope indicates whether to match requests that do not + * specify a namespace (which happens either because the resource + * is not namespaced or the request targets all namespaces). + * If this field is omitted or false then the `namespaces` field + * must contain a non-empty list. + * +optional + */ + clusterScope?: boolean | undefined; + /** + * namespaces is a list of target namespaces that restricts + * matches. A request that specifies a target namespace matches + * only if either (a) this list contains that target namespace or + * (b) this list contains "*". Note that "*" matches any + * specified namespace but does not match a request that _does + * not specify_ a namespace (see the `clusterScope` field for + * that). + * This list may be empty, but only if `clusterScope` is true. + * +optional + * +listType=set + */ + namespaces: string[]; +} + +/** ServiceAccountSubject holds detailed information for service-account-kind subject. */ +export interface ServiceAccountSubject { + /** + * namespace is the namespace of matching ServiceAccount objects. + * Required. + * +required + */ + namespace?: string | undefined; + /** + * name is the name of matching ServiceAccount objects, or "*" to match regardless of name. + * Required. + * +required + */ + name?: string | undefined; +} + +/** + * Subject matches the originator of a request, as identified by the request authentication system. There are three + * ways of matching an originator; by user, group, or service account. + * +union + */ +export interface Subject { + /** + * kind indicates which one of the other fields is non-empty. + * Required + * +required + * +unionDiscriminator + */ + kind?: string | undefined; + /** + * user matches based on username. + * +optional + */ + user?: UserSubject | undefined; + /** + * group matches based on user group name. + * +optional + */ + group?: GroupSubject | undefined; + /** + * serviceAccount matches ServiceAccounts. + * +optional + */ + serviceAccount?: ServiceAccountSubject | undefined; +} + +/** UserSubject holds detailed information for user-kind subject. */ +export interface UserSubject { + /** + * name is the username that matches, or "*" to match all usernames. + * Required. + * +required + */ + name?: string | undefined; +} + +function createBaseExemptPriorityLevelConfiguration(): ExemptPriorityLevelConfiguration { + return { nominalConcurrencyShares: 0, lendablePercent: 0 }; +} + +export const ExemptPriorityLevelConfiguration: MessageFns = { + encode( + message: ExemptPriorityLevelConfiguration, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.nominalConcurrencyShares !== undefined && message.nominalConcurrencyShares !== 0) { + writer.uint32(8).int32(message.nominalConcurrencyShares); + } + if (message.lendablePercent !== undefined && message.lendablePercent !== 0) { + writer.uint32(16).int32(message.lendablePercent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExemptPriorityLevelConfiguration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExemptPriorityLevelConfiguration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.nominalConcurrencyShares = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.lendablePercent = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ExemptPriorityLevelConfiguration { + return { + nominalConcurrencyShares: isSet(object.nominalConcurrencyShares) + ? globalThis.Number(object.nominalConcurrencyShares) + : 0, + lendablePercent: isSet(object.lendablePercent) ? globalThis.Number(object.lendablePercent) : 0, + }; + }, + + toJSON(message: ExemptPriorityLevelConfiguration): unknown { + const obj: any = {}; + if (message.nominalConcurrencyShares !== undefined && message.nominalConcurrencyShares !== 0) { + obj.nominalConcurrencyShares = Math.round(message.nominalConcurrencyShares); + } + if (message.lendablePercent !== undefined && message.lendablePercent !== 0) { + obj.lendablePercent = Math.round(message.lendablePercent); + } + return obj; + }, + + create, I>>( + base?: I, + ): ExemptPriorityLevelConfiguration { + return ExemptPriorityLevelConfiguration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExemptPriorityLevelConfiguration { + const message = createBaseExemptPriorityLevelConfiguration(); + message.nominalConcurrencyShares = object.nominalConcurrencyShares ?? 0; + message.lendablePercent = object.lendablePercent ?? 0; + return message; + }, +}; + +function createBaseFlowDistinguisherMethod(): FlowDistinguisherMethod { + return { type: '' }; +} + +export const FlowDistinguisherMethod: MessageFns = { + encode(message: FlowDistinguisherMethod, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlowDistinguisherMethod { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlowDistinguisherMethod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FlowDistinguisherMethod { + return { type: isSet(object.type) ? globalThis.String(object.type) : '' }; + }, + + toJSON(message: FlowDistinguisherMethod): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + return obj; + }, + + create, I>>(base?: I): FlowDistinguisherMethod { + return FlowDistinguisherMethod.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FlowDistinguisherMethod { + const message = createBaseFlowDistinguisherMethod(); + message.type = object.type ?? ''; + return message; + }, +}; + +function createBaseFlowSchema(): FlowSchema { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const FlowSchema: MessageFns = { + encode(message: FlowSchema, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + FlowSchemaSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + FlowSchemaStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlowSchema { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlowSchema(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = FlowSchemaSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = FlowSchemaStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FlowSchema { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? FlowSchemaSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? FlowSchemaStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: FlowSchema): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = FlowSchemaSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = FlowSchemaStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): FlowSchema { + return FlowSchema.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FlowSchema { + const message = createBaseFlowSchema(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? FlowSchemaSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? FlowSchemaStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseFlowSchemaCondition(): FlowSchemaCondition { + return { type: '', status: '', lastTransitionTime: undefined, reason: '', message: '' }; +} + +export const FlowSchemaCondition: MessageFns = { + encode(message: FlowSchemaCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(26).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(42).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlowSchemaCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlowSchemaCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FlowSchemaCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: FlowSchemaCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): FlowSchemaCondition { + return FlowSchemaCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FlowSchemaCondition { + const message = createBaseFlowSchemaCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBaseFlowSchemaList(): FlowSchemaList { + return { metadata: undefined, items: [] }; +} + +export const FlowSchemaList: MessageFns = { + encode(message: FlowSchemaList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + FlowSchema.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlowSchemaList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlowSchemaList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(FlowSchema.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FlowSchemaList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => FlowSchema.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FlowSchemaList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => FlowSchema.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FlowSchemaList { + return FlowSchemaList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FlowSchemaList { + const message = createBaseFlowSchemaList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => FlowSchema.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFlowSchemaSpec(): FlowSchemaSpec { + return { + priorityLevelConfiguration: undefined, + matchingPrecedence: 0, + distinguisherMethod: undefined, + rules: [], + }; +} + +export const FlowSchemaSpec: MessageFns = { + encode(message: FlowSchemaSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.priorityLevelConfiguration !== undefined) { + PriorityLevelConfigurationReference.encode( + message.priorityLevelConfiguration, + writer.uint32(10).fork(), + ).join(); + } + if (message.matchingPrecedence !== undefined && message.matchingPrecedence !== 0) { + writer.uint32(16).int32(message.matchingPrecedence); + } + if (message.distinguisherMethod !== undefined) { + FlowDistinguisherMethod.encode(message.distinguisherMethod, writer.uint32(26).fork()).join(); + } + for (const v of message.rules) { + PolicyRulesWithSubjects.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlowSchemaSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlowSchemaSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.priorityLevelConfiguration = PriorityLevelConfigurationReference.decode( + reader, + reader.uint32(), + ); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.matchingPrecedence = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.distinguisherMethod = FlowDistinguisherMethod.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.rules.push(PolicyRulesWithSubjects.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FlowSchemaSpec { + return { + priorityLevelConfiguration: isSet(object.priorityLevelConfiguration) + ? PriorityLevelConfigurationReference.fromJSON(object.priorityLevelConfiguration) + : undefined, + matchingPrecedence: isSet(object.matchingPrecedence) + ? globalThis.Number(object.matchingPrecedence) + : 0, + distinguisherMethod: isSet(object.distinguisherMethod) + ? FlowDistinguisherMethod.fromJSON(object.distinguisherMethod) + : undefined, + rules: globalThis.Array.isArray(object?.rules) + ? object.rules.map((e: any) => PolicyRulesWithSubjects.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FlowSchemaSpec): unknown { + const obj: any = {}; + if (message.priorityLevelConfiguration !== undefined) { + obj.priorityLevelConfiguration = PriorityLevelConfigurationReference.toJSON( + message.priorityLevelConfiguration, + ); + } + if (message.matchingPrecedence !== undefined && message.matchingPrecedence !== 0) { + obj.matchingPrecedence = Math.round(message.matchingPrecedence); + } + if (message.distinguisherMethod !== undefined) { + obj.distinguisherMethod = FlowDistinguisherMethod.toJSON(message.distinguisherMethod); + } + if (message.rules?.length) { + obj.rules = message.rules.map((e) => PolicyRulesWithSubjects.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FlowSchemaSpec { + return FlowSchemaSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FlowSchemaSpec { + const message = createBaseFlowSchemaSpec(); + message.priorityLevelConfiguration = + object.priorityLevelConfiguration !== undefined && object.priorityLevelConfiguration !== null + ? PriorityLevelConfigurationReference.fromPartial(object.priorityLevelConfiguration) + : undefined; + message.matchingPrecedence = object.matchingPrecedence ?? 0; + message.distinguisherMethod = + object.distinguisherMethod !== undefined && object.distinguisherMethod !== null + ? FlowDistinguisherMethod.fromPartial(object.distinguisherMethod) + : undefined; + message.rules = object.rules?.map((e) => PolicyRulesWithSubjects.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFlowSchemaStatus(): FlowSchemaStatus { + return { conditions: [] }; +} + +export const FlowSchemaStatus: MessageFns = { + encode(message: FlowSchemaStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.conditions) { + FlowSchemaCondition.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FlowSchemaStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFlowSchemaStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.conditions.push(FlowSchemaCondition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FlowSchemaStatus { + return { + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => FlowSchemaCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FlowSchemaStatus): unknown { + const obj: any = {}; + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => FlowSchemaCondition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FlowSchemaStatus { + return FlowSchemaStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FlowSchemaStatus { + const message = createBaseFlowSchemaStatus(); + message.conditions = object.conditions?.map((e) => FlowSchemaCondition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGroupSubject(): GroupSubject { + return { name: '' }; +} + +export const GroupSubject: MessageFns = { + encode(message: GroupSubject, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupSubject { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupSubject(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GroupSubject { + return { name: isSet(object.name) ? globalThis.String(object.name) : '' }; + }, + + toJSON(message: GroupSubject): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): GroupSubject { + return GroupSubject.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupSubject { + const message = createBaseGroupSubject(); + message.name = object.name ?? ''; + return message; + }, +}; + +function createBaseLimitResponse(): LimitResponse { + return { type: '', queuing: undefined }; +} + +export const LimitResponse: MessageFns = { + encode(message: LimitResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.queuing !== undefined) { + QueuingConfiguration.encode(message.queuing, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LimitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.queuing = QueuingConfiguration.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LimitResponse { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + queuing: isSet(object.queuing) ? QueuingConfiguration.fromJSON(object.queuing) : undefined, + }; + }, + + toJSON(message: LimitResponse): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.queuing !== undefined) { + obj.queuing = QueuingConfiguration.toJSON(message.queuing); + } + return obj; + }, + + create, I>>(base?: I): LimitResponse { + return LimitResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LimitResponse { + const message = createBaseLimitResponse(); + message.type = object.type ?? ''; + message.queuing = + object.queuing !== undefined && object.queuing !== null + ? QueuingConfiguration.fromPartial(object.queuing) + : undefined; + return message; + }, +}; + +function createBaseLimitedPriorityLevelConfiguration(): LimitedPriorityLevelConfiguration { + return { + nominalConcurrencyShares: 0, + limitResponse: undefined, + lendablePercent: 0, + borrowingLimitPercent: 0, + }; +} + +export const LimitedPriorityLevelConfiguration: MessageFns = { + encode( + message: LimitedPriorityLevelConfiguration, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.nominalConcurrencyShares !== undefined && message.nominalConcurrencyShares !== 0) { + writer.uint32(8).int32(message.nominalConcurrencyShares); + } + if (message.limitResponse !== undefined) { + LimitResponse.encode(message.limitResponse, writer.uint32(18).fork()).join(); + } + if (message.lendablePercent !== undefined && message.lendablePercent !== 0) { + writer.uint32(24).int32(message.lendablePercent); + } + if (message.borrowingLimitPercent !== undefined && message.borrowingLimitPercent !== 0) { + writer.uint32(32).int32(message.borrowingLimitPercent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LimitedPriorityLevelConfiguration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitedPriorityLevelConfiguration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.nominalConcurrencyShares = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.limitResponse = LimitResponse.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.lendablePercent = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.borrowingLimitPercent = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LimitedPriorityLevelConfiguration { + return { + nominalConcurrencyShares: isSet(object.nominalConcurrencyShares) + ? globalThis.Number(object.nominalConcurrencyShares) + : 0, + limitResponse: isSet(object.limitResponse) + ? LimitResponse.fromJSON(object.limitResponse) + : undefined, + lendablePercent: isSet(object.lendablePercent) ? globalThis.Number(object.lendablePercent) : 0, + borrowingLimitPercent: isSet(object.borrowingLimitPercent) + ? globalThis.Number(object.borrowingLimitPercent) + : 0, + }; + }, + + toJSON(message: LimitedPriorityLevelConfiguration): unknown { + const obj: any = {}; + if (message.nominalConcurrencyShares !== undefined && message.nominalConcurrencyShares !== 0) { + obj.nominalConcurrencyShares = Math.round(message.nominalConcurrencyShares); + } + if (message.limitResponse !== undefined) { + obj.limitResponse = LimitResponse.toJSON(message.limitResponse); + } + if (message.lendablePercent !== undefined && message.lendablePercent !== 0) { + obj.lendablePercent = Math.round(message.lendablePercent); + } + if (message.borrowingLimitPercent !== undefined && message.borrowingLimitPercent !== 0) { + obj.borrowingLimitPercent = Math.round(message.borrowingLimitPercent); + } + return obj; + }, + + create, I>>( + base?: I, + ): LimitedPriorityLevelConfiguration { + return LimitedPriorityLevelConfiguration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): LimitedPriorityLevelConfiguration { + const message = createBaseLimitedPriorityLevelConfiguration(); + message.nominalConcurrencyShares = object.nominalConcurrencyShares ?? 0; + message.limitResponse = + object.limitResponse !== undefined && object.limitResponse !== null + ? LimitResponse.fromPartial(object.limitResponse) + : undefined; + message.lendablePercent = object.lendablePercent ?? 0; + message.borrowingLimitPercent = object.borrowingLimitPercent ?? 0; + return message; + }, +}; + +function createBaseNonResourcePolicyRule(): NonResourcePolicyRule { + return { verbs: [], nonResourceURLs: [] }; +} + +export const NonResourcePolicyRule: MessageFns = { + encode(message: NonResourcePolicyRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.verbs) { + writer.uint32(10).string(v!); + } + for (const v of message.nonResourceURLs) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NonResourcePolicyRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNonResourcePolicyRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.verbs.push(reader.string()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.nonResourceURLs.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NonResourcePolicyRule { + return { + verbs: globalThis.Array.isArray(object?.verbs) + ? object.verbs.map((e: any) => globalThis.String(e)) + : [], + nonResourceURLs: globalThis.Array.isArray(object?.nonResourceURLs) + ? object.nonResourceURLs.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: NonResourcePolicyRule): unknown { + const obj: any = {}; + if (message.verbs?.length) { + obj.verbs = message.verbs; + } + if (message.nonResourceURLs?.length) { + obj.nonResourceURLs = message.nonResourceURLs; + } + return obj; + }, + + create, I>>(base?: I): NonResourcePolicyRule { + return NonResourcePolicyRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NonResourcePolicyRule { + const message = createBaseNonResourcePolicyRule(); + message.verbs = object.verbs?.map((e) => e) || []; + message.nonResourceURLs = object.nonResourceURLs?.map((e) => e) || []; + return message; + }, +}; + +function createBasePolicyRulesWithSubjects(): PolicyRulesWithSubjects { + return { subjects: [], resourceRules: [], nonResourceRules: [] }; +} + +export const PolicyRulesWithSubjects: MessageFns = { + encode(message: PolicyRulesWithSubjects, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.subjects) { + Subject.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.resourceRules) { + ResourcePolicyRule.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.nonResourceRules) { + NonResourcePolicyRule.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PolicyRulesWithSubjects { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePolicyRulesWithSubjects(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.subjects.push(Subject.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resourceRules.push(ResourcePolicyRule.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.nonResourceRules.push(NonResourcePolicyRule.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PolicyRulesWithSubjects { + return { + subjects: globalThis.Array.isArray(object?.subjects) + ? object.subjects.map((e: any) => Subject.fromJSON(e)) + : [], + resourceRules: globalThis.Array.isArray(object?.resourceRules) + ? object.resourceRules.map((e: any) => ResourcePolicyRule.fromJSON(e)) + : [], + nonResourceRules: globalThis.Array.isArray(object?.nonResourceRules) + ? object.nonResourceRules.map((e: any) => NonResourcePolicyRule.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PolicyRulesWithSubjects): unknown { + const obj: any = {}; + if (message.subjects?.length) { + obj.subjects = message.subjects.map((e) => Subject.toJSON(e)); + } + if (message.resourceRules?.length) { + obj.resourceRules = message.resourceRules.map((e) => ResourcePolicyRule.toJSON(e)); + } + if (message.nonResourceRules?.length) { + obj.nonResourceRules = message.nonResourceRules.map((e) => NonResourcePolicyRule.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PolicyRulesWithSubjects { + return PolicyRulesWithSubjects.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PolicyRulesWithSubjects { + const message = createBasePolicyRulesWithSubjects(); + message.subjects = object.subjects?.map((e) => Subject.fromPartial(e)) || []; + message.resourceRules = object.resourceRules?.map((e) => ResourcePolicyRule.fromPartial(e)) || []; + message.nonResourceRules = + object.nonResourceRules?.map((e) => NonResourcePolicyRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePriorityLevelConfiguration(): PriorityLevelConfiguration { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const PriorityLevelConfiguration: MessageFns = { + encode(message: PriorityLevelConfiguration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + PriorityLevelConfigurationSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + PriorityLevelConfigurationStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PriorityLevelConfiguration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePriorityLevelConfiguration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = PriorityLevelConfigurationSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = PriorityLevelConfigurationStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PriorityLevelConfiguration { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? PriorityLevelConfigurationSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) + ? PriorityLevelConfigurationStatus.fromJSON(object.status) + : undefined, + }; + }, + + toJSON(message: PriorityLevelConfiguration): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = PriorityLevelConfigurationSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = PriorityLevelConfigurationStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>( + base?: I, + ): PriorityLevelConfiguration { + return PriorityLevelConfiguration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PriorityLevelConfiguration { + const message = createBasePriorityLevelConfiguration(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? PriorityLevelConfigurationSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? PriorityLevelConfigurationStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBasePriorityLevelConfigurationCondition(): PriorityLevelConfigurationCondition { + return { type: '', status: '', lastTransitionTime: undefined, reason: '', message: '' }; +} + +export const PriorityLevelConfigurationCondition: MessageFns = { + encode( + message: PriorityLevelConfigurationCondition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== '') { + writer.uint32(18).string(message.status); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(26).fork()).join(); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(34).string(message.reason); + } + if (message.message !== undefined && message.message !== '') { + writer.uint32(42).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PriorityLevelConfigurationCondition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePriorityLevelConfigurationCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PriorityLevelConfigurationCondition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + status: isSet(object.status) ? globalThis.String(object.status) : '', + lastTransitionTime: isSet(object.lastTransitionTime) + ? Time.fromJSON(object.lastTransitionTime) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + message: isSet(object.message) ? globalThis.String(object.message) : '', + }; + }, + + toJSON(message: PriorityLevelConfigurationCondition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== '') { + obj.status = message.status; + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== '') { + obj.message = message.message; + } + return obj; + }, + + create, I>>( + base?: I, + ): PriorityLevelConfigurationCondition { + return PriorityLevelConfigurationCondition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PriorityLevelConfigurationCondition { + const message = createBasePriorityLevelConfigurationCondition(); + message.type = object.type ?? ''; + message.status = object.status ?? ''; + message.lastTransitionTime = + object.lastTransitionTime !== undefined && object.lastTransitionTime !== null + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ''; + message.message = object.message ?? ''; + return message; + }, +}; + +function createBasePriorityLevelConfigurationList(): PriorityLevelConfigurationList { + return { metadata: undefined, items: [] }; +} + +export const PriorityLevelConfigurationList: MessageFns = { + encode(message: PriorityLevelConfigurationList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + PriorityLevelConfiguration.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PriorityLevelConfigurationList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePriorityLevelConfigurationList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(PriorityLevelConfiguration.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PriorityLevelConfigurationList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => PriorityLevelConfiguration.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PriorityLevelConfigurationList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => PriorityLevelConfiguration.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PriorityLevelConfigurationList { + return PriorityLevelConfigurationList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PriorityLevelConfigurationList { + const message = createBasePriorityLevelConfigurationList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => PriorityLevelConfiguration.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePriorityLevelConfigurationReference(): PriorityLevelConfigurationReference { + return { name: '' }; +} + +export const PriorityLevelConfigurationReference: MessageFns = { + encode( + message: PriorityLevelConfigurationReference, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PriorityLevelConfigurationReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePriorityLevelConfigurationReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PriorityLevelConfigurationReference { + return { name: isSet(object.name) ? globalThis.String(object.name) : '' }; + }, + + toJSON(message: PriorityLevelConfigurationReference): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + return obj; + }, + + create, I>>( + base?: I, + ): PriorityLevelConfigurationReference { + return PriorityLevelConfigurationReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PriorityLevelConfigurationReference { + const message = createBasePriorityLevelConfigurationReference(); + message.name = object.name ?? ''; + return message; + }, +}; + +function createBasePriorityLevelConfigurationSpec(): PriorityLevelConfigurationSpec { + return { type: '', limited: undefined, exempt: undefined }; +} + +export const PriorityLevelConfigurationSpec: MessageFns = { + encode(message: PriorityLevelConfigurationSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== '') { + writer.uint32(10).string(message.type); + } + if (message.limited !== undefined) { + LimitedPriorityLevelConfiguration.encode(message.limited, writer.uint32(18).fork()).join(); + } + if (message.exempt !== undefined) { + ExemptPriorityLevelConfiguration.encode(message.exempt, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PriorityLevelConfigurationSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePriorityLevelConfigurationSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.limited = LimitedPriorityLevelConfiguration.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.exempt = ExemptPriorityLevelConfiguration.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PriorityLevelConfigurationSpec { + return { + type: isSet(object.type) ? globalThis.String(object.type) : '', + limited: isSet(object.limited) + ? LimitedPriorityLevelConfiguration.fromJSON(object.limited) + : undefined, + exempt: isSet(object.exempt) + ? ExemptPriorityLevelConfiguration.fromJSON(object.exempt) + : undefined, + }; + }, + + toJSON(message: PriorityLevelConfigurationSpec): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== '') { + obj.type = message.type; + } + if (message.limited !== undefined) { + obj.limited = LimitedPriorityLevelConfiguration.toJSON(message.limited); + } + if (message.exempt !== undefined) { + obj.exempt = ExemptPriorityLevelConfiguration.toJSON(message.exempt); + } + return obj; + }, + + create, I>>( + base?: I, + ): PriorityLevelConfigurationSpec { + return PriorityLevelConfigurationSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PriorityLevelConfigurationSpec { + const message = createBasePriorityLevelConfigurationSpec(); + message.type = object.type ?? ''; + message.limited = + object.limited !== undefined && object.limited !== null + ? LimitedPriorityLevelConfiguration.fromPartial(object.limited) + : undefined; + message.exempt = + object.exempt !== undefined && object.exempt !== null + ? ExemptPriorityLevelConfiguration.fromPartial(object.exempt) + : undefined; + return message; + }, +}; + +function createBasePriorityLevelConfigurationStatus(): PriorityLevelConfigurationStatus { + return { conditions: [] }; +} + +export const PriorityLevelConfigurationStatus: MessageFns = { + encode( + message: PriorityLevelConfigurationStatus, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + for (const v of message.conditions) { + PriorityLevelConfigurationCondition.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PriorityLevelConfigurationStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePriorityLevelConfigurationStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.conditions.push( + PriorityLevelConfigurationCondition.decode(reader, reader.uint32()), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PriorityLevelConfigurationStatus { + return { + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => PriorityLevelConfigurationCondition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PriorityLevelConfigurationStatus): unknown { + const obj: any = {}; + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => PriorityLevelConfigurationCondition.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): PriorityLevelConfigurationStatus { + return PriorityLevelConfigurationStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PriorityLevelConfigurationStatus { + const message = createBasePriorityLevelConfigurationStatus(); + message.conditions = + object.conditions?.map((e) => PriorityLevelConfigurationCondition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueuingConfiguration(): QueuingConfiguration { + return { queues: 0, handSize: 0, queueLengthLimit: 0 }; +} + +export const QueuingConfiguration: MessageFns = { + encode(message: QueuingConfiguration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.queues !== undefined && message.queues !== 0) { + writer.uint32(8).int32(message.queues); + } + if (message.handSize !== undefined && message.handSize !== 0) { + writer.uint32(16).int32(message.handSize); + } + if (message.queueLengthLimit !== undefined && message.queueLengthLimit !== 0) { + writer.uint32(24).int32(message.queueLengthLimit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuingConfiguration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuingConfiguration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.queues = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.handSize = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.queueLengthLimit = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): QueuingConfiguration { + return { + queues: isSet(object.queues) ? globalThis.Number(object.queues) : 0, + handSize: isSet(object.handSize) ? globalThis.Number(object.handSize) : 0, + queueLengthLimit: isSet(object.queueLengthLimit) ? globalThis.Number(object.queueLengthLimit) : 0, + }; + }, + + toJSON(message: QueuingConfiguration): unknown { + const obj: any = {}; + if (message.queues !== undefined && message.queues !== 0) { + obj.queues = Math.round(message.queues); + } + if (message.handSize !== undefined && message.handSize !== 0) { + obj.handSize = Math.round(message.handSize); + } + if (message.queueLengthLimit !== undefined && message.queueLengthLimit !== 0) { + obj.queueLengthLimit = Math.round(message.queueLengthLimit); + } + return obj; + }, + + create, I>>(base?: I): QueuingConfiguration { + return QueuingConfiguration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueuingConfiguration { + const message = createBaseQueuingConfiguration(); + message.queues = object.queues ?? 0; + message.handSize = object.handSize ?? 0; + message.queueLengthLimit = object.queueLengthLimit ?? 0; + return message; + }, +}; + +function createBaseResourcePolicyRule(): ResourcePolicyRule { + return { verbs: [], apiGroups: [], resources: [], clusterScope: false, namespaces: [] }; +} + +export const ResourcePolicyRule: MessageFns = { + encode(message: ResourcePolicyRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.verbs) { + writer.uint32(10).string(v!); + } + for (const v of message.apiGroups) { + writer.uint32(18).string(v!); + } + for (const v of message.resources) { + writer.uint32(26).string(v!); + } + if (message.clusterScope !== undefined && message.clusterScope !== false) { + writer.uint32(32).bool(message.clusterScope); + } + for (const v of message.namespaces) { + writer.uint32(42).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourcePolicyRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourcePolicyRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.verbs.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.apiGroups.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.resources.push(reader.string()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.clusterScope = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.namespaces.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ResourcePolicyRule { + return { + verbs: globalThis.Array.isArray(object?.verbs) + ? object.verbs.map((e: any) => globalThis.String(e)) + : [], + apiGroups: globalThis.Array.isArray(object?.apiGroups) + ? object.apiGroups.map((e: any) => globalThis.String(e)) + : [], + resources: globalThis.Array.isArray(object?.resources) + ? object.resources.map((e: any) => globalThis.String(e)) + : [], + clusterScope: isSet(object.clusterScope) ? globalThis.Boolean(object.clusterScope) : false, + namespaces: globalThis.Array.isArray(object?.namespaces) + ? object.namespaces.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ResourcePolicyRule): unknown { + const obj: any = {}; + if (message.verbs?.length) { + obj.verbs = message.verbs; + } + if (message.apiGroups?.length) { + obj.apiGroups = message.apiGroups; + } + if (message.resources?.length) { + obj.resources = message.resources; + } + if (message.clusterScope !== undefined && message.clusterScope !== false) { + obj.clusterScope = message.clusterScope; + } + if (message.namespaces?.length) { + obj.namespaces = message.namespaces; + } + return obj; + }, + + create, I>>(base?: I): ResourcePolicyRule { + return ResourcePolicyRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourcePolicyRule { + const message = createBaseResourcePolicyRule(); + message.verbs = object.verbs?.map((e) => e) || []; + message.apiGroups = object.apiGroups?.map((e) => e) || []; + message.resources = object.resources?.map((e) => e) || []; + message.clusterScope = object.clusterScope ?? false; + message.namespaces = object.namespaces?.map((e) => e) || []; + return message; + }, +}; + +function createBaseServiceAccountSubject(): ServiceAccountSubject { + return { namespace: '', name: '' }; +} + +export const ServiceAccountSubject: MessageFns = { + encode(message: ServiceAccountSubject, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(10).string(message.namespace); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(18).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceAccountSubject { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceAccountSubject(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.namespace = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceAccountSubject { + return { + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + }; + }, + + toJSON(message: ServiceAccountSubject): unknown { + const obj: any = {}; + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): ServiceAccountSubject { + return ServiceAccountSubject.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceAccountSubject { + const message = createBaseServiceAccountSubject(); + message.namespace = object.namespace ?? ''; + message.name = object.name ?? ''; + return message; + }, +}; + +function createBaseSubject(): Subject { + return { kind: '', user: undefined, group: undefined, serviceAccount: undefined }; +} + +export const Subject: MessageFns = { + encode(message: Subject, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kind !== undefined && message.kind !== '') { + writer.uint32(10).string(message.kind); + } + if (message.user !== undefined) { + UserSubject.encode(message.user, writer.uint32(18).fork()).join(); + } + if (message.group !== undefined) { + GroupSubject.encode(message.group, writer.uint32(26).fork()).join(); + } + if (message.serviceAccount !== undefined) { + ServiceAccountSubject.encode(message.serviceAccount, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Subject { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubject(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.user = UserSubject.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.group = GroupSubject.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.serviceAccount = ServiceAccountSubject.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Subject { + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : '', + user: isSet(object.user) ? UserSubject.fromJSON(object.user) : undefined, + group: isSet(object.group) ? GroupSubject.fromJSON(object.group) : undefined, + serviceAccount: isSet(object.serviceAccount) + ? ServiceAccountSubject.fromJSON(object.serviceAccount) + : undefined, + }; + }, + + toJSON(message: Subject): unknown { + const obj: any = {}; + if (message.kind !== undefined && message.kind !== '') { + obj.kind = message.kind; + } + if (message.user !== undefined) { + obj.user = UserSubject.toJSON(message.user); + } + if (message.group !== undefined) { + obj.group = GroupSubject.toJSON(message.group); + } + if (message.serviceAccount !== undefined) { + obj.serviceAccount = ServiceAccountSubject.toJSON(message.serviceAccount); + } + return obj; + }, + + create, I>>(base?: I): Subject { + return Subject.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Subject { + const message = createBaseSubject(); + message.kind = object.kind ?? ''; + message.user = + object.user !== undefined && object.user !== null + ? UserSubject.fromPartial(object.user) + : undefined; + message.group = + object.group !== undefined && object.group !== null + ? GroupSubject.fromPartial(object.group) + : undefined; + message.serviceAccount = + object.serviceAccount !== undefined && object.serviceAccount !== null + ? ServiceAccountSubject.fromPartial(object.serviceAccount) + : undefined; + return message; + }, +}; + +function createBaseUserSubject(): UserSubject { + return { name: '' }; +} + +export const UserSubject: MessageFns = { + encode(message: UserSubject, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserSubject { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserSubject(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): UserSubject { + return { name: isSet(object.name) ? globalThis.String(object.name) : '' }; + }, + + toJSON(message: UserSubject): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): UserSubject { + return UserSubject.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UserSubject { + const message = createBaseUserSubject(); + message.name = object.name ?? ''; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/imagepolicy/v1alpha1/generated.ts b/src/proto/generated/k8s.io/api/imagepolicy/v1alpha1/generated.ts new file mode 100644 index 00000000000..7198b187744 --- /dev/null +++ b/src/proto/generated/k8s.io/api/imagepolicy/v1alpha1/generated.ts @@ -0,0 +1,766 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/imagepolicy/v1alpha1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { ObjectMeta } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** + * ImageReview checks if the set of images in a pod are allowed. + * +k8s:supportsSubresource="/status" + */ +export interface ImageReview { + /** + * metadata is the standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * spec holds information about the pod being evaluated + * +optional + */ + spec?: ImageReviewSpec | undefined; + /** + * status is filled in by the backend and indicates whether the pod should be allowed. + * +optional + */ + status?: ImageReviewStatus | undefined; +} + +/** ImageReviewContainerSpec is a description of a container within the pod creation request. */ +export interface ImageReviewContainerSpec { + /** + * image can be in the form image:tag or image@SHA:012345679abcdef. + * +optional + */ + image?: string | undefined; +} + +/** ImageReviewSpec is a description of the pod creation request. */ +export interface ImageReviewSpec { + /** + * containers is a list of a subset of the information in each container of the Pod being created. + * +optional + * +listType=atomic + */ + containers: ImageReviewContainerSpec[]; + /** + * annotations is a list of key-value pairs extracted from the Pod's annotations. + * It only includes keys which match the pattern `*.image-policy.k8s.io/*`. + * It is up to each webhook backend to determine how to interpret these annotations, if at all. + * +optional + */ + annotations: { [key: string]: string }; + /** + * namespace is the namespace the pod is being created in. + * +optional + */ + namespace?: string | undefined; +} + +export interface ImageReviewSpec_AnnotationsEntry { + key: string; + value: string; +} + +/** ImageReviewStatus is the result of the review for the pod creation request. */ +export interface ImageReviewStatus { + /** + * allowed indicates that all images were allowed to be run. + * +optional + */ + allowed?: boolean | undefined; + /** + * reason should be empty unless Allowed is false in which case it + * may contain a short description of what is wrong. Kubernetes + * may truncate excessively long errors when displaying to the user. + * +optional + */ + reason?: string | undefined; + /** + * auditAnnotations will be added to the attributes object of the + * admission controller request using 'AddAnnotation'. The keys should + * be prefix-less (i.e., the admission controller will add an + * appropriate prefix). + * +optional + */ + auditAnnotations: { [key: string]: string }; +} + +export interface ImageReviewStatus_AuditAnnotationsEntry { + key: string; + value: string; +} + +function createBaseImageReview(): ImageReview { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const ImageReview: MessageFns = { + encode(message: ImageReview, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + ImageReviewSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + ImageReviewStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ImageReview { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseImageReview(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = ImageReviewSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = ImageReviewStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ImageReview { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? ImageReviewSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? ImageReviewStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: ImageReview): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = ImageReviewSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = ImageReviewStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ImageReview { + return ImageReview.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ImageReview { + const message = createBaseImageReview(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? ImageReviewSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? ImageReviewStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseImageReviewContainerSpec(): ImageReviewContainerSpec { + return { image: '' }; +} + +export const ImageReviewContainerSpec: MessageFns = { + encode(message: ImageReviewContainerSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.image !== undefined && message.image !== '') { + writer.uint32(10).string(message.image); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ImageReviewContainerSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseImageReviewContainerSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.image = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ImageReviewContainerSpec { + return { image: isSet(object.image) ? globalThis.String(object.image) : '' }; + }, + + toJSON(message: ImageReviewContainerSpec): unknown { + const obj: any = {}; + if (message.image !== undefined && message.image !== '') { + obj.image = message.image; + } + return obj; + }, + + create, I>>(base?: I): ImageReviewContainerSpec { + return ImageReviewContainerSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ImageReviewContainerSpec { + const message = createBaseImageReviewContainerSpec(); + message.image = object.image ?? ''; + return message; + }, +}; + +function createBaseImageReviewSpec(): ImageReviewSpec { + return { containers: [], annotations: {}, namespace: '' }; +} + +export const ImageReviewSpec: MessageFns = { + encode(message: ImageReviewSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.containers) { + ImageReviewContainerSpec.encode(v!, writer.uint32(10).fork()).join(); + } + globalThis.Object.entries(message.annotations).forEach(([key, value]: [string, string]) => { + ImageReviewSpec_AnnotationsEntry.encode( + { key: key as any, value }, + writer.uint32(18).fork(), + ).join(); + }); + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(26).string(message.namespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ImageReviewSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseImageReviewSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.containers.push(ImageReviewContainerSpec.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = ImageReviewSpec_AnnotationsEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.annotations[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.namespace = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ImageReviewSpec { + return { + containers: globalThis.Array.isArray(object?.containers) + ? object.containers.map((e: any) => ImageReviewContainerSpec.fromJSON(e)) + : [], + annotations: isObject(object.annotations) + ? (globalThis.Object.entries(object.annotations) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + }; + }, + + toJSON(message: ImageReviewSpec): unknown { + const obj: any = {}; + if (message.containers?.length) { + obj.containers = message.containers.map((e) => ImageReviewContainerSpec.toJSON(e)); + } + if (message.annotations) { + const entries = globalThis.Object.entries(message.annotations) as [string, string][]; + if (entries.length > 0) { + obj.annotations = {}; + entries.forEach(([k, v]) => { + obj.annotations[k] = v; + }); + } + } + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + return obj; + }, + + create, I>>(base?: I): ImageReviewSpec { + return ImageReviewSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ImageReviewSpec { + const message = createBaseImageReviewSpec(); + message.containers = object.containers?.map((e) => ImageReviewContainerSpec.fromPartial(e)) || []; + message.annotations = ( + globalThis.Object.entries(object.annotations ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.namespace = object.namespace ?? ''; + return message; + }, +}; + +function createBaseImageReviewSpec_AnnotationsEntry(): ImageReviewSpec_AnnotationsEntry { + return { key: '', value: '' }; +} + +export const ImageReviewSpec_AnnotationsEntry: MessageFns = { + encode( + message: ImageReviewSpec_AnnotationsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ImageReviewSpec_AnnotationsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseImageReviewSpec_AnnotationsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ImageReviewSpec_AnnotationsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: ImageReviewSpec_AnnotationsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): ImageReviewSpec_AnnotationsEntry { + return ImageReviewSpec_AnnotationsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ImageReviewSpec_AnnotationsEntry { + const message = createBaseImageReviewSpec_AnnotationsEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +function createBaseImageReviewStatus(): ImageReviewStatus { + return { allowed: false, reason: '', auditAnnotations: {} }; +} + +export const ImageReviewStatus: MessageFns = { + encode(message: ImageReviewStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowed !== undefined && message.allowed !== false) { + writer.uint32(8).bool(message.allowed); + } + if (message.reason !== undefined && message.reason !== '') { + writer.uint32(18).string(message.reason); + } + globalThis.Object.entries(message.auditAnnotations).forEach(([key, value]: [string, string]) => { + ImageReviewStatus_AuditAnnotationsEntry.encode( + { key: key as any, value }, + writer.uint32(26).fork(), + ).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ImageReviewStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseImageReviewStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.allowed = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.reason = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + const entry3 = ImageReviewStatus_AuditAnnotationsEntry.decode( + reader, + reader.uint32(), + ); + if (entry3.value !== undefined) { + message.auditAnnotations[entry3.key] = entry3.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ImageReviewStatus { + return { + allowed: isSet(object.allowed) ? globalThis.Boolean(object.allowed) : false, + reason: isSet(object.reason) ? globalThis.String(object.reason) : '', + auditAnnotations: isObject(object.auditAnnotations) + ? (globalThis.Object.entries(object.auditAnnotations) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: ImageReviewStatus): unknown { + const obj: any = {}; + if (message.allowed !== undefined && message.allowed !== false) { + obj.allowed = message.allowed; + } + if (message.reason !== undefined && message.reason !== '') { + obj.reason = message.reason; + } + if (message.auditAnnotations) { + const entries = globalThis.Object.entries(message.auditAnnotations) as [string, string][]; + if (entries.length > 0) { + obj.auditAnnotations = {}; + entries.forEach(([k, v]) => { + obj.auditAnnotations[k] = v; + }); + } + } + return obj; + }, + + create, I>>(base?: I): ImageReviewStatus { + return ImageReviewStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ImageReviewStatus { + const message = createBaseImageReviewStatus(); + message.allowed = object.allowed ?? false; + message.reason = object.reason ?? ''; + message.auditAnnotations = ( + globalThis.Object.entries(object.auditAnnotations ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseImageReviewStatus_AuditAnnotationsEntry(): ImageReviewStatus_AuditAnnotationsEntry { + return { key: '', value: '' }; +} + +export const ImageReviewStatus_AuditAnnotationsEntry: MessageFns = { + encode( + message: ImageReviewStatus_AuditAnnotationsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ImageReviewStatus_AuditAnnotationsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseImageReviewStatus_AuditAnnotationsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ImageReviewStatus_AuditAnnotationsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: ImageReviewStatus_AuditAnnotationsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): ImageReviewStatus_AuditAnnotationsEntry { + return ImageReviewStatus_AuditAnnotationsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ImageReviewStatus_AuditAnnotationsEntry { + const message = createBaseImageReviewStatus_AuditAnnotationsEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/networking/v1/generated.ts b/src/proto/generated/k8s.io/api/networking/v1/generated.ts new file mode 100644 index 00000000000..32bc12bec5c --- /dev/null +++ b/src/proto/generated/k8s.io/api/networking/v1/generated.ts @@ -0,0 +1,4116 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/networking/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { + Condition, + LabelSelector, + ListMeta, + ObjectMeta, +} from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; +import { IntOrString } from '../../../apimachinery/pkg/util/intstr/generated.js'; +import { TypedLocalObjectReference } from '../../core/v1/generated.js'; + +/** + * HTTPIngressPath associates a path with a backend. Incoming urls matching the + * path are forwarded to the backend. + */ +export interface HTTPIngressPath { + /** + * path is matched against the path of an incoming request. Currently it can + * contain characters disallowed from the conventional "path" part of a URL + * as defined by RFC 3986. Paths must begin with a '/' and must be present + * when using PathType with value "Exact" or "Prefix". + * +optional + */ + path?: string | undefined; + /** + * pathType determines the interpretation of the path matching. PathType can + * be one of the following values: + * * Exact: Matches the URL path exactly. + * * Prefix: Matches based on a URL path prefix split by '/'. Matching is + * done on a path element by element basis. A path element refers is the + * list of labels in the path split by the '/' separator. A request is a + * match for path p if every p is an element-wise prefix of p of the + * request path. Note that if the last element of the path is a substring + * of the last element in request path, it is not a match (e.g. /foo/bar + * matches /foo/bar/baz, but does not match /foo/barbaz). + * * ImplementationSpecific: Interpretation of the Path matching is up to + * the IngressClass. Implementations can treat this as a separate PathType + * or treat it identically to Prefix or Exact path types. + * Implementations are required to support all path types. + */ + pathType?: string | undefined; + /** + * backend defines the referenced service endpoint to which the traffic + * will be forwarded to. + */ + backend?: IngressBackend | undefined; +} + +/** + * HTTPIngressRuleValue is a list of http selectors pointing to backends. + * In the example: http:///? -> backend where + * where parts of the url correspond to RFC 3986, this resource will be used + * to match against everything after the last '/' and before the first '?' + * or '#'. + */ +export interface HTTPIngressRuleValue { + /** + * paths is a collection of paths that map requests to backends. + * +listType=atomic + */ + paths: HTTPIngressPath[]; +} + +/** + * 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 { + /** + * metadata is the standard object metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec is the desired state of the IPAddress. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +required + */ + spec?: IPAddressSpec | undefined; +} + +/** IPAddressList contains a list of IPAddress. */ +export interface IPAddressList { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** items is the list of IPAddresses. */ + items: IPAddress[]; +} + +/** IPAddressSpec describe the attributes in an IP Address. */ +export interface IPAddressSpec { + /** + * parentRef references the resource that an IPAddress is attached to. + * An IPAddress must reference a parent object. + * +required + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:immutable + */ + parentRef?: ParentReference | undefined; +} + +/** + * IPBlock describes a particular CIDR (Ex. "192.168.1.0/24","2001:db8::/64") that is allowed + * to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs + * that should not be included within this rule. + */ +export interface IPBlock { + /** + * cidr is a string representing the IPBlock + * Valid examples are "192.168.1.0/24" or "2001:db8::/64" + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + cidr?: string | undefined; + /** + * except is a slice of CIDRs that should not be included within an IPBlock + * Valid examples are "192.168.1.0/24" or "2001:db8::/64" + * Except values will be rejected if they are outside the cidr range + * +optional + * +listType=atomic + */ + except: string[]; +} + +/** + * Ingress is a collection of rules that allow inbound connections to reach the + * endpoints defined by a backend. An Ingress can be configured to give services + * externally-reachable urls, load balance traffic, terminate SSL, offer name + * based virtual hosting etc. + * +k8s:supportsSubresource="/status" + */ +export interface Ingress { + /** + * metadata is the standard object metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec is the desired state of the Ingress. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: IngressSpec | undefined; + /** + * status is the current state of the Ingress. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: IngressStatus | undefined; +} + +/** IngressBackend describes all endpoints for a given service and port. */ +export interface IngressBackend { + /** + * service references a service as a backend. + * This is a mutually exclusive setting with "Resource". + * +optional + */ + service?: IngressServiceBackend | undefined; + /** + * resource is an ObjectRef to another Kubernetes resource in the namespace + * of the Ingress object. If resource is specified, a service.Name and + * service.Port must not be specified. + * This is a mutually exclusive setting with "Service". + * +optional + */ + resource?: TypedLocalObjectReference | undefined; +} + +/** + * IngressClass represents the class of the Ingress, referenced by the Ingress + * Spec. The `ingressclass.kubernetes.io/is-default-class` annotation can be + * used to indicate that an IngressClass should be considered default. When a + * single IngressClass resource has this annotation set to true, new Ingress + * resources without a class specified will be assigned this default class. + */ +export interface IngressClass { + /** + * metadata is the standard object metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec is the desired state of the IngressClass. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: IngressClassSpec | undefined; +} + +/** IngressClassList is a collection of IngressClasses. */ +export interface IngressClassList { + /** + * Standard list metadata. + * +optional + */ + metadata?: ListMeta | undefined; + /** items is the list of IngressClasses. */ + items: IngressClass[]; +} + +/** + * IngressClassParametersReference identifies an API object. This can be used + * to specify a cluster or namespace-scoped resource. + */ +export interface IngressClassParametersReference { + /** + * apiGroup is the group for the resource being referenced. If APIGroup is + * not specified, the specified Kind must be in the core API group. For any + * other third-party types, APIGroup is required. + * +optional + */ + aPIGroup?: string | undefined; + /** + * kind is the type of resource being referenced. + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + kind?: string | undefined; + /** + * name is the name of resource being referenced. + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + name?: string | undefined; + /** + * scope represents if this refers to a cluster or namespace scoped resource. + * This may be set to "Cluster" (default) or "Namespace". + * +optional + */ + scope?: string | undefined; + /** + * namespace is the namespace of the resource being referenced. This field is + * required when scope is set to "Namespace" and must be unset when scope is set to + * "Cluster". + * +optional + */ + namespace?: string | undefined; +} + +/** IngressClassSpec provides information about the class of an Ingress. */ +export interface IngressClassSpec { + /** + * controller refers to the name of the controller that should handle this + * class. This allows for different "flavors" that are controlled by the + * same controller. For example, you may have different parameters for the + * same implementing controller. This should be specified as a + * domain-prefixed path no more than 250 characters in length, e.g. + * "acme.io/ingress-controller". This field is immutable. + */ + controller?: string | undefined; + /** + * parameters is a link to a custom resource containing additional + * configuration for the controller. This is optional if the controller does + * not require extra parameters. + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + */ + parameters?: IngressClassParametersReference | undefined; +} + +/** IngressList is a collection of Ingress. */ +export interface IngressList { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** items is the list of Ingress. */ + items: Ingress[]; +} + +/** IngressLoadBalancerIngress represents the status of a load-balancer ingress point. */ +export interface IngressLoadBalancerIngress { + /** + * ip is set for load-balancer ingress points that are IP based. + * +optional + */ + ip?: string | undefined; + /** + * hostname is set for load-balancer ingress points that are DNS based. + * +optional + */ + hostname?: string | undefined; + /** + * ports provides information about the ports exposed by this LoadBalancer. + * +listType=atomic + * +optional + */ + ports: IngressPortStatus[]; +} + +/** IngressLoadBalancerStatus represents the status of a load-balancer. */ +export interface IngressLoadBalancerStatus { + /** + * ingress is a list containing ingress points for the load-balancer. + * +optional + * +listType=atomic + */ + ingress: IngressLoadBalancerIngress[]; +} + +/** IngressPortStatus represents the error condition of a service port */ +export interface IngressPortStatus { + /** port is the port number of the ingress port. */ + port?: number | undefined; + /** + * protocol is the protocol of the ingress port. + * The supported values are: "TCP", "UDP", "SCTP" + */ + protocol?: string | undefined; + /** + * error is to record the problem with the service port + * The format of the error shall comply with the following rules: + * - built-in error values shall be specified in this file and those shall use + * CamelCase names + * - cloud provider specific error values must have names that comply with the + * format foo.example.com/CamelCase. + * --- + * The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + * +optional + * +kubebuilder:validation:Required + * +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)* /)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` + * +kubebuilder:validation:MaxLength=316 + */ + error?: string | undefined; +} + +/** + * IngressRule represents the rules mapping the paths under a specified host to + * the related backend services. Incoming requests are first evaluated for a host + * match, then routed to the backend associated with the matching IngressRuleValue. + */ +export interface IngressRule { + /** + * host is the fully qualified domain name of a network host, as defined by RFC 3986. + * Note the following deviations from the "host" part of the + * URI as defined in RFC 3986: + * 1. IPs are not allowed. Currently an IngressRuleValue can only apply to + * the IP in the Spec of the parent Ingress. + * 2. The `:` delimiter is not respected because ports are not allowed. + * Currently the port of an Ingress is implicitly :80 for http and + * :443 for https. + * Both these may change in the future. + * Incoming requests are matched against the host before the + * IngressRuleValue. If the host is unspecified, the Ingress routes all + * traffic based on the specified IngressRuleValue. + * + * host can be "precise" which is a domain name without the terminating dot of + * a network host (e.g. "foo.bar.com") or "wildcard", which is a domain name + * prefixed with a single wildcard label (e.g. "*.foo.com"). + * The wildcard character '*' must appear by itself as the first DNS label and + * matches only a single label. You cannot have a wildcard label by itself (e.g. Host == "*"). + * Requests will be matched against the Host field in the following way: + * 1. If host is precise, the request matches this rule if the http host header is equal to Host. + * 2. If host is a wildcard, then the request matches this rule if the http host header + * is to equal to the suffix (removing the first label) of the wildcard rule. + * +optional + */ + host?: string | undefined; + /** + * IngressRuleValue represents a rule to route requests for this IngressRule. + * If unspecified, the rule defaults to a http catch-all. Whether that sends + * just traffic matching the host to the default backend or all traffic to the + * default backend, is left to the controller fulfilling the Ingress. Http is + * currently the only supported IngressRuleValue. + * +optional + */ + ingressRuleValue?: IngressRuleValue | undefined; +} + +/** + * IngressRuleValue represents a rule to apply against incoming requests. If the + * rule is satisfied, the request is routed to the specified backend. Currently + * mixing different types of rules in a single Ingress is disallowed, so exactly + * one of the following must be set. + */ +export interface IngressRuleValue { + /** + * http is a HTTP IngressRuleValue, which contains a list of http selectors + * +optional + */ + http?: HTTPIngressRuleValue | undefined; +} + +/** IngressServiceBackend references a Kubernetes Service as a Backend. */ +export interface IngressServiceBackend { + /** + * name is the referenced service. The service must exist in + * the same namespace as the Ingress object. + */ + name?: string | undefined; + /** + * port of the referenced service. A port name or port number + * is required for a IngressServiceBackend. + */ + port?: ServiceBackendPort | undefined; +} + +/** IngressSpec describes the Ingress the user wishes to exist. */ +export interface IngressSpec { + /** + * ingressClassName is the name of an IngressClass cluster resource. Ingress + * controller implementations use this field to know whether they should be + * serving this Ingress resource, by a transitive connection + * (controller -> IngressClass -> Ingress resource). Although the + * `kubernetes.io/ingress.class` annotation (simple constant name) was never + * formally defined, it was widely supported by Ingress controllers to create + * a direct binding between Ingress controller and Ingress resources. Newly + * created Ingress resources should prefer using the field. However, even + * though the annotation is officially deprecated, for backwards compatibility + * reasons, ingress controllers should still honor that annotation if present. + * +optional + */ + ingressClassName?: string | undefined; + /** + * defaultBackend is the backend that should handle requests that don't + * match any rule. If Rules are not specified, DefaultBackend must be specified. + * If DefaultBackend is not set, the handling of requests that do not match any + * of the rules will be up to the Ingress controller. + * +optional + */ + defaultBackend?: IngressBackend | undefined; + /** + * tls represents the TLS configuration. Currently the Ingress only supports a + * single TLS port, 443. If multiple members of this list specify different hosts, + * they will be multiplexed on the same port according to the hostname specified + * through the SNI TLS extension, if the ingress controller fulfilling the + * ingress supports SNI. + * +listType=atomic + * +optional + */ + tls: IngressTLS[]; + /** + * rules is a list of host rules used to configure the Ingress. If unspecified, + * or no rule matches, all traffic is sent to the default backend. + * +listType=atomic + * +optional + */ + rules: IngressRule[]; +} + +/** IngressStatus describe the current state of the Ingress. */ +export interface IngressStatus { + /** + * loadBalancer contains the current status of the load-balancer. + * +optional + */ + loadBalancer?: IngressLoadBalancerStatus | undefined; +} + +/** IngressTLS describes the transport layer security associated with an ingress. */ +export interface IngressTLS { + /** + * hosts is a list of hosts included in the TLS certificate. The values in + * this list must match the name/s used in the tlsSecret. Defaults to the + * wildcard host setting for the loadbalancer controller fulfilling this + * Ingress, if left unspecified. + * +listType=atomic + * +optional + */ + hosts: string[]; + /** + * secretName is the name of the secret used to terminate TLS traffic on + * port 443. Field is left optional to allow TLS routing based on SNI + * hostname alone. If the SNI host in a listener conflicts with the "Host" + * header field used by an IngressRule, the SNI host is used for termination + * and value of the "Host" header is used for routing. + * +optional + */ + secretName?: string | undefined; +} + +/** NetworkPolicy describes what network traffic is allowed for a set of Pods */ +export interface NetworkPolicy { + /** + * metadata is the standard object metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec represents the specification of the desired behavior for this NetworkPolicy. + * +optional + */ + spec?: NetworkPolicySpec | undefined; +} + +/** + * NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods + * matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to. + * This type is beta-level in 1.8 + */ +export interface NetworkPolicyEgressRule { + /** + * ports is a list of destination ports for outgoing traffic. + * Each item in this list is combined using a logical OR. If this field is + * empty or missing, this rule matches all ports (traffic not restricted by port). + * If this field is present and contains at least one item, then this rule allows + * traffic only if the traffic matches at least one port in the list. + * +optional + * +listType=atomic + */ + ports: NetworkPolicyPort[]; + /** + * to is a list of destinations for outgoing traffic of pods selected for this rule. + * Items in this list are combined using a logical OR operation. If this field is + * empty or missing, this rule matches all destinations (traffic not restricted by + * destination). If this field is present and contains at least one item, this rule + * allows traffic only if the traffic matches at least one item in the to list. + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + to: NetworkPolicyPeer[]; +} + +/** + * NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods + * matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from. + */ +export interface NetworkPolicyIngressRule { + /** + * ports is a list of ports which should be made accessible on the pods selected for + * this rule. Each item in this list is combined using a logical OR. If this field is + * empty or missing, this rule matches all ports (traffic not restricted by port). + * If this field is present and contains at least one item, then this rule allows + * traffic only if the traffic matches at least one port in the list. + * +optional + * +listType=atomic + */ + ports: NetworkPolicyPort[]; + /** + * from is a list of sources which should be able to access the pods selected for this rule. + * Items in this list are combined using a logical OR operation. If this field is + * empty or missing, this rule matches all sources (traffic not restricted by + * source). If this field is present and contains at least one item, this rule + * allows traffic only if the traffic matches at least one item in the from list. + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + from: NetworkPolicyPeer[]; +} + +/** NetworkPolicyList is a list of NetworkPolicy objects. */ +export interface NetworkPolicyList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** items is a list of schema objects. */ + items: NetworkPolicy[]; +} + +/** + * NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of + * fields are allowed + */ +export interface NetworkPolicyPeer { + /** + * podSelector is a label selector which selects pods. This field follows standard label + * selector semantics; if present but empty, it selects all pods. + * + * If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects + * the pods matching podSelector in the Namespaces selected by NamespaceSelector. + * Otherwise it selects the pods matching podSelector in the policy's own namespace. + * +optional + */ + podSelector?: LabelSelector | undefined; + /** + * namespaceSelector selects namespaces using cluster-scoped labels. This field follows + * standard label selector semantics; if present but empty, it selects all namespaces. + * + * If podSelector is also set, then the NetworkPolicyPeer as a whole selects + * the pods matching podSelector in the namespaces selected by namespaceSelector. + * Otherwise it selects all pods in the namespaces selected by namespaceSelector. + * +optional + */ + namespaceSelector?: LabelSelector | undefined; + /** + * ipBlock defines policy on a particular IPBlock. If this field is set then + * neither of the other fields can be. + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + */ + ipBlock?: IPBlock | undefined; +} + +/** NetworkPolicyPort describes a port to allow traffic on */ +export interface NetworkPolicyPort { + /** + * protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. + * If not specified, this field defaults to TCP. + * +optional + */ + protocol?: string | undefined; + /** + * port represents the port on the given protocol. This can either be a numerical or named + * port on a pod. If this field is not provided, this matches all port names and + * numbers. + * If present, only traffic on the specified protocol AND port will be matched. + * +optional + */ + port?: IntOrString | undefined; + /** + * endPort indicates that the range of ports from port to endPort if set, inclusive, + * should be allowed by the policy. This field cannot be defined if the port field + * is not defined or if the port field is defined as a named (string) port. + * The endPort must be equal or greater than port. + * +optional + */ + endPort?: number | undefined; +} + +/** NetworkPolicySpec provides the specification of a NetworkPolicy */ +export interface NetworkPolicySpec { + /** + * podSelector selects the pods to which this NetworkPolicy object applies. + * The array of rules is applied to any pods selected by this field. An empty + * selector matches all pods in the policy's namespace. + * Multiple network policies can select the same set of pods. In this case, + * the ingress rules for each are combined additively. + * This field is optional. If it is not specified, it defaults to an empty selector. + * +optional + */ + podSelector?: LabelSelector | undefined; + /** + * ingress is a list of ingress rules to be applied to the selected pods. + * Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod + * (and cluster policy otherwise allows the traffic), OR if the traffic source is + * the pod's local node, OR if the traffic matches at least one ingress rule + * across all of the NetworkPolicy objects whose podSelector matches the pod. If + * this field is empty then this NetworkPolicy does not allow any traffic (and serves + * solely to ensure that the pods it selects are isolated by default) + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + ingress: NetworkPolicyIngressRule[]; + /** + * egress is a list of egress rules to be applied to the selected pods. Outgoing traffic + * is allowed if there are no NetworkPolicies selecting the pod (and cluster policy + * otherwise allows the traffic), OR if the traffic matches at least one egress rule + * across all of the NetworkPolicy objects whose podSelector matches the pod. If + * this field is empty then this NetworkPolicy limits all outgoing traffic (and serves + * solely to ensure that the pods it selects are isolated by default). + * This field is beta-level in 1.8 + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + egress: NetworkPolicyEgressRule[]; + /** + * policyTypes is a list of rule types that the NetworkPolicy relates to. + * Valid options are ["Ingress"], ["Egress"], or ["Ingress", "Egress"]. + * If this field is not specified, it will default based on the existence of ingress or egress rules; + * policies that contain an egress section are assumed to affect egress, and all policies + * (whether or not they contain an ingress section) are assumed to affect ingress. + * If you want to write an egress-only policy, you must explicitly specify policyTypes [ "Egress" ]. + * Likewise, if you want to write a policy that specifies that no egress is allowed, + * you must specify a policyTypes value that include "Egress" (since such a policy would not include + * an egress section and would otherwise default to just [ "Ingress" ]). + * This field is beta-level in 1.8 + * +optional + * +listType=atomic + */ + policyTypes: string[]; +} + +/** ParentReference describes a reference to a parent object. */ +export interface ParentReference { + /** + * group is the group of the object being referenced. + * +optional + */ + group?: string | undefined; + /** + * resource is the resource of the object being referenced. + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + resource?: string | undefined; + /** + * namespace is the namespace of the object being referenced. + * +optional + */ + namespace?: string | undefined; + /** + * name is the name of the object being referenced. + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + name?: string | undefined; +} + +/** + * ServiceBackendPort is the service port being referenced. + * +structType=atomic + */ +export interface ServiceBackendPort { + /** + * name is the name of the port on the Service. + * This is a mutually exclusive setting with "Number". + * +optional + */ + name?: string | undefined; + /** + * number is the numerical port number (e.g. 80) on the Service. + * This is a mutually exclusive setting with "Name". + * +optional + */ + number?: number | undefined; +} + +/** + * 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. + * +k8s:supportsSubresource="/status" + */ +export interface ServiceCIDR { + /** + * metadata is the standard object metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec is the desired state of the ServiceCIDR. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + spec?: ServiceCIDRSpec | undefined; + /** + * status represents the current state of the ServiceCIDR. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: ServiceCIDRStatus | undefined; +} + +/** ServiceCIDRList contains a list of ServiceCIDR objects. */ +export interface ServiceCIDRList { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** items is the list of ServiceCIDRs. */ + items: ServiceCIDR[]; +} + +/** ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services. */ +export interface ServiceCIDRSpec { + /** + * cidrs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") + * from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. + * This field is immutable. + * +optional + * +listType=atomic + */ + cidrs: string[]; +} + +/** ServiceCIDRStatus describes the current state of the ServiceCIDR. */ +export interface ServiceCIDRStatus { + /** + * conditions holds an array of metav1.Condition that describe the state of the ServiceCIDR. + * Current service state + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + * +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:opaqueType + */ + conditions: Condition[]; +} + +function createBaseHTTPIngressPath(): HTTPIngressPath { + return { path: '', pathType: '', backend: undefined }; +} + +export const HTTPIngressPath: MessageFns = { + encode(message: HTTPIngressPath, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== undefined && message.path !== '') { + writer.uint32(10).string(message.path); + } + if (message.pathType !== undefined && message.pathType !== '') { + writer.uint32(26).string(message.pathType); + } + if (message.backend !== undefined) { + IngressBackend.encode(message.backend, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HTTPIngressPath { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHTTPIngressPath(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.pathType = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.backend = IngressBackend.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HTTPIngressPath { + return { + path: isSet(object.path) ? globalThis.String(object.path) : '', + pathType: isSet(object.pathType) ? globalThis.String(object.pathType) : '', + backend: isSet(object.backend) ? IngressBackend.fromJSON(object.backend) : undefined, + }; + }, + + toJSON(message: HTTPIngressPath): unknown { + const obj: any = {}; + if (message.path !== undefined && message.path !== '') { + obj.path = message.path; + } + if (message.pathType !== undefined && message.pathType !== '') { + obj.pathType = message.pathType; + } + if (message.backend !== undefined) { + obj.backend = IngressBackend.toJSON(message.backend); + } + return obj; + }, + + create, I>>(base?: I): HTTPIngressPath { + return HTTPIngressPath.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HTTPIngressPath { + const message = createBaseHTTPIngressPath(); + message.path = object.path ?? ''; + message.pathType = object.pathType ?? ''; + message.backend = + object.backend !== undefined && object.backend !== null + ? IngressBackend.fromPartial(object.backend) + : undefined; + return message; + }, +}; + +function createBaseHTTPIngressRuleValue(): HTTPIngressRuleValue { + return { paths: [] }; +} + +export const HTTPIngressRuleValue: MessageFns = { + encode(message: HTTPIngressRuleValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.paths) { + HTTPIngressPath.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HTTPIngressRuleValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHTTPIngressRuleValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.paths.push(HTTPIngressPath.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): HTTPIngressRuleValue { + return { + paths: globalThis.Array.isArray(object?.paths) + ? object.paths.map((e: any) => HTTPIngressPath.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HTTPIngressRuleValue): unknown { + const obj: any = {}; + if (message.paths?.length) { + obj.paths = message.paths.map((e) => HTTPIngressPath.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): HTTPIngressRuleValue { + return HTTPIngressRuleValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HTTPIngressRuleValue { + const message = createBaseHTTPIngressRuleValue(); + message.paths = object.paths?.map((e) => HTTPIngressPath.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIPAddress(): IPAddress { + return { metadata: undefined, spec: undefined }; +} + +export const IPAddress: MessageFns = { + encode(message: IPAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + IPAddressSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IPAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIPAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = IPAddressSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IPAddress { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? IPAddressSpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: IPAddress): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = IPAddressSpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>(base?: I): IPAddress { + return IPAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IPAddress { + const message = createBaseIPAddress(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? IPAddressSpec.fromPartial(object.spec) + : undefined; + return message; + }, +}; + +function createBaseIPAddressList(): IPAddressList { + return { metadata: undefined, items: [] }; +} + +export const IPAddressList: MessageFns = { + encode(message: IPAddressList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + IPAddress.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IPAddressList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIPAddressList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(IPAddress.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IPAddressList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => IPAddress.fromJSON(e)) + : [], + }; + }, + + toJSON(message: IPAddressList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => IPAddress.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): IPAddressList { + return IPAddressList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IPAddressList { + const message = createBaseIPAddressList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => IPAddress.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIPAddressSpec(): IPAddressSpec { + return { parentRef: undefined }; +} + +export const IPAddressSpec: MessageFns = { + encode(message: IPAddressSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.parentRef !== undefined) { + ParentReference.encode(message.parentRef, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IPAddressSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIPAddressSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.parentRef = ParentReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IPAddressSpec { + return { + parentRef: isSet(object.parentRef) ? ParentReference.fromJSON(object.parentRef) : undefined, + }; + }, + + toJSON(message: IPAddressSpec): unknown { + const obj: any = {}; + if (message.parentRef !== undefined) { + obj.parentRef = ParentReference.toJSON(message.parentRef); + } + return obj; + }, + + create, I>>(base?: I): IPAddressSpec { + return IPAddressSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IPAddressSpec { + const message = createBaseIPAddressSpec(); + message.parentRef = + object.parentRef !== undefined && object.parentRef !== null + ? ParentReference.fromPartial(object.parentRef) + : undefined; + return message; + }, +}; + +function createBaseIPBlock(): IPBlock { + return { cidr: '', except: [] }; +} + +export const IPBlock: MessageFns = { + encode(message: IPBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.cidr !== undefined && message.cidr !== '') { + writer.uint32(10).string(message.cidr); + } + for (const v of message.except) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IPBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIPBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.cidr = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.except.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IPBlock { + return { + cidr: isSet(object.cidr) ? globalThis.String(object.cidr) : '', + except: globalThis.Array.isArray(object?.except) + ? object.except.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: IPBlock): unknown { + const obj: any = {}; + if (message.cidr !== undefined && message.cidr !== '') { + obj.cidr = message.cidr; + } + if (message.except?.length) { + obj.except = message.except; + } + return obj; + }, + + create, I>>(base?: I): IPBlock { + return IPBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IPBlock { + const message = createBaseIPBlock(); + message.cidr = object.cidr ?? ''; + message.except = object.except?.map((e) => e) || []; + return message; + }, +}; + +function createBaseIngress(): Ingress { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const Ingress: MessageFns = { + encode(message: Ingress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + IngressSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + IngressStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Ingress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = IngressSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = IngressStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Ingress { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? IngressSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? IngressStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: Ingress): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = IngressSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = IngressStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): Ingress { + return Ingress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Ingress { + const message = createBaseIngress(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? IngressSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? IngressStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseIngressBackend(): IngressBackend { + return { service: undefined, resource: undefined }; +} + +export const IngressBackend: MessageFns = { + encode(message: IngressBackend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.service !== undefined) { + IngressServiceBackend.encode(message.service, writer.uint32(34).fork()).join(); + } + if (message.resource !== undefined) { + TypedLocalObjectReference.encode(message.resource, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressBackend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressBackend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + if (tag !== 34) { + break; + } + + message.service = IngressServiceBackend.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.resource = TypedLocalObjectReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressBackend { + return { + service: isSet(object.service) ? IngressServiceBackend.fromJSON(object.service) : undefined, + resource: isSet(object.resource) + ? TypedLocalObjectReference.fromJSON(object.resource) + : undefined, + }; + }, + + toJSON(message: IngressBackend): unknown { + const obj: any = {}; + if (message.service !== undefined) { + obj.service = IngressServiceBackend.toJSON(message.service); + } + if (message.resource !== undefined) { + obj.resource = TypedLocalObjectReference.toJSON(message.resource); + } + return obj; + }, + + create, I>>(base?: I): IngressBackend { + return IngressBackend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressBackend { + const message = createBaseIngressBackend(); + message.service = + object.service !== undefined && object.service !== null + ? IngressServiceBackend.fromPartial(object.service) + : undefined; + message.resource = + object.resource !== undefined && object.resource !== null + ? TypedLocalObjectReference.fromPartial(object.resource) + : undefined; + return message; + }, +}; + +function createBaseIngressClass(): IngressClass { + return { metadata: undefined, spec: undefined }; +} + +export const IngressClass: MessageFns = { + encode(message: IngressClass, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + IngressClassSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressClass { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressClass(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = IngressClassSpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressClass { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? IngressClassSpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: IngressClass): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = IngressClassSpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>(base?: I): IngressClass { + return IngressClass.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressClass { + const message = createBaseIngressClass(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? IngressClassSpec.fromPartial(object.spec) + : undefined; + return message; + }, +}; + +function createBaseIngressClassList(): IngressClassList { + return { metadata: undefined, items: [] }; +} + +export const IngressClassList: MessageFns = { + encode(message: IngressClassList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + IngressClass.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressClassList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressClassList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(IngressClass.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressClassList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => IngressClass.fromJSON(e)) + : [], + }; + }, + + toJSON(message: IngressClassList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => IngressClass.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): IngressClassList { + return IngressClassList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressClassList { + const message = createBaseIngressClassList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => IngressClass.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIngressClassParametersReference(): IngressClassParametersReference { + return { aPIGroup: '', kind: '', name: '', scope: '', namespace: '' }; +} + +export const IngressClassParametersReference: MessageFns = { + encode( + message: IngressClassParametersReference, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.aPIGroup !== undefined && message.aPIGroup !== '') { + writer.uint32(10).string(message.aPIGroup); + } + if (message.kind !== undefined && message.kind !== '') { + writer.uint32(18).string(message.kind); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(26).string(message.name); + } + if (message.scope !== undefined && message.scope !== '') { + writer.uint32(34).string(message.scope); + } + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(42).string(message.namespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressClassParametersReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressClassParametersReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.aPIGroup = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.kind = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.scope = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.namespace = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressClassParametersReference { + return { + aPIGroup: isSet(object.aPIGroup) ? globalThis.String(object.aPIGroup) : '', + kind: isSet(object.kind) ? globalThis.String(object.kind) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + scope: isSet(object.scope) ? globalThis.String(object.scope) : '', + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + }; + }, + + toJSON(message: IngressClassParametersReference): unknown { + const obj: any = {}; + if (message.aPIGroup !== undefined && message.aPIGroup !== '') { + obj.aPIGroup = message.aPIGroup; + } + if (message.kind !== undefined && message.kind !== '') { + obj.kind = message.kind; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.scope !== undefined && message.scope !== '') { + obj.scope = message.scope; + } + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + return obj; + }, + + create, I>>( + base?: I, + ): IngressClassParametersReference { + return IngressClassParametersReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): IngressClassParametersReference { + const message = createBaseIngressClassParametersReference(); + message.aPIGroup = object.aPIGroup ?? ''; + message.kind = object.kind ?? ''; + message.name = object.name ?? ''; + message.scope = object.scope ?? ''; + message.namespace = object.namespace ?? ''; + return message; + }, +}; + +function createBaseIngressClassSpec(): IngressClassSpec { + return { controller: '', parameters: undefined }; +} + +export const IngressClassSpec: MessageFns = { + encode(message: IngressClassSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.controller !== undefined && message.controller !== '') { + writer.uint32(10).string(message.controller); + } + if (message.parameters !== undefined) { + IngressClassParametersReference.encode(message.parameters, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressClassSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressClassSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.controller = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.parameters = IngressClassParametersReference.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressClassSpec { + return { + controller: isSet(object.controller) ? globalThis.String(object.controller) : '', + parameters: isSet(object.parameters) + ? IngressClassParametersReference.fromJSON(object.parameters) + : undefined, + }; + }, + + toJSON(message: IngressClassSpec): unknown { + const obj: any = {}; + if (message.controller !== undefined && message.controller !== '') { + obj.controller = message.controller; + } + if (message.parameters !== undefined) { + obj.parameters = IngressClassParametersReference.toJSON(message.parameters); + } + return obj; + }, + + create, I>>(base?: I): IngressClassSpec { + return IngressClassSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressClassSpec { + const message = createBaseIngressClassSpec(); + message.controller = object.controller ?? ''; + message.parameters = + object.parameters !== undefined && object.parameters !== null + ? IngressClassParametersReference.fromPartial(object.parameters) + : undefined; + return message; + }, +}; + +function createBaseIngressList(): IngressList { + return { metadata: undefined, items: [] }; +} + +export const IngressList: MessageFns = { + encode(message: IngressList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Ingress.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Ingress.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Ingress.fromJSON(e)) + : [], + }; + }, + + toJSON(message: IngressList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Ingress.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): IngressList { + return IngressList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressList { + const message = createBaseIngressList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Ingress.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIngressLoadBalancerIngress(): IngressLoadBalancerIngress { + return { ip: '', hostname: '', ports: [] }; +} + +export const IngressLoadBalancerIngress: MessageFns = { + encode(message: IngressLoadBalancerIngress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ip !== undefined && message.ip !== '') { + writer.uint32(10).string(message.ip); + } + if (message.hostname !== undefined && message.hostname !== '') { + writer.uint32(18).string(message.hostname); + } + for (const v of message.ports) { + IngressPortStatus.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressLoadBalancerIngress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressLoadBalancerIngress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ip = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hostname = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.ports.push(IngressPortStatus.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressLoadBalancerIngress { + return { + ip: isSet(object.ip) ? globalThis.String(object.ip) : '', + hostname: isSet(object.hostname) ? globalThis.String(object.hostname) : '', + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => IngressPortStatus.fromJSON(e)) + : [], + }; + }, + + toJSON(message: IngressLoadBalancerIngress): unknown { + const obj: any = {}; + if (message.ip !== undefined && message.ip !== '') { + obj.ip = message.ip; + } + if (message.hostname !== undefined && message.hostname !== '') { + obj.hostname = message.hostname; + } + if (message.ports?.length) { + obj.ports = message.ports.map((e) => IngressPortStatus.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): IngressLoadBalancerIngress { + return IngressLoadBalancerIngress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): IngressLoadBalancerIngress { + const message = createBaseIngressLoadBalancerIngress(); + message.ip = object.ip ?? ''; + message.hostname = object.hostname ?? ''; + message.ports = object.ports?.map((e) => IngressPortStatus.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIngressLoadBalancerStatus(): IngressLoadBalancerStatus { + return { ingress: [] }; +} + +export const IngressLoadBalancerStatus: MessageFns = { + encode(message: IngressLoadBalancerStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ingress) { + IngressLoadBalancerIngress.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressLoadBalancerStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressLoadBalancerStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ingress.push(IngressLoadBalancerIngress.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressLoadBalancerStatus { + return { + ingress: globalThis.Array.isArray(object?.ingress) + ? object.ingress.map((e: any) => IngressLoadBalancerIngress.fromJSON(e)) + : [], + }; + }, + + toJSON(message: IngressLoadBalancerStatus): unknown { + const obj: any = {}; + if (message.ingress?.length) { + obj.ingress = message.ingress.map((e) => IngressLoadBalancerIngress.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): IngressLoadBalancerStatus { + return IngressLoadBalancerStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): IngressLoadBalancerStatus { + const message = createBaseIngressLoadBalancerStatus(); + message.ingress = object.ingress?.map((e) => IngressLoadBalancerIngress.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIngressPortStatus(): IngressPortStatus { + return { port: 0, protocol: '', error: '' }; +} + +export const IngressPortStatus: MessageFns = { + encode(message: IngressPortStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.port !== undefined && message.port !== 0) { + writer.uint32(8).int32(message.port); + } + if (message.protocol !== undefined && message.protocol !== '') { + writer.uint32(18).string(message.protocol); + } + if (message.error !== undefined && message.error !== '') { + writer.uint32(26).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressPortStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressPortStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.port = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.protocol = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.error = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressPortStatus { + return { + port: isSet(object.port) ? globalThis.Number(object.port) : 0, + protocol: isSet(object.protocol) ? globalThis.String(object.protocol) : '', + error: isSet(object.error) ? globalThis.String(object.error) : '', + }; + }, + + toJSON(message: IngressPortStatus): unknown { + const obj: any = {}; + if (message.port !== undefined && message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.protocol !== undefined && message.protocol !== '') { + obj.protocol = message.protocol; + } + if (message.error !== undefined && message.error !== '') { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): IngressPortStatus { + return IngressPortStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressPortStatus { + const message = createBaseIngressPortStatus(); + message.port = object.port ?? 0; + message.protocol = object.protocol ?? ''; + message.error = object.error ?? ''; + return message; + }, +}; + +function createBaseIngressRule(): IngressRule { + return { host: '', ingressRuleValue: undefined }; +} + +export const IngressRule: MessageFns = { + encode(message: IngressRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.host !== undefined && message.host !== '') { + writer.uint32(10).string(message.host); + } + if (message.ingressRuleValue !== undefined) { + IngressRuleValue.encode(message.ingressRuleValue, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.host = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.ingressRuleValue = IngressRuleValue.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressRule { + return { + host: isSet(object.host) ? globalThis.String(object.host) : '', + ingressRuleValue: isSet(object.ingressRuleValue) + ? IngressRuleValue.fromJSON(object.ingressRuleValue) + : undefined, + }; + }, + + toJSON(message: IngressRule): unknown { + const obj: any = {}; + if (message.host !== undefined && message.host !== '') { + obj.host = message.host; + } + if (message.ingressRuleValue !== undefined) { + obj.ingressRuleValue = IngressRuleValue.toJSON(message.ingressRuleValue); + } + return obj; + }, + + create, I>>(base?: I): IngressRule { + return IngressRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressRule { + const message = createBaseIngressRule(); + message.host = object.host ?? ''; + message.ingressRuleValue = + object.ingressRuleValue !== undefined && object.ingressRuleValue !== null + ? IngressRuleValue.fromPartial(object.ingressRuleValue) + : undefined; + return message; + }, +}; + +function createBaseIngressRuleValue(): IngressRuleValue { + return { http: undefined }; +} + +export const IngressRuleValue: MessageFns = { + encode(message: IngressRuleValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.http !== undefined) { + HTTPIngressRuleValue.encode(message.http, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressRuleValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressRuleValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.http = HTTPIngressRuleValue.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressRuleValue { + return { http: isSet(object.http) ? HTTPIngressRuleValue.fromJSON(object.http) : undefined }; + }, + + toJSON(message: IngressRuleValue): unknown { + const obj: any = {}; + if (message.http !== undefined) { + obj.http = HTTPIngressRuleValue.toJSON(message.http); + } + return obj; + }, + + create, I>>(base?: I): IngressRuleValue { + return IngressRuleValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressRuleValue { + const message = createBaseIngressRuleValue(); + message.http = + object.http !== undefined && object.http !== null + ? HTTPIngressRuleValue.fromPartial(object.http) + : undefined; + return message; + }, +}; + +function createBaseIngressServiceBackend(): IngressServiceBackend { + return { name: '', port: undefined }; +} + +export const IngressServiceBackend: MessageFns = { + encode(message: IngressServiceBackend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.port !== undefined) { + ServiceBackendPort.encode(message.port, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressServiceBackend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressServiceBackend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.port = ServiceBackendPort.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressServiceBackend { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + port: isSet(object.port) ? ServiceBackendPort.fromJSON(object.port) : undefined, + }; + }, + + toJSON(message: IngressServiceBackend): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.port !== undefined) { + obj.port = ServiceBackendPort.toJSON(message.port); + } + return obj; + }, + + create, I>>(base?: I): IngressServiceBackend { + return IngressServiceBackend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressServiceBackend { + const message = createBaseIngressServiceBackend(); + message.name = object.name ?? ''; + message.port = + object.port !== undefined && object.port !== null + ? ServiceBackendPort.fromPartial(object.port) + : undefined; + return message; + }, +}; + +function createBaseIngressSpec(): IngressSpec { + return { ingressClassName: '', defaultBackend: undefined, tls: [], rules: [] }; +} + +export const IngressSpec: MessageFns = { + encode(message: IngressSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ingressClassName !== undefined && message.ingressClassName !== '') { + writer.uint32(34).string(message.ingressClassName); + } + if (message.defaultBackend !== undefined) { + IngressBackend.encode(message.defaultBackend, writer.uint32(10).fork()).join(); + } + for (const v of message.tls) { + IngressTLS.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.rules) { + IngressRule.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + if (tag !== 34) { + break; + } + + message.ingressClassName = reader.string(); + continue; + } + case 1: { + if (tag !== 10) { + break; + } + + message.defaultBackend = IngressBackend.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.tls.push(IngressTLS.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.rules.push(IngressRule.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressSpec { + return { + ingressClassName: isSet(object.ingressClassName) + ? globalThis.String(object.ingressClassName) + : '', + defaultBackend: isSet(object.defaultBackend) + ? IngressBackend.fromJSON(object.defaultBackend) + : undefined, + tls: globalThis.Array.isArray(object?.tls) + ? object.tls.map((e: any) => IngressTLS.fromJSON(e)) + : [], + rules: globalThis.Array.isArray(object?.rules) + ? object.rules.map((e: any) => IngressRule.fromJSON(e)) + : [], + }; + }, + + toJSON(message: IngressSpec): unknown { + const obj: any = {}; + if (message.ingressClassName !== undefined && message.ingressClassName !== '') { + obj.ingressClassName = message.ingressClassName; + } + if (message.defaultBackend !== undefined) { + obj.defaultBackend = IngressBackend.toJSON(message.defaultBackend); + } + if (message.tls?.length) { + obj.tls = message.tls.map((e) => IngressTLS.toJSON(e)); + } + if (message.rules?.length) { + obj.rules = message.rules.map((e) => IngressRule.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): IngressSpec { + return IngressSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressSpec { + const message = createBaseIngressSpec(); + message.ingressClassName = object.ingressClassName ?? ''; + message.defaultBackend = + object.defaultBackend !== undefined && object.defaultBackend !== null + ? IngressBackend.fromPartial(object.defaultBackend) + : undefined; + message.tls = object.tls?.map((e) => IngressTLS.fromPartial(e)) || []; + message.rules = object.rules?.map((e) => IngressRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseIngressStatus(): IngressStatus { + return { loadBalancer: undefined }; +} + +export const IngressStatus: MessageFns = { + encode(message: IngressStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.loadBalancer !== undefined) { + IngressLoadBalancerStatus.encode(message.loadBalancer, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.loadBalancer = IngressLoadBalancerStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressStatus { + return { + loadBalancer: isSet(object.loadBalancer) + ? IngressLoadBalancerStatus.fromJSON(object.loadBalancer) + : undefined, + }; + }, + + toJSON(message: IngressStatus): unknown { + const obj: any = {}; + if (message.loadBalancer !== undefined) { + obj.loadBalancer = IngressLoadBalancerStatus.toJSON(message.loadBalancer); + } + return obj; + }, + + create, I>>(base?: I): IngressStatus { + return IngressStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressStatus { + const message = createBaseIngressStatus(); + message.loadBalancer = + object.loadBalancer !== undefined && object.loadBalancer !== null + ? IngressLoadBalancerStatus.fromPartial(object.loadBalancer) + : undefined; + return message; + }, +}; + +function createBaseIngressTLS(): IngressTLS { + return { hosts: [], secretName: '' }; +} + +export const IngressTLS: MessageFns = { + encode(message: IngressTLS, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.hosts) { + writer.uint32(10).string(v!); + } + if (message.secretName !== undefined && message.secretName !== '') { + writer.uint32(18).string(message.secretName); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IngressTLS { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIngressTLS(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.hosts.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.secretName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): IngressTLS { + return { + hosts: globalThis.Array.isArray(object?.hosts) + ? object.hosts.map((e: any) => globalThis.String(e)) + : [], + secretName: isSet(object.secretName) ? globalThis.String(object.secretName) : '', + }; + }, + + toJSON(message: IngressTLS): unknown { + const obj: any = {}; + if (message.hosts?.length) { + obj.hosts = message.hosts; + } + if (message.secretName !== undefined && message.secretName !== '') { + obj.secretName = message.secretName; + } + return obj; + }, + + create, I>>(base?: I): IngressTLS { + return IngressTLS.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IngressTLS { + const message = createBaseIngressTLS(); + message.hosts = object.hosts?.map((e) => e) || []; + message.secretName = object.secretName ?? ''; + return message; + }, +}; + +function createBaseNetworkPolicy(): NetworkPolicy { + return { metadata: undefined, spec: undefined }; +} + +export const NetworkPolicy: MessageFns = { + encode(message: NetworkPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + NetworkPolicySpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = NetworkPolicySpec.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicy { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? NetworkPolicySpec.fromJSON(object.spec) : undefined, + }; + }, + + toJSON(message: NetworkPolicy): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = NetworkPolicySpec.toJSON(message.spec); + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicy { + return NetworkPolicy.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetworkPolicy { + const message = createBaseNetworkPolicy(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? NetworkPolicySpec.fromPartial(object.spec) + : undefined; + return message; + }, +}; + +function createBaseNetworkPolicyEgressRule(): NetworkPolicyEgressRule { + return { ports: [], to: [] }; +} + +export const NetworkPolicyEgressRule: MessageFns = { + encode(message: NetworkPolicyEgressRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ports) { + NetworkPolicyPort.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.to) { + NetworkPolicyPeer.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicyEgressRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicyEgressRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ports.push(NetworkPolicyPort.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.to.push(NetworkPolicyPeer.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicyEgressRule { + return { + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => NetworkPolicyPort.fromJSON(e)) + : [], + to: globalThis.Array.isArray(object?.to) + ? object.to.map((e: any) => NetworkPolicyPeer.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NetworkPolicyEgressRule): unknown { + const obj: any = {}; + if (message.ports?.length) { + obj.ports = message.ports.map((e) => NetworkPolicyPort.toJSON(e)); + } + if (message.to?.length) { + obj.to = message.to.map((e) => NetworkPolicyPeer.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicyEgressRule { + return NetworkPolicyEgressRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NetworkPolicyEgressRule { + const message = createBaseNetworkPolicyEgressRule(); + message.ports = object.ports?.map((e) => NetworkPolicyPort.fromPartial(e)) || []; + message.to = object.to?.map((e) => NetworkPolicyPeer.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNetworkPolicyIngressRule(): NetworkPolicyIngressRule { + return { ports: [], from: [] }; +} + +export const NetworkPolicyIngressRule: MessageFns = { + encode(message: NetworkPolicyIngressRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ports) { + NetworkPolicyPort.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.from) { + NetworkPolicyPeer.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicyIngressRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicyIngressRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ports.push(NetworkPolicyPort.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.from.push(NetworkPolicyPeer.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicyIngressRule { + return { + ports: globalThis.Array.isArray(object?.ports) + ? object.ports.map((e: any) => NetworkPolicyPort.fromJSON(e)) + : [], + from: globalThis.Array.isArray(object?.from) + ? object.from.map((e: any) => NetworkPolicyPeer.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NetworkPolicyIngressRule): unknown { + const obj: any = {}; + if (message.ports?.length) { + obj.ports = message.ports.map((e) => NetworkPolicyPort.toJSON(e)); + } + if (message.from?.length) { + obj.from = message.from.map((e) => NetworkPolicyPeer.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicyIngressRule { + return NetworkPolicyIngressRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NetworkPolicyIngressRule { + const message = createBaseNetworkPolicyIngressRule(); + message.ports = object.ports?.map((e) => NetworkPolicyPort.fromPartial(e)) || []; + message.from = object.from?.map((e) => NetworkPolicyPeer.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNetworkPolicyList(): NetworkPolicyList { + return { metadata: undefined, items: [] }; +} + +export const NetworkPolicyList: MessageFns = { + encode(message: NetworkPolicyList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + NetworkPolicy.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicyList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicyList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(NetworkPolicy.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicyList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => NetworkPolicy.fromJSON(e)) + : [], + }; + }, + + toJSON(message: NetworkPolicyList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => NetworkPolicy.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicyList { + return NetworkPolicyList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetworkPolicyList { + const message = createBaseNetworkPolicyList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => NetworkPolicy.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNetworkPolicyPeer(): NetworkPolicyPeer { + return { podSelector: undefined, namespaceSelector: undefined, ipBlock: undefined }; +} + +export const NetworkPolicyPeer: MessageFns = { + encode(message: NetworkPolicyPeer, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.podSelector !== undefined) { + LabelSelector.encode(message.podSelector, writer.uint32(10).fork()).join(); + } + if (message.namespaceSelector !== undefined) { + LabelSelector.encode(message.namespaceSelector, writer.uint32(18).fork()).join(); + } + if (message.ipBlock !== undefined) { + IPBlock.encode(message.ipBlock, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicyPeer { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicyPeer(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.podSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.namespaceSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.ipBlock = IPBlock.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicyPeer { + return { + podSelector: isSet(object.podSelector) ? LabelSelector.fromJSON(object.podSelector) : undefined, + namespaceSelector: isSet(object.namespaceSelector) + ? LabelSelector.fromJSON(object.namespaceSelector) + : undefined, + ipBlock: isSet(object.ipBlock) ? IPBlock.fromJSON(object.ipBlock) : undefined, + }; + }, + + toJSON(message: NetworkPolicyPeer): unknown { + const obj: any = {}; + if (message.podSelector !== undefined) { + obj.podSelector = LabelSelector.toJSON(message.podSelector); + } + if (message.namespaceSelector !== undefined) { + obj.namespaceSelector = LabelSelector.toJSON(message.namespaceSelector); + } + if (message.ipBlock !== undefined) { + obj.ipBlock = IPBlock.toJSON(message.ipBlock); + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicyPeer { + return NetworkPolicyPeer.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetworkPolicyPeer { + const message = createBaseNetworkPolicyPeer(); + message.podSelector = + object.podSelector !== undefined && object.podSelector !== null + ? LabelSelector.fromPartial(object.podSelector) + : undefined; + message.namespaceSelector = + object.namespaceSelector !== undefined && object.namespaceSelector !== null + ? LabelSelector.fromPartial(object.namespaceSelector) + : undefined; + message.ipBlock = + object.ipBlock !== undefined && object.ipBlock !== null + ? IPBlock.fromPartial(object.ipBlock) + : undefined; + return message; + }, +}; + +function createBaseNetworkPolicyPort(): NetworkPolicyPort { + return { protocol: '', port: undefined, endPort: 0 }; +} + +export const NetworkPolicyPort: MessageFns = { + encode(message: NetworkPolicyPort, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocol !== undefined && message.protocol !== '') { + writer.uint32(10).string(message.protocol); + } + if (message.port !== undefined) { + IntOrString.encode(message.port, writer.uint32(18).fork()).join(); + } + if (message.endPort !== undefined && message.endPort !== 0) { + writer.uint32(24).int32(message.endPort); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicyPort { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicyPort(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.protocol = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.port = IntOrString.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.endPort = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicyPort { + return { + protocol: isSet(object.protocol) ? globalThis.String(object.protocol) : '', + port: isSet(object.port) ? IntOrString.fromJSON(object.port) : undefined, + endPort: isSet(object.endPort) ? globalThis.Number(object.endPort) : 0, + }; + }, + + toJSON(message: NetworkPolicyPort): unknown { + const obj: any = {}; + if (message.protocol !== undefined && message.protocol !== '') { + obj.protocol = message.protocol; + } + if (message.port !== undefined) { + obj.port = IntOrString.toJSON(message.port); + } + if (message.endPort !== undefined && message.endPort !== 0) { + obj.endPort = Math.round(message.endPort); + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicyPort { + return NetworkPolicyPort.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetworkPolicyPort { + const message = createBaseNetworkPolicyPort(); + message.protocol = object.protocol ?? ''; + message.port = + object.port !== undefined && object.port !== null + ? IntOrString.fromPartial(object.port) + : undefined; + message.endPort = object.endPort ?? 0; + return message; + }, +}; + +function createBaseNetworkPolicySpec(): NetworkPolicySpec { + return { podSelector: undefined, ingress: [], egress: [], policyTypes: [] }; +} + +export const NetworkPolicySpec: MessageFns = { + encode(message: NetworkPolicySpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.podSelector !== undefined) { + LabelSelector.encode(message.podSelector, writer.uint32(10).fork()).join(); + } + for (const v of message.ingress) { + NetworkPolicyIngressRule.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.egress) { + NetworkPolicyEgressRule.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.policyTypes) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NetworkPolicySpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetworkPolicySpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.podSelector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.ingress.push(NetworkPolicyIngressRule.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.egress.push(NetworkPolicyEgressRule.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.policyTypes.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): NetworkPolicySpec { + return { + podSelector: isSet(object.podSelector) ? LabelSelector.fromJSON(object.podSelector) : undefined, + ingress: globalThis.Array.isArray(object?.ingress) + ? object.ingress.map((e: any) => NetworkPolicyIngressRule.fromJSON(e)) + : [], + egress: globalThis.Array.isArray(object?.egress) + ? object.egress.map((e: any) => NetworkPolicyEgressRule.fromJSON(e)) + : [], + policyTypes: globalThis.Array.isArray(object?.policyTypes) + ? object.policyTypes.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: NetworkPolicySpec): unknown { + const obj: any = {}; + if (message.podSelector !== undefined) { + obj.podSelector = LabelSelector.toJSON(message.podSelector); + } + if (message.ingress?.length) { + obj.ingress = message.ingress.map((e) => NetworkPolicyIngressRule.toJSON(e)); + } + if (message.egress?.length) { + obj.egress = message.egress.map((e) => NetworkPolicyEgressRule.toJSON(e)); + } + if (message.policyTypes?.length) { + obj.policyTypes = message.policyTypes; + } + return obj; + }, + + create, I>>(base?: I): NetworkPolicySpec { + return NetworkPolicySpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NetworkPolicySpec { + const message = createBaseNetworkPolicySpec(); + message.podSelector = + object.podSelector !== undefined && object.podSelector !== null + ? LabelSelector.fromPartial(object.podSelector) + : undefined; + message.ingress = object.ingress?.map((e) => NetworkPolicyIngressRule.fromPartial(e)) || []; + message.egress = object.egress?.map((e) => NetworkPolicyEgressRule.fromPartial(e)) || []; + message.policyTypes = object.policyTypes?.map((e) => e) || []; + return message; + }, +}; + +function createBaseParentReference(): ParentReference { + return { group: '', resource: '', namespace: '', name: '' }; +} + +export const ParentReference: MessageFns = { + encode(message: ParentReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.group !== undefined && message.group !== '') { + writer.uint32(10).string(message.group); + } + if (message.resource !== undefined && message.resource !== '') { + writer.uint32(18).string(message.resource); + } + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(26).string(message.namespace); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(34).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParentReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParentReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.group = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resource = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.namespace = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ParentReference { + return { + group: isSet(object.group) ? globalThis.String(object.group) : '', + resource: isSet(object.resource) ? globalThis.String(object.resource) : '', + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + }; + }, + + toJSON(message: ParentReference): unknown { + const obj: any = {}; + if (message.group !== undefined && message.group !== '') { + obj.group = message.group; + } + if (message.resource !== undefined && message.resource !== '') { + obj.resource = message.resource; + } + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): ParentReference { + return ParentReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ParentReference { + const message = createBaseParentReference(); + message.group = object.group ?? ''; + message.resource = object.resource ?? ''; + message.namespace = object.namespace ?? ''; + message.name = object.name ?? ''; + return message; + }, +}; + +function createBaseServiceBackendPort(): ServiceBackendPort { + return { name: '', number: 0 }; +} + +export const ServiceBackendPort: MessageFns = { + encode(message: ServiceBackendPort, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== '') { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(16).int32(message.number); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceBackendPort { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceBackendPort(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.number = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceBackendPort { + return { + name: isSet(object.name) ? globalThis.String(object.name) : '', + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + }; + }, + + toJSON(message: ServiceBackendPort): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + return obj; + }, + + create, I>>(base?: I): ServiceBackendPort { + return ServiceBackendPort.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceBackendPort { + const message = createBaseServiceBackendPort(); + message.name = object.name ?? ''; + message.number = object.number ?? 0; + return message; + }, +}; + +function createBaseServiceCIDR(): ServiceCIDR { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const ServiceCIDR: MessageFns = { + encode(message: ServiceCIDR, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + ServiceCIDRSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + ServiceCIDRStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCIDR { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCIDR(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = ServiceCIDRSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = ServiceCIDRStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceCIDR { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? ServiceCIDRSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? ServiceCIDRStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: ServiceCIDR): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = ServiceCIDRSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = ServiceCIDRStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ServiceCIDR { + return ServiceCIDR.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceCIDR { + const message = createBaseServiceCIDR(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? ServiceCIDRSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? ServiceCIDRStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseServiceCIDRList(): ServiceCIDRList { + return { metadata: undefined, items: [] }; +} + +export const ServiceCIDRList: MessageFns = { + encode(message: ServiceCIDRList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ServiceCIDR.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCIDRList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCIDRList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ServiceCIDR.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceCIDRList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ServiceCIDR.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ServiceCIDRList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ServiceCIDR.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ServiceCIDRList { + return ServiceCIDRList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceCIDRList { + const message = createBaseServiceCIDRList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ServiceCIDR.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseServiceCIDRSpec(): ServiceCIDRSpec { + return { cidrs: [] }; +} + +export const ServiceCIDRSpec: MessageFns = { + encode(message: ServiceCIDRSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.cidrs) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCIDRSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCIDRSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.cidrs.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceCIDRSpec { + return { + cidrs: globalThis.Array.isArray(object?.cidrs) + ? object.cidrs.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ServiceCIDRSpec): unknown { + const obj: any = {}; + if (message.cidrs?.length) { + obj.cidrs = message.cidrs; + } + return obj; + }, + + create, I>>(base?: I): ServiceCIDRSpec { + return ServiceCIDRSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceCIDRSpec { + const message = createBaseServiceCIDRSpec(); + message.cidrs = object.cidrs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseServiceCIDRStatus(): ServiceCIDRStatus { + return { conditions: [] }; +} + +export const ServiceCIDRStatus: MessageFns = { + encode(message: ServiceCIDRStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.conditions) { + Condition.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceCIDRStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceCIDRStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.conditions.push(Condition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServiceCIDRStatus { + return { + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => Condition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ServiceCIDRStatus): unknown { + const obj: any = {}; + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => Condition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ServiceCIDRStatus { + return ServiceCIDRStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceCIDRStatus { + const message = createBaseServiceCIDRStatus(); + message.conditions = object.conditions?.map((e) => Condition.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/node/v1/generated.ts b/src/proto/generated/k8s.io/api/node/v1/generated.ts new file mode 100644 index 00000000000..82c306f4bb7 --- /dev/null +++ b/src/proto/generated/k8s.io/api/node/v1/generated.ts @@ -0,0 +1,761 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/node/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { Quantity } from '../../../apimachinery/pkg/api/resource/generated.js'; +import { ListMeta, ObjectMeta } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; +import { Toleration } from '../../core/v1/generated.js'; + +/** Overhead structure represents the resource overhead associated with running a pod. */ +export interface Overhead { + /** + * podFixed represents the fixed resource overhead associated with running a pod. + * +optional + */ + podFixed: { [key: string]: Quantity }; +} + +export interface Overhead_PodFixedEntry { + key: string; + value: Quantity | undefined; +} + +/** + * RuntimeClass defines a class of container runtime supported in the cluster. + * The RuntimeClass is used to determine which container runtime is used to run + * all containers in a pod. RuntimeClasses are manually defined by a + * user or cluster provisioner, and referenced in the PodSpec. The Kubelet is + * responsible for resolving the RuntimeClassName reference before running the + * pod. For more details, see + * https://kubernetes.io/docs/concepts/containers/runtime-class/ + */ +export interface RuntimeClass { + /** + * metadata is the standard object metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * handler specifies the underlying runtime and configuration that the CRI + * implementation will use to handle pods of this class. The possible values + * are specific to the node & CRI configuration. It is assumed that all + * handlers are available on every node, and handlers of the same name are + * equivalent on every node. + * For example, a handler called "runc" might specify that the runc OCI + * runtime (using native Linux containers) will be used to run the containers + * in a pod. + * The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, + * and is immutable. + * +required + * +k8s:beta(since: "1.37")=+k8s:format="k8s-short-name" + * +k8s:beta(since: "1.37")=+k8s:immutable + * +k8s:beta(since: "1.37")=+k8s:required + */ + handler?: string | undefined; + /** + * overhead represents the resource overhead associated with running a pod for a + * given RuntimeClass. For more details, see + * https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/ + * +optional + */ + overhead?: Overhead | undefined; + /** + * scheduling holds the scheduling constraints to ensure that pods running + * with this RuntimeClass are scheduled to nodes that support it. + * If scheduling is nil, this RuntimeClass is assumed to be supported by all + * nodes. + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + */ + scheduling?: Scheduling | undefined; +} + +/** RuntimeClassList is a list of RuntimeClass objects. */ +export interface RuntimeClassList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** items is a list of schema objects. */ + items: RuntimeClass[]; +} + +/** + * Scheduling specifies the scheduling constraints for nodes supporting a + * RuntimeClass. + */ +export interface Scheduling { + /** + * nodeSelector lists labels that must be present on nodes that support this + * RuntimeClass. Pods using this RuntimeClass can only be scheduled to a + * node matched by this selector. The RuntimeClass nodeSelector is merged + * with a pod's existing nodeSelector. Any conflicts will cause the pod to + * be rejected in admission. + * +optional + * +mapType=atomic + */ + nodeSelector: { [key: string]: string }; + /** + * tolerations are appended (excluding duplicates) to pods running with this + * RuntimeClass during admission, effectively unioning the set of nodes + * tolerated by the pod and the RuntimeClass. + * +optional + * +listType=atomic + * +k8s:alpha(since: "1.37")=+k8s:optional + */ + tolerations: Toleration[]; +} + +export interface Scheduling_NodeSelectorEntry { + key: string; + value: string; +} + +function createBaseOverhead(): Overhead { + return { podFixed: {} }; +} + +export const Overhead: MessageFns = { + encode(message: Overhead, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + globalThis.Object.entries(message.podFixed).forEach(([key, value]: [string, Quantity]) => { + Overhead_PodFixedEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Overhead { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOverhead(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + const entry1 = Overhead_PodFixedEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.podFixed[entry1.key] = entry1.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Overhead { + return { + podFixed: isObject(object.podFixed) + ? (globalThis.Object.entries(object.podFixed) as [string, any][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Quantity.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: Overhead): unknown { + const obj: any = {}; + if (message.podFixed) { + const entries = globalThis.Object.entries(message.podFixed) as [string, Quantity][]; + if (entries.length > 0) { + obj.podFixed = {}; + entries.forEach(([k, v]) => { + obj.podFixed[k] = Quantity.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): Overhead { + return Overhead.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Overhead { + const message = createBaseOverhead(); + message.podFixed = (globalThis.Object.entries(object.podFixed ?? {}) as [string, Quantity][]).reduce( + (acc: { [key: string]: Quantity }, [key, value]: [string, Quantity]) => { + if (value !== undefined) { + acc[key] = Quantity.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseOverhead_PodFixedEntry(): Overhead_PodFixedEntry { + return { key: '', value: undefined }; +} + +export const Overhead_PodFixedEntry: MessageFns = { + encode(message: Overhead_PodFixedEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Quantity.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Overhead_PodFixedEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOverhead_PodFixedEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Quantity.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Overhead_PodFixedEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Quantity.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Overhead_PodFixedEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Quantity.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Overhead_PodFixedEntry { + return Overhead_PodFixedEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Overhead_PodFixedEntry { + const message = createBaseOverhead_PodFixedEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Quantity.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseRuntimeClass(): RuntimeClass { + return { metadata: undefined, handler: '', overhead: undefined, scheduling: undefined }; +} + +export const RuntimeClass: MessageFns = { + encode(message: RuntimeClass, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.handler !== undefined && message.handler !== '') { + writer.uint32(18).string(message.handler); + } + if (message.overhead !== undefined) { + Overhead.encode(message.overhead, writer.uint32(26).fork()).join(); + } + if (message.scheduling !== undefined) { + Scheduling.encode(message.scheduling, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RuntimeClass { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRuntimeClass(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.handler = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.overhead = Overhead.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.scheduling = Scheduling.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RuntimeClass { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + handler: isSet(object.handler) ? globalThis.String(object.handler) : '', + overhead: isSet(object.overhead) ? Overhead.fromJSON(object.overhead) : undefined, + scheduling: isSet(object.scheduling) ? Scheduling.fromJSON(object.scheduling) : undefined, + }; + }, + + toJSON(message: RuntimeClass): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.handler !== undefined && message.handler !== '') { + obj.handler = message.handler; + } + if (message.overhead !== undefined) { + obj.overhead = Overhead.toJSON(message.overhead); + } + if (message.scheduling !== undefined) { + obj.scheduling = Scheduling.toJSON(message.scheduling); + } + return obj; + }, + + create, I>>(base?: I): RuntimeClass { + return RuntimeClass.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RuntimeClass { + const message = createBaseRuntimeClass(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.handler = object.handler ?? ''; + message.overhead = + object.overhead !== undefined && object.overhead !== null + ? Overhead.fromPartial(object.overhead) + : undefined; + message.scheduling = + object.scheduling !== undefined && object.scheduling !== null + ? Scheduling.fromPartial(object.scheduling) + : undefined; + return message; + }, +}; + +function createBaseRuntimeClassList(): RuntimeClassList { + return { metadata: undefined, items: [] }; +} + +export const RuntimeClassList: MessageFns = { + encode(message: RuntimeClassList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + RuntimeClass.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RuntimeClassList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRuntimeClassList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(RuntimeClass.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RuntimeClassList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => RuntimeClass.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RuntimeClassList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => RuntimeClass.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RuntimeClassList { + return RuntimeClassList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RuntimeClassList { + const message = createBaseRuntimeClassList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => RuntimeClass.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseScheduling(): Scheduling { + return { nodeSelector: {}, tolerations: [] }; +} + +export const Scheduling: MessageFns = { + encode(message: Scheduling, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + globalThis.Object.entries(message.nodeSelector).forEach(([key, value]: [string, string]) => { + Scheduling_NodeSelectorEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + for (const v of message.tolerations) { + Toleration.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Scheduling { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScheduling(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + const entry1 = Scheduling_NodeSelectorEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.nodeSelector[entry1.key] = entry1.value; + } + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.tolerations.push(Toleration.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Scheduling { + return { + nodeSelector: isObject(object.nodeSelector) + ? (globalThis.Object.entries(object.nodeSelector) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + tolerations: globalThis.Array.isArray(object?.tolerations) + ? object.tolerations.map((e: any) => Toleration.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Scheduling): unknown { + const obj: any = {}; + if (message.nodeSelector) { + const entries = globalThis.Object.entries(message.nodeSelector) as [string, string][]; + if (entries.length > 0) { + obj.nodeSelector = {}; + entries.forEach(([k, v]) => { + obj.nodeSelector[k] = v; + }); + } + } + if (message.tolerations?.length) { + obj.tolerations = message.tolerations.map((e) => Toleration.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Scheduling { + return Scheduling.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Scheduling { + const message = createBaseScheduling(); + message.nodeSelector = ( + globalThis.Object.entries(object.nodeSelector ?? {}) as [string, string][] + ).reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.tolerations = object.tolerations?.map((e) => Toleration.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseScheduling_NodeSelectorEntry(): Scheduling_NodeSelectorEntry { + return { key: '', value: '' }; +} + +export const Scheduling_NodeSelectorEntry: MessageFns = { + encode(message: Scheduling_NodeSelectorEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== '') { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Scheduling_NodeSelectorEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScheduling_NodeSelectorEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Scheduling_NodeSelectorEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? globalThis.String(object.value) : '', + }; + }, + + toJSON(message: Scheduling_NodeSelectorEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== '') { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): Scheduling_NodeSelectorEntry { + return Scheduling_NodeSelectorEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): Scheduling_NodeSelectorEntry { + const message = createBaseScheduling_NodeSelectorEntry(); + message.key = object.key ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/policy/v1/generated.ts b/src/proto/generated/k8s.io/api/policy/v1/generated.ts new file mode 100644 index 00000000000..c971eef1d6e --- /dev/null +++ b/src/proto/generated/k8s.io/api/policy/v1/generated.ts @@ -0,0 +1,995 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/policy/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { + Condition, + DeleteOptions, + LabelSelector, + ListMeta, + ObjectMeta, + Time, +} from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; +import { IntOrString } from '../../../apimachinery/pkg/util/intstr/generated.js'; + +/** + * Eviction evicts a pod from its node subject to certain policies and safety constraints. + * This is a subresource of Pod. A request to cause such an eviction is + * created by POSTing to .../pods//evictions. + */ +export interface Eviction { + /** + * metadata describes the pod that is being evicted. + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; + /** + * deleteOptions may be provided + * +optional + */ + deleteOptions?: DeleteOptions | undefined; +} + +/** + * PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods + * +k8s:supportsSubresource="/status" + */ +export interface PodDisruptionBudget { + /** + * metadata is the standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * spec is the specification of the desired behavior of the PodDisruptionBudget. + * +optional + */ + spec?: PodDisruptionBudgetSpec | undefined; + /** + * status is the most recently observed status of the PodDisruptionBudget. + * +optional + */ + status?: PodDisruptionBudgetStatus | undefined; +} + +/** PodDisruptionBudgetList is a collection of PodDisruptionBudgets. */ +export interface PodDisruptionBudgetList { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is a list of PodDisruptionBudgets */ + items: PodDisruptionBudget[]; +} + +/** PodDisruptionBudgetSpec is a description of a PodDisruptionBudget. */ +export interface PodDisruptionBudgetSpec { + /** + * minAvailable indicates that an eviction is allowed if at least "minAvailable" pods selected by + * "selector" will still be available after the eviction, i.e. even in the + * absence of the evicted pod. So for example you can prevent all voluntary + * evictions by specifying "100%". + * +optional + */ + minAvailable?: IntOrString | undefined; + /** + * selector is a label query over pods whose evictions are managed by the disruption + * budget. + * A null selector will match no pods, while an empty ({}) selector will select + * all pods within the namespace. + * +patchStrategy=replace + * +optional + */ + selector?: LabelSelector | undefined; + /** + * maxUnavailable indicates that an eviction is allowed if at most "maxUnavailable" pods selected by + * "selector" are unavailable after the eviction, i.e. even in absence of + * the evicted pod. For example, one can prevent all voluntary evictions + * by specifying 0. This is a mutually exclusive setting with "minAvailable". + * +optional + */ + maxUnavailable?: IntOrString | undefined; + /** + * unhealthyPodEvictionPolicy defines the criteria for when unhealthy pods + * should be considered for eviction. Current implementation considers healthy pods, + * as pods that have status.conditions item with type="Ready",status="True". + * + * Valid policies are IfHealthyBudget and AlwaysAllow. + * If no policy is specified, the default behavior will be used, + * which corresponds to the IfHealthyBudget policy. + * + * IfHealthyBudget policy means that running pods (status.phase="Running"), + * but not yet healthy can be evicted only if the guarded application is not + * disrupted (status.currentHealthy is at least equal to status.desiredHealthy). + * Healthy pods will be subject to the PDB for eviction. + * + * AlwaysAllow policy means that all running pods (status.phase="Running"), + * but not yet healthy are considered disrupted and can be evicted regardless + * of whether the criteria in a PDB is met. This means perspective running + * pods of a disrupted application might not get a chance to become healthy. + * Healthy pods will be subject to the PDB for eviction. + * + * Additional policies may be added in the future. + * Clients making eviction decisions should disallow eviction of unhealthy pods + * if they encounter an unrecognized policy in this field. + * +optional + */ + unhealthyPodEvictionPolicy?: string | undefined; +} + +/** + * PodDisruptionBudgetStatus represents information about the status of a + * PodDisruptionBudget. Status may trail the actual state of a system. + */ +export interface PodDisruptionBudgetStatus { + /** + * Most recent generation observed when updating this PDB status. DisruptionsAllowed and other + * status information is valid only if observedGeneration equals to PDB's object generation. + * +optional + */ + observedGeneration?: number | undefined; + /** + * DisruptedPods contains information about pods whose eviction was + * processed by the API server eviction subresource handler but has not + * yet been observed by the PodDisruptionBudget controller. + * A pod will be in this map from the time when the API server processed the + * eviction request to the time when the pod is seen by PDB controller + * as having been marked for deletion (or after a timeout). The key in the map is the name of the pod + * and the value is the time when the API server processed the eviction request. If + * the deletion didn't occur and a pod is still there it will be removed from + * the list automatically by PodDisruptionBudget controller after some time. + * If everything goes smooth this map should be empty for the most of the time. + * Large number of entries in the map may indicate problems with pod deletions. + * +optional + */ + disruptedPods: { [key: string]: Time }; + /** + * Number of pod disruptions that are currently allowed. + * +optional + */ + disruptionsAllowed?: number | undefined; + /** + * current number of healthy pods + * +optional + */ + currentHealthy?: number | undefined; + /** + * minimum desired number of healthy pods + * +optional + */ + desiredHealthy?: number | undefined; + /** + * total number of pods counted by this disruption budget + * +optional + */ + expectedPods?: number | undefined; + /** + * Conditions contain conditions for PDB. The disruption controller sets the + * DisruptionAllowed condition. The following are known values for the reason field + * (additional reasons could be added in the future): + * - SyncFailed: The controller encountered an error and wasn't able to compute + * the number of allowed disruptions. Therefore no disruptions are + * allowed and the status of the condition will be False. + * - InsufficientPods: The number of pods are either at or below the number + * required by the PodDisruptionBudget. No disruptions are + * allowed and the status of the condition will be False. + * - SufficientPods: There are more pods than required by the PodDisruptionBudget. + * The condition will be True, and the number of allowed + * disruptions are provided by the disruptionsAllowed property. + * + * +optional + * +patchMergeKey=type + * +patchStrategy=merge + * +listType=map + * +listMapKey=type + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:listType=map + * +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + */ + conditions: Condition[]; +} + +export interface PodDisruptionBudgetStatus_DisruptedPodsEntry { + key: string; + value: Time | undefined; +} + +function createBaseEviction(): Eviction { + return { metadata: undefined, deleteOptions: undefined }; +} + +export const Eviction: MessageFns = { + encode(message: Eviction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.deleteOptions !== undefined) { + DeleteOptions.encode(message.deleteOptions, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Eviction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEviction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.deleteOptions = DeleteOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Eviction { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + deleteOptions: isSet(object.deleteOptions) + ? DeleteOptions.fromJSON(object.deleteOptions) + : undefined, + }; + }, + + toJSON(message: Eviction): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.deleteOptions !== undefined) { + obj.deleteOptions = DeleteOptions.toJSON(message.deleteOptions); + } + return obj; + }, + + create, I>>(base?: I): Eviction { + return Eviction.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Eviction { + const message = createBaseEviction(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.deleteOptions = + object.deleteOptions !== undefined && object.deleteOptions !== null + ? DeleteOptions.fromPartial(object.deleteOptions) + : undefined; + return message; + }, +}; + +function createBasePodDisruptionBudget(): PodDisruptionBudget { + return { metadata: undefined, spec: undefined, status: undefined }; +} + +export const PodDisruptionBudget: MessageFns = { + encode(message: PodDisruptionBudget, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.spec !== undefined) { + PodDisruptionBudgetSpec.encode(message.spec, writer.uint32(18).fork()).join(); + } + if (message.status !== undefined) { + PodDisruptionBudgetStatus.encode(message.status, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodDisruptionBudget { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodDisruptionBudget(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.spec = PodDisruptionBudgetSpec.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.status = PodDisruptionBudgetStatus.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodDisruptionBudget { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + spec: isSet(object.spec) ? PodDisruptionBudgetSpec.fromJSON(object.spec) : undefined, + status: isSet(object.status) ? PodDisruptionBudgetStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: PodDisruptionBudget): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.spec !== undefined) { + obj.spec = PodDisruptionBudgetSpec.toJSON(message.spec); + } + if (message.status !== undefined) { + obj.status = PodDisruptionBudgetStatus.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): PodDisruptionBudget { + return PodDisruptionBudget.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PodDisruptionBudget { + const message = createBasePodDisruptionBudget(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.spec = + object.spec !== undefined && object.spec !== null + ? PodDisruptionBudgetSpec.fromPartial(object.spec) + : undefined; + message.status = + object.status !== undefined && object.status !== null + ? PodDisruptionBudgetStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBasePodDisruptionBudgetList(): PodDisruptionBudgetList { + return { metadata: undefined, items: [] }; +} + +export const PodDisruptionBudgetList: MessageFns = { + encode(message: PodDisruptionBudgetList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + PodDisruptionBudget.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodDisruptionBudgetList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodDisruptionBudgetList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(PodDisruptionBudget.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodDisruptionBudgetList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => PodDisruptionBudget.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PodDisruptionBudgetList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => PodDisruptionBudget.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PodDisruptionBudgetList { + return PodDisruptionBudgetList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodDisruptionBudgetList { + const message = createBasePodDisruptionBudgetList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => PodDisruptionBudget.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePodDisruptionBudgetSpec(): PodDisruptionBudgetSpec { + return { + minAvailable: undefined, + selector: undefined, + maxUnavailable: undefined, + unhealthyPodEvictionPolicy: '', + }; +} + +export const PodDisruptionBudgetSpec: MessageFns = { + encode(message: PodDisruptionBudgetSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minAvailable !== undefined) { + IntOrString.encode(message.minAvailable, writer.uint32(10).fork()).join(); + } + if (message.selector !== undefined) { + LabelSelector.encode(message.selector, writer.uint32(18).fork()).join(); + } + if (message.maxUnavailable !== undefined) { + IntOrString.encode(message.maxUnavailable, writer.uint32(26).fork()).join(); + } + if (message.unhealthyPodEvictionPolicy !== undefined && message.unhealthyPodEvictionPolicy !== '') { + writer.uint32(34).string(message.unhealthyPodEvictionPolicy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodDisruptionBudgetSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodDisruptionBudgetSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.minAvailable = IntOrString.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.selector = LabelSelector.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.maxUnavailable = IntOrString.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.unhealthyPodEvictionPolicy = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodDisruptionBudgetSpec { + return { + minAvailable: isSet(object.minAvailable) ? IntOrString.fromJSON(object.minAvailable) : undefined, + selector: isSet(object.selector) ? LabelSelector.fromJSON(object.selector) : undefined, + maxUnavailable: isSet(object.maxUnavailable) + ? IntOrString.fromJSON(object.maxUnavailable) + : undefined, + unhealthyPodEvictionPolicy: isSet(object.unhealthyPodEvictionPolicy) + ? globalThis.String(object.unhealthyPodEvictionPolicy) + : '', + }; + }, + + toJSON(message: PodDisruptionBudgetSpec): unknown { + const obj: any = {}; + if (message.minAvailable !== undefined) { + obj.minAvailable = IntOrString.toJSON(message.minAvailable); + } + if (message.selector !== undefined) { + obj.selector = LabelSelector.toJSON(message.selector); + } + if (message.maxUnavailable !== undefined) { + obj.maxUnavailable = IntOrString.toJSON(message.maxUnavailable); + } + if (message.unhealthyPodEvictionPolicy !== undefined && message.unhealthyPodEvictionPolicy !== '') { + obj.unhealthyPodEvictionPolicy = message.unhealthyPodEvictionPolicy; + } + return obj; + }, + + create, I>>(base?: I): PodDisruptionBudgetSpec { + return PodDisruptionBudgetSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodDisruptionBudgetSpec { + const message = createBasePodDisruptionBudgetSpec(); + message.minAvailable = + object.minAvailable !== undefined && object.minAvailable !== null + ? IntOrString.fromPartial(object.minAvailable) + : undefined; + message.selector = + object.selector !== undefined && object.selector !== null + ? LabelSelector.fromPartial(object.selector) + : undefined; + message.maxUnavailable = + object.maxUnavailable !== undefined && object.maxUnavailable !== null + ? IntOrString.fromPartial(object.maxUnavailable) + : undefined; + message.unhealthyPodEvictionPolicy = object.unhealthyPodEvictionPolicy ?? ''; + return message; + }, +}; + +function createBasePodDisruptionBudgetStatus(): PodDisruptionBudgetStatus { + return { + observedGeneration: 0, + disruptedPods: {}, + disruptionsAllowed: 0, + currentHealthy: 0, + desiredHealthy: 0, + expectedPods: 0, + conditions: [], + }; +} + +export const PodDisruptionBudgetStatus: MessageFns = { + encode(message: PodDisruptionBudgetStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(8).int64(message.observedGeneration); + } + globalThis.Object.entries(message.disruptedPods).forEach(([key, value]: [string, Time]) => { + PodDisruptionBudgetStatus_DisruptedPodsEntry.encode( + { key: key as any, value }, + writer.uint32(18).fork(), + ).join(); + }); + if (message.disruptionsAllowed !== undefined && message.disruptionsAllowed !== 0) { + writer.uint32(24).int32(message.disruptionsAllowed); + } + if (message.currentHealthy !== undefined && message.currentHealthy !== 0) { + writer.uint32(32).int32(message.currentHealthy); + } + if (message.desiredHealthy !== undefined && message.desiredHealthy !== 0) { + writer.uint32(40).int32(message.desiredHealthy); + } + if (message.expectedPods !== undefined && message.expectedPods !== 0) { + writer.uint32(48).int32(message.expectedPods); + } + for (const v of message.conditions) { + Condition.encode(v!, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PodDisruptionBudgetStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodDisruptionBudgetStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = PodDisruptionBudgetStatus_DisruptedPodsEntry.decode( + reader, + reader.uint32(), + ); + if (entry2.value !== undefined) { + message.disruptedPods[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.disruptionsAllowed = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.currentHealthy = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.desiredHealthy = reader.int32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.expectedPods = reader.int32(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.conditions.push(Condition.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodDisruptionBudgetStatus { + return { + observedGeneration: isSet(object.observedGeneration) + ? globalThis.Number(object.observedGeneration) + : 0, + disruptedPods: isObject(object.disruptedPods) + ? (globalThis.Object.entries(object.disruptedPods) as [string, any][]).reduce( + (acc: { [key: string]: Time }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: Time.fromJSON(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + disruptionsAllowed: isSet(object.disruptionsAllowed) + ? globalThis.Number(object.disruptionsAllowed) + : 0, + currentHealthy: isSet(object.currentHealthy) ? globalThis.Number(object.currentHealthy) : 0, + desiredHealthy: isSet(object.desiredHealthy) ? globalThis.Number(object.desiredHealthy) : 0, + expectedPods: isSet(object.expectedPods) ? globalThis.Number(object.expectedPods) : 0, + conditions: globalThis.Array.isArray(object?.conditions) + ? object.conditions.map((e: any) => Condition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PodDisruptionBudgetStatus): unknown { + const obj: any = {}; + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.disruptedPods) { + const entries = globalThis.Object.entries(message.disruptedPods) as [string, Time][]; + if (entries.length > 0) { + obj.disruptedPods = {}; + entries.forEach(([k, v]) => { + obj.disruptedPods[k] = Time.toJSON(v); + }); + } + } + if (message.disruptionsAllowed !== undefined && message.disruptionsAllowed !== 0) { + obj.disruptionsAllowed = Math.round(message.disruptionsAllowed); + } + if (message.currentHealthy !== undefined && message.currentHealthy !== 0) { + obj.currentHealthy = Math.round(message.currentHealthy); + } + if (message.desiredHealthy !== undefined && message.desiredHealthy !== 0) { + obj.desiredHealthy = Math.round(message.desiredHealthy); + } + if (message.expectedPods !== undefined && message.expectedPods !== 0) { + obj.expectedPods = Math.round(message.expectedPods); + } + if (message.conditions?.length) { + obj.conditions = message.conditions.map((e) => Condition.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PodDisruptionBudgetStatus { + return PodDisruptionBudgetStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodDisruptionBudgetStatus { + const message = createBasePodDisruptionBudgetStatus(); + message.observedGeneration = object.observedGeneration ?? 0; + message.disruptedPods = ( + globalThis.Object.entries(object.disruptedPods ?? {}) as [string, Time][] + ).reduce((acc: { [key: string]: Time }, [key, value]: [string, Time]) => { + if (value !== undefined) { + acc[key] = Time.fromPartial(value); + } + return acc; + }, {}); + message.disruptionsAllowed = object.disruptionsAllowed ?? 0; + message.currentHealthy = object.currentHealthy ?? 0; + message.desiredHealthy = object.desiredHealthy ?? 0; + message.expectedPods = object.expectedPods ?? 0; + message.conditions = object.conditions?.map((e) => Condition.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePodDisruptionBudgetStatus_DisruptedPodsEntry(): PodDisruptionBudgetStatus_DisruptedPodsEntry { + return { key: '', value: undefined }; +} + +export const PodDisruptionBudgetStatus_DisruptedPodsEntry: MessageFns = + { + encode( + message: PodDisruptionBudgetStatus_DisruptedPodsEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== '') { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Time.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): PodDisruptionBudgetStatus_DisruptedPodsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePodDisruptionBudgetStatus_DisruptedPodsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Time.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PodDisruptionBudgetStatus_DisruptedPodsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : '', + value: isSet(object.value) ? Time.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: PodDisruptionBudgetStatus_DisruptedPodsEntry): unknown { + const obj: any = {}; + if (message.key !== '') { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Time.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): PodDisruptionBudgetStatus_DisruptedPodsEntry { + return PodDisruptionBudgetStatus_DisruptedPodsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PodDisruptionBudgetStatus_DisruptedPodsEntry { + const message = createBasePodDisruptionBudgetStatus_DisruptedPodsEntry(); + message.key = object.key ?? ''; + message.value = + object.value !== undefined && object.value !== null + ? Time.fromPartial(object.value) + : undefined; + return message; + }, + }; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error('Value is smaller than Number.MIN_SAFE_INTEGER'); + } + return num; +} + +function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/rbac/v1/generated.ts b/src/proto/generated/k8s.io/api/rbac/v1/generated.ts new file mode 100644 index 00000000000..c7b7ea0fcc4 --- /dev/null +++ b/src/proto/generated/k8s.io/api/rbac/v1/generated.ts @@ -0,0 +1,1497 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/rbac/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { LabelSelector, ListMeta, ObjectMeta } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; + +/** AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole */ +export interface AggregationRule { + /** + * clusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. + * If any of the selectors match, then the ClusterRole's permissions will be added + * +optional + * +listType=atomic + */ + clusterRoleSelectors: LabelSelector[]; +} + +/** ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. */ +export interface ClusterRole { + /** + * metadata is the standard object's metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * rules holds all the PolicyRules for this ClusterRole + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + rules: PolicyRule[]; + /** + * aggregationRule is an optional field that describes how to build the Rules for this ClusterRole. + * If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be + * stomped by the controller. + * +optional + */ + aggregationRule?: AggregationRule | undefined; +} + +/** + * ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, + * and adds who information via Subject. + */ +export interface ClusterRoleBinding { + /** + * metadata is the standard object's metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * subjects holds references to the objects the role applies to. + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + subjects: Subject[]; + /** + * roleRef can only reference a ClusterRole in the global namespace. + * If the RoleRef cannot be resolved, the Authorizer must return an error. + * This field is immutable. + * +required + * +k8s:alpha(since:"1.37")=+k8s:immutable + */ + roleRef?: RoleRef | undefined; +} + +/** ClusterRoleBindingList is a collection of ClusterRoleBindings */ +export interface ClusterRoleBindingList { + /** + * Standard object's metadata. + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is a list of ClusterRoleBindings */ + items: ClusterRoleBinding[]; +} + +/** ClusterRoleList is a collection of ClusterRoles */ +export interface ClusterRoleList { + /** + * Standard object's metadata. + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is a list of ClusterRoles */ + items: ClusterRole[]; +} + +/** + * PolicyRule holds information that describes a policy rule, but does not contain information + * about who the rule applies to or which namespace the rule applies to. + */ +export interface PolicyRule { + /** + * verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. + * +listType=atomic + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + verbs: string[]; + /** + * apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + * the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. + * +optional + * +listType=atomic + */ + apiGroups: string[]; + /** + * resources is a list of resources this rule applies to. '*' represents all resources. + * +optional + * +listType=atomic + */ + resources: string[]; + /** + * resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + * +optional + * +listType=atomic + */ + resourceNames: string[]; + /** + * nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + * Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. + * Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. + * +optional + * +listType=atomic + */ + nonResourceURLs: string[]; +} + +/** Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. */ +export interface Role { + /** + * metadata is the standard object's metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * rules holds all the PolicyRules for this Role + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + rules: PolicyRule[]; +} + +/** + * RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. + * It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given + * namespace only have effect in that namespace. + */ +export interface RoleBinding { + /** + * metadata is the standard object's metadata. + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * subjects holds references to the objects the role applies to. + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + */ + subjects: Subject[]; + /** + * roleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + * If the RoleRef cannot be resolved, the Authorizer must return an error. + * This field is immutable. + * +required + * +k8s:alpha(since:"1.37")=+k8s:immutable + */ + roleRef?: RoleRef | undefined; +} + +/** RoleBindingList is a collection of RoleBindings */ +export interface RoleBindingList { + /** + * Standard object's metadata. + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is a list of RoleBindings */ + items: RoleBinding[]; +} + +/** RoleList is a collection of Roles */ +export interface RoleList { + /** + * Standard object's metadata. + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is a list of Roles */ + items: Role[]; +} + +/** + * RoleRef contains information that points to the role being used + * +structType=atomic + */ +export interface RoleRef { + /** + * apiGroup is the group for the resource being referenced + * +optional + */ + apiGroup?: string | undefined; + /** + * kind is the type of resource being referenced + * +required + */ + kind?: string | undefined; + /** + * name is the name of resource being referenced + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + name?: string | undefined; +} + +/** + * Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, + * or a value for non-objects such as user and group names. + * +structType=atomic + */ +export interface Subject { + /** + * kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". + * If the Authorizer does not recognized the kind value, the Authorizer should report an error. + * +required + */ + kind?: string | undefined; + /** + * apiGroup holds the API group of the referenced subject. + * Defaults to "" for ServiceAccount subjects. + * Defaults to "rbac.authorization.k8s.io" for User and Group subjects. + * +optional + */ + apiGroup?: string | undefined; + /** + * name of the object being referenced. + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + name?: string | undefined; + /** + * namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty + * the Authorizer should report an error. + * +optional + */ + namespace?: string | undefined; +} + +function createBaseAggregationRule(): AggregationRule { + return { clusterRoleSelectors: [] }; +} + +export const AggregationRule: MessageFns = { + encode(message: AggregationRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.clusterRoleSelectors) { + LabelSelector.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AggregationRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAggregationRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.clusterRoleSelectors.push(LabelSelector.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): AggregationRule { + return { + clusterRoleSelectors: globalThis.Array.isArray(object?.clusterRoleSelectors) + ? object.clusterRoleSelectors.map((e: any) => LabelSelector.fromJSON(e)) + : [], + }; + }, + + toJSON(message: AggregationRule): unknown { + const obj: any = {}; + if (message.clusterRoleSelectors?.length) { + obj.clusterRoleSelectors = message.clusterRoleSelectors.map((e) => LabelSelector.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): AggregationRule { + return AggregationRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AggregationRule { + const message = createBaseAggregationRule(); + message.clusterRoleSelectors = + object.clusterRoleSelectors?.map((e) => LabelSelector.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseClusterRole(): ClusterRole { + return { metadata: undefined, rules: [], aggregationRule: undefined }; +} + +export const ClusterRole: MessageFns = { + encode(message: ClusterRole, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.rules) { + PolicyRule.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.aggregationRule !== undefined) { + AggregationRule.encode(message.aggregationRule, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClusterRole { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClusterRole(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.rules.push(PolicyRule.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.aggregationRule = AggregationRule.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ClusterRole { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + rules: globalThis.Array.isArray(object?.rules) + ? object.rules.map((e: any) => PolicyRule.fromJSON(e)) + : [], + aggregationRule: isSet(object.aggregationRule) + ? AggregationRule.fromJSON(object.aggregationRule) + : undefined, + }; + }, + + toJSON(message: ClusterRole): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.rules?.length) { + obj.rules = message.rules.map((e) => PolicyRule.toJSON(e)); + } + if (message.aggregationRule !== undefined) { + obj.aggregationRule = AggregationRule.toJSON(message.aggregationRule); + } + return obj; + }, + + create, I>>(base?: I): ClusterRole { + return ClusterRole.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClusterRole { + const message = createBaseClusterRole(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.rules = object.rules?.map((e) => PolicyRule.fromPartial(e)) || []; + message.aggregationRule = + object.aggregationRule !== undefined && object.aggregationRule !== null + ? AggregationRule.fromPartial(object.aggregationRule) + : undefined; + return message; + }, +}; + +function createBaseClusterRoleBinding(): ClusterRoleBinding { + return { metadata: undefined, subjects: [], roleRef: undefined }; +} + +export const ClusterRoleBinding: MessageFns = { + encode(message: ClusterRoleBinding, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.subjects) { + Subject.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.roleRef !== undefined) { + RoleRef.encode(message.roleRef, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClusterRoleBinding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClusterRoleBinding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.subjects.push(Subject.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.roleRef = RoleRef.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ClusterRoleBinding { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + subjects: globalThis.Array.isArray(object?.subjects) + ? object.subjects.map((e: any) => Subject.fromJSON(e)) + : [], + roleRef: isSet(object.roleRef) ? RoleRef.fromJSON(object.roleRef) : undefined, + }; + }, + + toJSON(message: ClusterRoleBinding): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.subjects?.length) { + obj.subjects = message.subjects.map((e) => Subject.toJSON(e)); + } + if (message.roleRef !== undefined) { + obj.roleRef = RoleRef.toJSON(message.roleRef); + } + return obj; + }, + + create, I>>(base?: I): ClusterRoleBinding { + return ClusterRoleBinding.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClusterRoleBinding { + const message = createBaseClusterRoleBinding(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.subjects = object.subjects?.map((e) => Subject.fromPartial(e)) || []; + message.roleRef = + object.roleRef !== undefined && object.roleRef !== null + ? RoleRef.fromPartial(object.roleRef) + : undefined; + return message; + }, +}; + +function createBaseClusterRoleBindingList(): ClusterRoleBindingList { + return { metadata: undefined, items: [] }; +} + +export const ClusterRoleBindingList: MessageFns = { + encode(message: ClusterRoleBindingList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ClusterRoleBinding.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClusterRoleBindingList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClusterRoleBindingList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ClusterRoleBinding.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ClusterRoleBindingList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ClusterRoleBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ClusterRoleBindingList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ClusterRoleBinding.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ClusterRoleBindingList { + return ClusterRoleBindingList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClusterRoleBindingList { + const message = createBaseClusterRoleBindingList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ClusterRoleBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseClusterRoleList(): ClusterRoleList { + return { metadata: undefined, items: [] }; +} + +export const ClusterRoleList: MessageFns = { + encode(message: ClusterRoleList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + ClusterRole.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClusterRoleList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClusterRoleList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(ClusterRole.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ClusterRoleList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => ClusterRole.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ClusterRoleList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => ClusterRole.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ClusterRoleList { + return ClusterRoleList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClusterRoleList { + const message = createBaseClusterRoleList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => ClusterRole.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePolicyRule(): PolicyRule { + return { verbs: [], apiGroups: [], resources: [], resourceNames: [], nonResourceURLs: [] }; +} + +export const PolicyRule: MessageFns = { + encode(message: PolicyRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.verbs) { + writer.uint32(10).string(v!); + } + for (const v of message.apiGroups) { + writer.uint32(18).string(v!); + } + for (const v of message.resources) { + writer.uint32(26).string(v!); + } + for (const v of message.resourceNames) { + writer.uint32(34).string(v!); + } + for (const v of message.nonResourceURLs) { + writer.uint32(42).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PolicyRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePolicyRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.verbs.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.apiGroups.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.resources.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.resourceNames.push(reader.string()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.nonResourceURLs.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PolicyRule { + return { + verbs: globalThis.Array.isArray(object?.verbs) + ? object.verbs.map((e: any) => globalThis.String(e)) + : [], + apiGroups: globalThis.Array.isArray(object?.apiGroups) + ? object.apiGroups.map((e: any) => globalThis.String(e)) + : [], + resources: globalThis.Array.isArray(object?.resources) + ? object.resources.map((e: any) => globalThis.String(e)) + : [], + resourceNames: globalThis.Array.isArray(object?.resourceNames) + ? object.resourceNames.map((e: any) => globalThis.String(e)) + : [], + nonResourceURLs: globalThis.Array.isArray(object?.nonResourceURLs) + ? object.nonResourceURLs.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: PolicyRule): unknown { + const obj: any = {}; + if (message.verbs?.length) { + obj.verbs = message.verbs; + } + if (message.apiGroups?.length) { + obj.apiGroups = message.apiGroups; + } + if (message.resources?.length) { + obj.resources = message.resources; + } + if (message.resourceNames?.length) { + obj.resourceNames = message.resourceNames; + } + if (message.nonResourceURLs?.length) { + obj.nonResourceURLs = message.nonResourceURLs; + } + return obj; + }, + + create, I>>(base?: I): PolicyRule { + return PolicyRule.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PolicyRule { + const message = createBasePolicyRule(); + message.verbs = object.verbs?.map((e) => e) || []; + message.apiGroups = object.apiGroups?.map((e) => e) || []; + message.resources = object.resources?.map((e) => e) || []; + message.resourceNames = object.resourceNames?.map((e) => e) || []; + message.nonResourceURLs = object.nonResourceURLs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseRole(): Role { + return { metadata: undefined, rules: [] }; +} + +export const Role: MessageFns = { + encode(message: Role, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.rules) { + PolicyRule.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Role { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRole(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.rules.push(PolicyRule.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Role { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + rules: globalThis.Array.isArray(object?.rules) + ? object.rules.map((e: any) => PolicyRule.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Role): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.rules?.length) { + obj.rules = message.rules.map((e) => PolicyRule.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Role { + return Role.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Role { + const message = createBaseRole(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.rules = object.rules?.map((e) => PolicyRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRoleBinding(): RoleBinding { + return { metadata: undefined, subjects: [], roleRef: undefined }; +} + +export const RoleBinding: MessageFns = { + encode(message: RoleBinding, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.subjects) { + Subject.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.roleRef !== undefined) { + RoleRef.encode(message.roleRef, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RoleBinding { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRoleBinding(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.subjects.push(Subject.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.roleRef = RoleRef.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RoleBinding { + return { + metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined, + subjects: globalThis.Array.isArray(object?.subjects) + ? object.subjects.map((e: any) => Subject.fromJSON(e)) + : [], + roleRef: isSet(object.roleRef) ? RoleRef.fromJSON(object.roleRef) : undefined, + }; + }, + + toJSON(message: RoleBinding): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + if (message.subjects?.length) { + obj.subjects = message.subjects.map((e) => Subject.toJSON(e)); + } + if (message.roleRef !== undefined) { + obj.roleRef = RoleRef.toJSON(message.roleRef); + } + return obj; + }, + + create, I>>(base?: I): RoleBinding { + return RoleBinding.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RoleBinding { + const message = createBaseRoleBinding(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + message.subjects = object.subjects?.map((e) => Subject.fromPartial(e)) || []; + message.roleRef = + object.roleRef !== undefined && object.roleRef !== null + ? RoleRef.fromPartial(object.roleRef) + : undefined; + return message; + }, +}; + +function createBaseRoleBindingList(): RoleBindingList { + return { metadata: undefined, items: [] }; +} + +export const RoleBindingList: MessageFns = { + encode(message: RoleBindingList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + RoleBinding.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RoleBindingList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRoleBindingList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(RoleBinding.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RoleBindingList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => RoleBinding.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RoleBindingList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => RoleBinding.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RoleBindingList { + return RoleBindingList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RoleBindingList { + const message = createBaseRoleBindingList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => RoleBinding.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRoleList(): RoleList { + return { metadata: undefined, items: [] }; +} + +export const RoleList: MessageFns = { + encode(message: RoleList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + Role.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RoleList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRoleList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Role.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RoleList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Role.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RoleList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => Role.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RoleList { + return RoleList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RoleList { + const message = createBaseRoleList(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => Role.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRoleRef(): RoleRef { + return { apiGroup: '', kind: '', name: '' }; +} + +export const RoleRef: MessageFns = { + encode(message: RoleRef, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.apiGroup !== undefined && message.apiGroup !== '') { + writer.uint32(10).string(message.apiGroup); + } + if (message.kind !== undefined && message.kind !== '') { + writer.uint32(18).string(message.kind); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(26).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RoleRef { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRoleRef(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.apiGroup = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.kind = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RoleRef { + return { + apiGroup: isSet(object.apiGroup) ? globalThis.String(object.apiGroup) : '', + kind: isSet(object.kind) ? globalThis.String(object.kind) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + }; + }, + + toJSON(message: RoleRef): unknown { + const obj: any = {}; + if (message.apiGroup !== undefined && message.apiGroup !== '') { + obj.apiGroup = message.apiGroup; + } + if (message.kind !== undefined && message.kind !== '') { + obj.kind = message.kind; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): RoleRef { + return RoleRef.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RoleRef { + const message = createBaseRoleRef(); + message.apiGroup = object.apiGroup ?? ''; + message.kind = object.kind ?? ''; + message.name = object.name ?? ''; + return message; + }, +}; + +function createBaseSubject(): Subject { + return { kind: '', apiGroup: '', name: '', namespace: '' }; +} + +export const Subject: MessageFns = { + encode(message: Subject, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kind !== undefined && message.kind !== '') { + writer.uint32(10).string(message.kind); + } + if (message.apiGroup !== undefined && message.apiGroup !== '') { + writer.uint32(18).string(message.apiGroup); + } + if (message.name !== undefined && message.name !== '') { + writer.uint32(26).string(message.name); + } + if (message.namespace !== undefined && message.namespace !== '') { + writer.uint32(34).string(message.namespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Subject { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error('protobuf decode recursion limit exceeded'); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubject(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.apiGroup = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.namespace = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Subject { + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : '', + apiGroup: isSet(object.apiGroup) ? globalThis.String(object.apiGroup) : '', + name: isSet(object.name) ? globalThis.String(object.name) : '', + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : '', + }; + }, + + toJSON(message: Subject): unknown { + const obj: any = {}; + if (message.kind !== undefined && message.kind !== '') { + obj.kind = message.kind; + } + if (message.apiGroup !== undefined && message.apiGroup !== '') { + obj.apiGroup = message.apiGroup; + } + if (message.name !== undefined && message.name !== '') { + obj.name = message.name; + } + if (message.namespace !== undefined && message.namespace !== '') { + obj.namespace = message.namespace; + } + return obj; + }, + + create, I>>(base?: I): Subject { + return Subject.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Subject { + const message = createBaseSubject(); + message.kind = object.kind ?? ''; + message.apiGroup = object.apiGroup ?? ''; + message.name = object.name ?? ''; + message.namespace = object.namespace ?? ''; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/proto/generated/k8s.io/api/resource/v1/generated.ts b/src/proto/generated/k8s.io/api/resource/v1/generated.ts new file mode 100644 index 00000000000..61bcdfe40f5 --- /dev/null +++ b/src/proto/generated/k8s.io/api/resource/v1/generated.ts @@ -0,0 +1,9300 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.6.1 +// source: k8s.io/api/resource/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { Quantity } from '../../../apimachinery/pkg/api/resource/generated.js'; +import { Condition, ListMeta, ObjectMeta, Time } from '../../../apimachinery/pkg/apis/meta/v1/generated.js'; +import { RawExtension } from '../../../apimachinery/pkg/runtime/generated.js'; +import { NodeSelector } from '../../core/v1/generated.js'; + +/** + * AllocatedDeviceStatus contains the status of an allocated device, if the + * driver chooses to report it. This may include driver-specific information. + * + * The combination of Driver, Pool, Device, and ShareID must match the corresponding key + * in Status.Allocation.Devices. + */ +export interface AllocatedDeviceStatus { + /** + * Driver specifies the name of the DRA driver whose kubelet + * plugin should be invoked to process the allocation once the claim is + * needed on a node. + * + * Must be a DNS subdomain and should end with a DNS domain owned by the + * vendor of the driver. It should use only lower case characters. + * + * +required + */ + driver?: string | undefined; + /** + * This name together with the driver name and the device name field + * identify which device was allocated (`//`). + * + * Must not be longer than 253 characters and may contain one or more + * DNS sub-domains separated by slashes. + * + * +required + */ + pool?: string | undefined; + /** + * Device references one device instance via its name in the driver's + * resource pool. It must be a DNS label. + * + * +required + */ + device?: string | undefined; + /** + * ShareID uniquely identifies an individual allocation share of the device. + * + * +optional + * +featureGate=DRAConsumableCapacity + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid + */ + shareID?: string | undefined; + /** + * Conditions contains the latest observation of the device's state. + * If the device has been configured according to the class and claim + * config references, the `Ready` condition should be True. + * + * Must not contain more than 8 entries. + * + * +optional + * +listType=map + * +listMapKey=type + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:listType=map + * +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + */ + conditions: Condition[]; + /** + * Data contains arbitrary driver-specific data. + * + * The length of the raw data must be smaller or equal to 10 Ki. + * + * +optional + */ + data?: RawExtension | undefined; + /** + * NetworkData contains network-related information specific to the device. + * + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + */ + networkData?: NetworkDeviceData | undefined; +} + +/** AllocationResult contains attributes of an allocated resource. */ +export interface AllocationResult { + /** + * Devices is the result of allocating devices. + * + * +optional + */ + devices?: DeviceAllocationResult | undefined; + /** + * NodeSelector defines where the allocated resources are available. If + * unset, they are available everywhere. + * + * +optional + */ + nodeSelector?: NodeSelector | undefined; + /** + * AllocationTimestamp stores the time when the resources were allocated. + * This field is not guaranteed to be set, in which case that time is unknown. + * + * This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + * feature gate. + * + * +optional + * +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus + */ + allocationTimestamp?: Time | undefined; +} + +/** CELDeviceSelector contains a CEL expression for selecting a device. */ +export interface CELDeviceSelector { + /** + * Expression is a CEL expression which evaluates a single device. It + * must evaluate to true when the device under consideration satisfies + * the desired criteria, and false when it does not. Any other result + * is an error and causes allocation of devices to abort. + * + * The expression's input is an object named "device", which carries + * the following properties: + * - driver (string): the name of the driver which defines this device. + * - attributes (map[string]object): the device's attributes, grouped by prefix + * (e.g. device.attributes["dra.example.com"] evaluates to an object with all + * of the attributes which were prefixed by "dra.example.com"). + * - capacity (map[string]object): the device's capacities, grouped by prefix. + * - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device + * (v1.34+ with the DRAConsumableCapacity feature enabled). + * + * Example: Consider a device with driver="dra.example.com", which exposes + * two attributes named "model" and "ext.example.com/family" and which + * exposes one capacity named "modules". This input to this expression + * would have the following fields: + * + * device.driver + * device.attributes["dra.example.com"].model + * device.attributes["ext.example.com"].family + * device.capacity["dra.example.com"].modules + * + * The device.driver field can be used to check for a specific driver, + * either as a high-level precondition (i.e. you only want to consider + * devices from this driver) or as part of a multi-clause expression + * that is meant to consider devices from different drivers. + * + * The value type of each attribute is defined by the device + * definition, and users who write these expressions must consult the + * documentation for their specific drivers. The value type of each + * capacity is Quantity. + * + * If an unknown prefix is used as a lookup in either device.attributes + * or device.capacity, an empty map will be returned. Any reference to + * an unknown field will cause an evaluation error and allocation to + * abort. + * + * A robust expression should check for the existence of attributes + * before referencing them. + * + * Common errors: + * - "no such key": Use optional chaining (.? followed by orValue()) + * or guarding the check with has() for optional fields. + * See CEL Optional Types for details: + * https://pkg.go.dev/github.com/google/cel-go@v0.17.4/cel#OptionalTypes + * + * For more CEL expression syntax and examples, see: + * https://kubernetes.io/docs/reference/using-api/cel/ + * + * For ease of use, the cel.bind() function is enabled, and can be used + * to simplify expressions that access multiple attributes with the + * same domain. For example: + * + * cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool) + * + * When the DRAListTypeAttributes feature gate is enabled, + * the includes() helper is available and it can work for both scalar + * and list-type attributes. It was introduced to support smooth migration + * from scalar attributes to list-type attributes while keeping + * CEL expressions simple. For example: + * + * device.attributes["dra.example.com"].models.includes("some-model") + * + * The length of the expression must be smaller or equal to 10 Ki. The + * cost of evaluating it is also limited based on the estimated number + * of logical steps. + * + * +required + */ + expression?: string | undefined; +} + +/** + * CapacityRequestPolicy defines how requests consume device capacity. + * + * Must not set more than one ValidRequestValues. + */ +export interface CapacityRequestPolicy { + /** + * Default specifies how much of this capacity is consumed by a request + * that does not contain an entry for it in DeviceRequest's Capacity. + * + * +optional + */ + default?: Quantity | undefined; + /** + * ValidValues defines a set of acceptable quantity values in consuming requests. + * + * Must not contain more than 10 entries. + * Must be sorted in ascending order. + * + * If this field is set, + * Default must be defined and it must be included in ValidValues list. + * + * If the requested amount does not match any valid value but smaller than some valid values, + * the scheduler calculates the smallest valid value that is greater than or equal to the request. + * That is: min(ceil(requestedValue) ∈ validValues), where requestedValue ≤ max(validValues). + * + * If the requested amount exceeds all valid values, the request violates the policy, + * and this device cannot be allocated. + * + * +optional + * +listType=atomic + * +oneOf=ValidRequestValues + */ + validValues: Quantity[]; + /** + * ValidRange defines an acceptable quantity value range in consuming requests. + * + * If this field is set, + * Default must be defined and it must fall within the defined ValidRange. + * + * If the requested amount does not fall within the defined range, the request violates the policy, + * and this device cannot be allocated. + * + * If the request doesn't contain this capacity entry, Default value is used. + * + * +optional + * +oneOf=ValidRequestValues + */ + validRange?: CapacityRequestPolicyRange | undefined; +} + +/** + * CapacityRequestPolicyRange defines a valid range for consumable capacity values. + * + * If the DRAFractionalCapacityRange feature gate is + * enabled and at least one of Min, Max, or Step is a fractional quantity (i.e. + * its value is not an integer), milli-unit arithmetic is used instead, + * supporting values with up to 3 decimal places (e.g. 100m = 0.1). + * The largest supported value then is 1000 times smaller compared to using 64-bit integers. + * Otherwise, all comparisons use 64-bit integer arithmetic via resource.Quantity.Value(). + * + * - If the requested amount is less than Min, it is rounded up to the Min value. + * - If Step is set and the requested amount is between Min and Max but not aligned with Step, + * it will be rounded up to the next value equal to Min + (n * Step). + * - If Step is not set, the requested amount is used as-is if it falls within the range Min to Max (if set). + * - If the requested or rounded amount exceeds Max (if set), the request does not satisfy the policy, + * and the device cannot be allocated. + */ +export interface CapacityRequestPolicyRange { + /** + * Min specifies the minimum capacity allowed for a consumption request. + * + * Min must be greater than or equal to zero, + * and less than or equal to the capacity value. + * requestPolicy.default must be more than or equal to the minimum. + * + * +required + */ + min?: Quantity | undefined; + /** + * Max defines the upper limit for capacity that can be requested. + * + * Max must be less than or equal to the capacity value. + * Min and requestPolicy.default must be less than or equal to the maximum. + * + * +optional + */ + max?: Quantity | undefined; + /** + * Step defines the step size between valid capacity amounts within the range. + * + * Max (if set) and requestPolicy.default must be a multiple of Step. + * Min + Step must be less than or equal to the capacity value. + * + * +optional + */ + step?: Quantity | undefined; +} + +/** CapacityRequirements defines the capacity requirements for a specific device request. */ +export interface CapacityRequirements { + /** + * Requests represent individual device resource requests for distinct resources, + * all of which must be provided by the device. + * + * This value is used as an additional filtering condition against the available capacity on the device. + * This is semantically equivalent to a CEL selector with + * `device.capacity[]..compareTo(quantity()) >= 0`. + * For example, device.capacity['test-driver.cdi.k8s.io'].counters.compareTo(quantity('2')) >= 0. + * + * When a requestPolicy is defined, the requested amount is adjusted upward + * to the nearest valid value based on the policy. + * If the requested amount cannot be adjusted to a valid value—because it exceeds what the requestPolicy allows— + * the device is considered ineligible for allocation. + * + * For any capacity that is not explicitly requested: + * - If no requestPolicy is set, the default consumed capacity is equal to the full device capacity + * (i.e., the whole device is claimed). + * - If a requestPolicy is set, the default consumed capacity is determined according to that policy. + * + * If the device allows multiple allocation, + * the aggregated amount across all requests must not exceed the capacity value. + * The consumed capacity, which may be adjusted based on the requestPolicy if defined, + * is recorded in the resource claim’s status.devices[*].consumedCapacity field. + * + * +optional + */ + requests: { [key: string]: Quantity }; +} + +export interface CapacityRequirements_RequestsEntry { + key: string; + value: Quantity | undefined; +} + +/** Counter describes a quantity associated with a device. */ +export interface Counter { + /** + * Value defines how much of a certain device counter is available. + * + * +required + */ + value?: Quantity | undefined; +} + +/** + * CounterSet defines a named set of counters + * that are available to be used by devices defined in the + * ResourcePool. + * + * The counters are not allocatable by themselves, but + * can be referenced by devices. When a device is allocated, + * the portion of counters it uses will no longer be available for use + * by other devices. + */ +export interface CounterSet { + /** + * Name defines the name of the counter set. + * It must be a DNS label. + * + * +required + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name + */ + name?: string | undefined; + /** + * Counters defines the set of counters for this CounterSet + * The name of each counter must be unique in that set and must be a DNS label. + * + * The maximum number of counters is 32. + * + * +required + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name + */ + counters: { [key: string]: Counter }; +} + +export interface CounterSet_CountersEntry { + key: string; + value: Counter | undefined; +} + +/** + * Device represents one individual hardware instance that can be selected based + * on its attributes. Besides the name, exactly one field must be set. + */ +export interface Device { + /** + * Name is unique identifier among all devices managed by + * the driver in the pool. It must be a DNS label. + * + * +required + */ + name?: string | undefined; + /** + * Attributes defines the set of attributes for this device. + * The name of each attribute must be unique in that set. + * + * The maximum number of attributes and capacities combined is 32. + * + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + */ + attributes: { [key: string]: DeviceAttribute }; + /** + * Capacity defines the set of capacities for this device. + * The name of each capacity must be unique in that set. + * + * The maximum number of attributes and capacities combined is 32. + * + * +optional + */ + capacity: { [key: string]: DeviceCapacity }; + /** + * ConsumesCounters defines a list of references to sharedCounters + * and the set of counters that the device will + * consume from those counter sets. + * + * There can only be a single entry per counterSet. + * + * The maximum number of device counter consumptions per + * device is 2. + * + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +listType=atomic + * +k8s:listType=atomic + * +k8s:beta(since: "1.37")=+k8s:unique=map + * +k8s:beta(since: "1.37")=+k8s:listMapKey=counterSet + * +featureGate=DRAPartitionableDevices + * +k8s:beta(since: "1.37")=+k8s:maxItems=2 + */ + consumesCounters: DeviceCounterConsumption[]; + /** + * NodeName identifies the node where the device is available. + * + * Must only be set if Spec.PerDeviceNodeSelection is set to true. + * At most one of NodeName, NodeSelector and AllNodes can be set. + * + * +optional + * +oneOf=DeviceNodeSelection + * +featureGate=DRAPartitionableDevices + */ + nodeName?: string | undefined; + /** + * NodeSelector defines the nodes where the device is available. + * + * Must use exactly one term. + * + * Must only be set if Spec.PerDeviceNodeSelection is set to true. + * At most one of NodeName, NodeSelector and AllNodes can be set. + * + * +optional + * +oneOf=DeviceNodeSelection + * +featureGate=DRAPartitionableDevices + */ + nodeSelector?: NodeSelector | undefined; + /** + * AllNodes indicates that all nodes have access to the device. + * + * Must only be set if Spec.PerDeviceNodeSelection is set to true. + * At most one of NodeName, NodeSelector and AllNodes can be set. + * + * +optional + * +oneOf=DeviceNodeSelection + * +featureGate=DRAPartitionableDevices + */ + allNodes?: boolean | undefined; + /** + * If specified, these are the driver-defined taints. + * + * The maximum number of taints is 16. If taints are set for + * any device in a ResourceSlice, then the maximum number of + * allowed devices per ResourceSlice is 64 instead of 128. + * + * This is a beta field and requires enabling the DRADeviceTaints + * feature gate. + * + * +optional + * +listType=atomic + * +featureGate=DRADeviceTaints + * +k8s:beta(since: "1.37")=+k8s:optional + */ + taints: DeviceTaint[]; + /** + * BindsToNode indicates if the usage of an allocation involving this device + * has to be limited to exactly the node that was chosen when allocating the claim. + * If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector + * to match the node where the allocation was made. + * + * This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + * feature gates. + * + * +optional + * +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus + */ + bindsToNode?: boolean | undefined; + /** + * BindingConditions defines the conditions for proceeding with binding. + * All of these conditions must be set in the per-device status + * conditions with a value of True to proceed with binding the pod to the node + * while scheduling the pod. + * + * The maximum number of binding conditions is 4. + * + * The conditions must be a valid condition type string. + * + * This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + * feature gates. + * + * +optional + * +listType=atomic + * +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:maxItems=4 + */ + bindingConditions: string[]; + /** + * BindingFailureConditions defines the conditions for binding failure. + * They may be set in the per-device status conditions. + * If any is set to "True", a binding failure occurred. + * + * The maximum number of binding failure conditions is 4. + * + * The conditions must be a valid condition type string. + * + * This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + * feature gates. + * + * +optional + * +listType=atomic + * +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:maxItems=4 + */ + bindingFailureConditions: string[]; + /** + * AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. + * + * If AllowMultipleAllocations is set to true, the device can be allocated more than once, + * and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not. + * + * +optional + * +featureGate=DRAConsumableCapacity + */ + allowMultipleAllocations?: boolean | undefined; + /** + * NodeAllocatableResources defines the mapping of node resources + * that are managed by the DRA driver exposing this device. This includes resources currently + * reported in v1.Node `status.allocatable` that are not extended resources + * (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + * Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + * In addition to standard requests made through the Pod `spec`, these resources + * can also be requested through claims and allocated by the DRA driver. + * For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory + * dependencies of an accelerator device. + * The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). + * Extended resource names are not permitted as keys. + * +optional + * +k8s:optional + * +featureGate=DRANodeAllocatableResources + */ + nodeAllocatableResources: { [key: string]: NodeAllocatableResource }; +} + +export interface Device_AttributesEntry { + key: string; + value: DeviceAttribute | undefined; +} + +export interface Device_CapacityEntry { + key: string; + value: DeviceCapacity | undefined; +} + +export interface Device_NodeAllocatableResourcesEntry { + key: string; + value: NodeAllocatableResource | undefined; +} + +/** DeviceAllocationConfiguration gets embedded in an AllocationResult. */ +export interface DeviceAllocationConfiguration { + /** + * Source records whether the configuration comes from a class and thus + * is not something that a normal user would have been able to set + * or from a claim. + * + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + source?: string | undefined; + /** + * Requests lists the names of requests where the configuration applies. + * If empty, its applies to all requests. + * + * References to subrequests must include the name of the main request + * and may include the subrequest using the format
[/]. If just + * the main request is given, the configuration applies to all subrequests. + * + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:listType=atomic + * +k8s:beta(since: "1.37")=+k8s:unique=set + * +k8s:beta(since: "1.37")=+k8s:maxItems=32 + */ + requests: string[]; + deviceConfiguration?: DeviceConfiguration | undefined; +} + +/** DeviceAllocationResult is the result of allocating devices. */ +export interface DeviceAllocationResult { + /** + * Results lists all allocated devices. + * + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:maxItems=32 + */ + results: DeviceRequestAllocationResult[]; + /** + * This field is a combination of all the claim and class configuration parameters. + * Drivers can distinguish between those based on a flag. + * + * This includes configuration parameters for drivers which have no allocated + * devices in the result because it is up to the drivers which configuration + * parameters they support. They can silently ignore unknown configuration + * parameters. + * + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:maxItems=64 + */ + config: DeviceAllocationConfiguration[]; +} + +/** DeviceAttribute must have exactly one field set. */ +export interface DeviceAttribute { + /** + * IntValue is a number. + * + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:unionMember + */ + int?: number | undefined; + /** + * BoolValue is a true/false value. + * + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:unionMember + */ + bool?: boolean | undefined; + /** + * StringValue is a string. Must not be longer than 64 characters. + * + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:unionMember + */ + string?: string | undefined; + /** + * VersionValue is a semantic version according to semver.org spec 2.0.0. + * Must not be longer than 64 characters. + * + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:unionMember + */ + version?: string | undefined; + /** + * IntValues is a non-empty list of numbers. + * + * This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + * + * +optional + * +listType=atomic + * +k8s:listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:unionMember + * +featureGate=DRAListTypeAttributes + */ + ints: number[]; + /** + * BoolValues is a non-empty list of true/false values. + * + * +optional + * +listType=atomic + * +k8s:listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:unionMember + * +featureGate=DRAListTypeAttributes + */ + bools: boolean[]; + /** + * StringValues is a non-empty list of strings. + * Each string must not be longer than 64 characters. + * + * This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + * + * +optional + * +listType=atomic + * +k8s:listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:unionMember + * +k8s:alpha(since: "1.37")=+k8s:eachVal=+k8s:maxBytes=64 + * +featureGate=DRAListTypeAttributes + */ + strings: string[]; + /** + * VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. + * Each version string must not be longer than 64 characters. + * + * This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + * + * +optional + * +listType=atomic + * +k8s:listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:unionMember + * +featureGate=DRAListTypeAttributes + */ + versions: string[]; +} + +/** DeviceCapacity describes a quantity associated with a device. */ +export interface DeviceCapacity { + /** + * Value defines how much of a certain capacity that device has. + * + * This field reflects the fixed total capacity and does not change. + * The consumed amount is tracked separately by scheduler + * and does not affect this value. + * + * +required + */ + value?: Quantity | undefined; + /** + * RequestPolicy defines how this DeviceCapacity must be consumed + * when the device is allowed to be shared by multiple allocations. + * + * The Device must have allowMultipleAllocations set to true in order to set a requestPolicy. + * + * If unset, capacity requests are unconstrained: + * requests can consume any amount of capacity, as long as the total consumed + * across all allocations does not exceed the device's defined capacity. + * If request is also unset, default is the full capacity value. + * + * +optional + * +featureGate=DRAConsumableCapacity + */ + requestPolicy?: CapacityRequestPolicy | undefined; +} + +/** DeviceClaim defines how to request devices with a ResourceClaim. */ +export interface DeviceClaim { + /** + * Requests represent individual requests for distinct devices which + * must all be satisfied. If empty, nothing needs to be allocated. + * + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:listType=atomic + * +k8s:beta(since: "1.37")=+k8s:unique=map + * +k8s:beta(since: "1.37")=+k8s:listMapKey=name + * +k8s:beta(since: "1.37")=+k8s:maxItems=32 + */ + requests: DeviceRequest[]; + /** + * These constraints must be satisfied by the set of devices that get + * allocated for the claim. + * + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:maxItems=32 + */ + constraints: DeviceConstraint[]; + /** + * This field holds configuration for multiple potential drivers which + * could satisfy requests in this claim. It is ignored while allocating + * the claim. + * + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:maxItems=32 + */ + config: DeviceClaimConfiguration[]; +} + +/** DeviceClaimConfiguration is used for configuration parameters in DeviceClaim. */ +export interface DeviceClaimConfiguration { + /** + * Requests lists the names of requests where the configuration applies. + * If empty, it applies to all requests. + * + * References to subrequests must include the name of the main request + * and may include the subrequest using the format
[/]. If just + * the main request is given, the configuration applies to all subrequests. + * + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:listType=atomic + * +k8s:beta(since: "1.37")=+k8s:unique=set + * +k8s:beta(since: "1.37")=+k8s:maxItems=32 + */ + requests: string[]; + deviceConfiguration?: DeviceConfiguration | undefined; +} + +/** + * DeviceClass is a vendor- or admin-provided resource that contains + * device configuration and selectors. It can be referenced in + * the device requests of a claim to apply these presets. + * Cluster scoped. + */ +export interface DeviceClass { + /** + * Standard object metadata + * +optional + * +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:subfield(name)=+k8s:format=k8s-long-name + */ + metadata?: ObjectMeta | undefined; + /** + * Spec defines what can be allocated and how to configure it. + * + * This is mutable. Consumers have to be prepared for classes changing + * at any time, either because they get updated or replaced. Claim + * allocations are done once based on whatever was set in classes at + * the time of allocation. + * + * Changing the spec automatically increments the metadata.generation number. + * +optional + */ + spec?: DeviceClassSpec | undefined; +} + +/** DeviceClassConfiguration is used in DeviceClass. */ +export interface DeviceClassConfiguration { + deviceConfiguration?: DeviceConfiguration | undefined; +} + +/** DeviceClassList is a collection of classes. */ +export interface DeviceClassList { + /** + * Standard list metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is the list of resource classes. */ + items: DeviceClass[]; +} + +/** + * DeviceClassSpec is used in a [DeviceClass] to define what can be allocated + * and how to configure it. + */ +export interface DeviceClassSpec { + /** + * Each selector must be satisfied by a device which is claimed via this class. + * + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:maxItems=32 + */ + selectors: DeviceSelector[]; + /** + * Config defines configuration parameters that apply to each device that is claimed via this class. + * Some classses may potentially be satisfied by multiple drivers, so each instance of a vendor + * configuration applies to exactly one driver. + * + * They are passed to the driver, but are not considered while allocating the claim. + * + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:maxItems=32 + */ + config: DeviceClassConfiguration[]; + /** + * ExtendedResourceName is the extended resource name for the devices of this class. + * The devices of this class can be used to satisfy a pod's extended resource requests. + * It has the same format as the name of a pod's extended resource. + * It should be unique among all the device classes in a cluster. + * If two device classes have the same name, then the class created later + * is picked to satisfy a pod's extended resource requests. + * If two classes are created at the same time, then the name of the class + * lexicographically sorted first is picked. + * + * +optional + * +featureGate=DRAExtendedResource + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:format=k8s-extended-resource-name + */ + extendedResourceName?: string | undefined; +} + +/** + * DeviceConfiguration must have exactly one field set. It gets embedded + * inline in some other structs which have other fields, so field names must + * not conflict with those. + */ +export interface DeviceConfiguration { + /** + * Opaque provides driver-specific configuration parameters. + * + * +optional + * +oneOf=ConfigurationType + * +k8s:beta(since: "1.37")=+k8s:optional + */ + opaque?: OpaqueDeviceConfiguration | undefined; +} + +/** DeviceConstraint must have exactly one field set besides Requests. */ +export interface DeviceConstraint { + /** + * Requests is a list of the one or more requests in this claim which + * must co-satisfy this constraint. If a request is fulfilled by + * multiple devices, then all of the devices must satisfy the + * constraint. If this is not specified, this constraint applies to all + * requests in this claim. + * + * References to subrequests must include the name of the main request + * and may include the subrequest using the format
[/]. If just + * the main request is given, the constraint applies to all subrequests. + * + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:listType=atomic + * +k8s:beta(since: "1.37")=+k8s:unique=set + * +k8s:beta(since: "1.37")=+k8s:maxItems=32 + */ + requests: string[]; + /** + * MatchAttribute requires that all devices in question have this + * attribute and that its type and value are the same across those + * devices. + * + * For example, if you specified "dra.example.com/numa" (a hypothetical example!), + * then only devices in the same NUMA node will be chosen. A device which + * does not have that attribute will not be chosen. All devices should + * use a value of the same type for this attribute because that is part of + * its specification, but if one device doesn't, then it also will not be + * chosen. + * + * When the DRAListTypeAttributes feature gate is enabled, comparison uses + * set semantics(i.e., element order and duplicates are ignored): list-valued attributes + * match when the intersection across all devices is non-empty. + * Scalar values are treated as single-element lists for backward compatibility. + * + * Must include the domain qualifier. + * + * +optional + * +oneOf=ConstraintType + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name + */ + matchAttribute?: string | undefined; + /** + * DistinctAttribute requires that all devices in question have this + * attribute and that its type and value are unique across those devices. + * + * When the DRAListTypeAttributes feature gate is enabled, comparison uses + * set semantics (i.e., element order and duplicates are ignored): + * list-valued attributes must be pairwise disjoint across devices. + * Scalar values are treated as singleton sets for backward compatibility. + * + * This acts as the inverse of MatchAttribute. + * + * This constraint is used to avoid allocating multiple requests to the same device + * by ensuring attribute-level differentiation. + * + * This is useful for scenarios where resource requests must be fulfilled by separate physical devices. + * For example, a container requests two network interfaces that must be allocated from two different physical NICs. + * + * +optional + * +oneOf=ConstraintType + * +featureGate=DRAConsumableCapacity + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-fully-qualified-name + */ + distinctAttribute?: string | undefined; +} + +/** + * DeviceCounterConsumption defines a set of counters that + * a device will consume from a CounterSet. + */ +export interface DeviceCounterConsumption { + /** + * CounterSet is the name of the set from which the + * counters defined will be consumed. + * + * +required + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:format=k8s-short-name + */ + counterSet?: string | undefined; + /** + * Counters defines the counters that will be consumed by the device. + * + * The maximum number of counters is 32. + * + * +required + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:eachKey=+k8s:format=k8s-short-name + */ + counters: { [key: string]: Counter }; + /** + * CompatibilityGroups is a list of opaque group names for + * this counter set consumption. + * + * Devices that consume counters from the same counter set may only be + * allocated at the same time ("co-allocated") if they all share at least + * one common group: the intersection of the CompatibilityGroups of all + * co-allocated devices on that counter set must be non-empty. Devices + * that consume from different counter sets are never compared via this + * field. + * + * An unset field, an explicit nil, and an empty list are equivalent and + * mean "no groups": such a device is only co-allocatable with sibling + * devices on the same counter set that also have no groups, and is never + * co-allocatable with a device that declares one or more groups. + * + * Group names are opaque and meaningful only within the + * publishing driver's pool. + * + * The maximum number of groups is 2, and the names must be unique. + * + * +optional + * +listType=atomic + * +featureGate=DRADeviceCompatibilityGroups + * +k8s:listType=atomic + * +k8s:optional + * +k8s:maxItems=2 + * +k8s:unique=set + * +k8s:eachVal=+k8s:format=k8s-short-name + */ + compatibilityGroups: string[]; +} + +export interface DeviceCounterConsumption_CountersEntry { + key: string; + value: Counter | undefined; +} + +/** DeviceDerivedAttribute defines a derived attribute computed via CEL. */ +export interface DeviceDerivedAttribute { + /** + * Name is the identifier for this derived attribute, used in constraints. + * + * It must be a DNS subdomain followed by a slash ("/") followed by a C identifier + * (e.g. "example.com/numaNode" or "derived/numaNode"). + * + * If the chosen name matches an existing physical attribute from a driver, + * the derived attribute's expression will shadow the physical attribute, + * and its evaluated value will be used in constraints instead. When the goal + * is to define a derived attribute that is only used within the ResourceClaim + * and not meant to shadow an existing attribute, use a domain prefix that + * no DRA driver should be using (e.g. "derived/myAttribute"). + * + * It is not valid to define a derived attribute that isn't used in at least + * one constraint. + * + * +required + * +k8s:required + * +k8s:format=k8s-resource-fully-qualified-name + */ + name?: string | undefined; + /** + * Expression is a CEL expression evaluated against each candidate device. + * The expression must evaluate to a primitive scalar (string, integer, + * boolean, or semver) or a list of these scalars ([]string, []int64, + * []bool, []semver) to act as a virtual grouping key. Any other return type + * is an error and causes CEL evaluation for the device to fail. + * + * The expression's input is an object named "device", which carries the + * same properties as in a CELDeviceSelector. + * + * When pod scheduling encounters CEL runtime errors (such as looking + * up an attribute that isn't defined) for some devices, it will abort + * allocation and fail scheduling for the Pod. Surfacing evaluation + * errors immediately prevents silent topology matching failures that are + * extremely hard to detect. A robust expression should, for example, check + * for the existence of attributes before referencing them to avoid + * runtime evaluation errors. + * + * The expression gets evaluated after a device has passed the other + * selector expressions for the request in which this expression is used. + * This allows writing expressions that are tailored towards the specific + * devices being requested (for example, by assuming the device is from a + * certain vendor and skipping those checks). + * + * The length of the expression must be smaller or equal to 10 Ki. The + * cost of evaluating it is also limited based on the estimated number + * of logical steps; the combined cost of all derived attributes in a + * claim is capped by a shared CEL cost budget. + * + * +required + * +k8s:required + */ + expression?: string | undefined; +} + +/** + * DeviceRequest is a request for devices required for a claim. + * This is typically a request for a single resource like a device, but can + * also ask for several identical devices. With FirstAvailable it is also + * possible to provide a prioritized list of requests. + */ +export interface DeviceRequest { + /** + * Name can be used to reference this request in a pod.spec.containers[].resources.claims + * entry and in a constraint of the claim. + * + * References using the name in the DeviceRequest will uniquely + * identify a request when the Exactly field is set. When the + * FirstAvailable field is set, a reference to the name of the + * DeviceRequest will match whatever subrequest is chosen by the + * scheduler. + * + * Must be a DNS label. + * + * +required + */ + name?: string | undefined; + /** + * Exactly specifies the details for a single request that must + * be met exactly for the request to be satisfied. + * + * One of Exactly or FirstAvailable must be set. + * + * +optional + * +oneOf=deviceRequestType + * +k8s:beta(since: "1.37")=+k8s:optional + */ + exactly?: ExactDeviceRequest | undefined; + /** + * FirstAvailable contains subrequests, of which exactly one will be + * selected by the scheduler. It tries to + * satisfy them in the order in which they are listed here. So if + * there are two entries in the list, the scheduler will only check + * the second one if it determines that the first one can not be used. + * + * DRA does not yet implement scoring, so the scheduler will + * select the first set of devices that satisfies all the + * requests in the claim. And if the requirements can + * be satisfied on more than one node, other scheduling features + * will determine which node is chosen. This means that the set of + * devices allocated to a claim might not be the optimal set + * available to the cluster. Scoring will be implemented later. + * + * +optional + * +oneOf=deviceRequestType + * +listType=atomic + * +featureGate=DRAPrioritizedList + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:listType=atomic + * +k8s:beta(since: "1.37")=+k8s:unique=map + * +k8s:beta(since: "1.37")=+k8s:listMapKey=name + * +k8s:beta(since: "1.37")=+k8s:maxItems=8 + */ + firstAvailable: DeviceSubRequest[]; +} + +/** DeviceRequestAllocationResult contains the allocation result for one request. */ +export interface DeviceRequestAllocationResult { + /** + * Request is the name of the request in the claim which caused this + * device to be allocated. If it references a subrequest in the + * firstAvailable list on a DeviceRequest, this field must + * include both the name of the main request and the subrequest + * using the format
/. + * + * Multiple devices may have been allocated per request. + * + * +required + */ + request?: string | undefined; + /** + * Driver specifies the name of the DRA driver whose kubelet + * plugin should be invoked to process the allocation once the claim is + * needed on a node. + * + * Must be a DNS subdomain and should end with a DNS domain owned by the + * vendor of the driver. It should use only lower case characters. + * + * +required + * +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name-caseless + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:maxLength=63 + */ + driver?: string | undefined; + /** + * This name together with the driver name and the device name field + * identify which device was allocated (`//`). + * + * Must not be longer than 253 characters and may contain one or more + * DNS sub-domains separated by slashes. + * + * +required + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:format=k8s-resource-pool-name + */ + pool?: string | undefined; + /** + * Device references one device instance via its name in the driver's + * resource pool. It must be a DNS label. + * + * +required + */ + device?: string | undefined; + /** + * AdminAccess indicates that this device was allocated for + * administrative access. See the corresponding request field + * for a definition of mode. + * + * Admin access is disabled if this field is unset or + * set to false, otherwise it is enabled. + * + * +optional + * +featureGate=DRAAdminAccess + */ + adminAccess?: boolean | undefined; + /** + * A copy of all tolerations specified in the request at the time + * when the device got allocated. + * + * The maximum number of tolerations is 16. + * + * This is a beta field and requires enabling the DRADeviceTaints + * feature gate. + * + * +optional + * +listType=atomic + * +featureGate=DRADeviceTaints + * +k8s:beta(since: "1.37")=+k8s:optional + */ + tolerations: DeviceToleration[]; + /** + * BindingConditions contains a copy of the BindingConditions + * from the corresponding ResourceSlice at the time of allocation. + * + * This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + * feature gates. + * + * +optional + * +listType=atomic + * +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:maxItems=4 + */ + bindingConditions: string[]; + /** + * BindingFailureConditions contains a copy of the BindingFailureConditions + * from the corresponding ResourceSlice at the time of allocation. + * + * This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + * feature gates. + * + * +optional + * +listType=atomic + * +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:maxItems=4 + */ + bindingFailureConditions: string[]; + /** + * ShareID uniquely identifies an individual allocation share of the device, + * used when the device supports multiple simultaneous allocations. + * It serves as an additional map key to differentiate concurrent shares + * of the same device. + * + * +optional + * +featureGate=DRAConsumableCapacity + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:format=k8s-uuid + */ + shareID?: string | undefined; + /** + * ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. + * The consumed amount may differ from the requested amount: it is rounded up to the nearest valid + * value based on the device’s requestPolicy if applicable (i.e., may not be less than the requested amount). + * + * The total consumed capacity for each device must not exceed the DeviceCapacity's Value. + * + * This field is populated only for devices that allow multiple allocations. + * All capacity entries are included, even if the consumed amount is zero. + * + * +optional + * +featureGate=DRAConsumableCapacity + */ + consumedCapacity: { [key: string]: Quantity }; + /** + * SkipNodeOperations lists node-local resource operations (gRPC calls) + * that will be skipped for this allocated device when determining whether + * operations are necessary on the node. If all allocated devices for a driver in + * a claim skip an operation, that gRPC call will be skipped. It is a copy of + * the ResourceSlice.spec.skipNodeOperations value at the time when the device was allocated. + * + * +optional + * +listType=set + * +k8s:listType=set + * +featureGate=DRAOptionalNodeOperations + * +k8s:optional + */ + skipNodeOperations: string[]; +} + +export interface DeviceRequestAllocationResult_ConsumedCapacityEntry { + key: string; + value: Quantity | undefined; +} + +/** DeviceSelector must have exactly one field set. */ +export interface DeviceSelector { + /** + * CEL contains a CEL expression for selecting a device. + * + * +optional + * +oneOf=SelectorType + */ + cel?: CELDeviceSelector | undefined; +} + +/** + * DeviceSubRequest describes a request for device provided in the + * claim.spec.devices.requests[].firstAvailable array. Each + * is typically a request for a single resource like a device, but can + * also ask for several identical devices. + * + * DeviceSubRequest is similar to ExactDeviceRequest, but doesn't expose the + * AdminAccess field as that one is only supported when requesting a + * specific device. + */ +export interface DeviceSubRequest { + /** + * Name can be used to reference this subrequest in the list of constraints + * or the list of configurations for the claim. References must use the + * format
/. + * + * Must be a DNS label. + * + * +required + */ + name?: string | undefined; + /** + * DeviceClassName references a specific DeviceClass, which can define + * additional configuration and selectors to be inherited by this + * subrequest. + * + * A class is required. Which classes are available depends on the cluster. + * + * Administrators may use this to restrict which devices may get + * requested by only installing classes with selectors for permitted + * devices. If users are free to request anything without restrictions, + * then administrators can create an empty DeviceClass for users + * to reference. + * + * +required + * +k8s:beta(since: "1.37")=+k8s:required + * +k8s:beta(since: "1.37")=+k8s:format=k8s-long-name + */ + deviceClassName?: string | undefined; + /** + * Selectors define criteria which must be satisfied by a specific + * device in order for that device to be considered for this + * subrequest. All selectors must be satisfied for a device to be + * considered. + * + * +optional + * +listType=atomic + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:maxItems=32 + */ + selectors: DeviceSelector[]; + /** + * AllocationMode and its related fields define how devices are allocated + * to satisfy this subrequest. Supported values are: + * + * - ExactCount: This request is for a specific number of devices. + * This is the default. The exact number is provided in the + * count field. + * + * - All: This subrequest is for all of the matching devices in a pool. + * Allocation will fail if some devices are already allocated, + * unless adminAccess is requested. + * + * If AllocationMode is not specified, the default mode is ExactCount. If + * the mode is ExactCount and count is not specified, the default count is + * one. Any other subrequests must specify this field. + * + * More modes may get added in the future. Clients must refuse to handle + * requests with unknown modes. + * + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + */ + allocationMode?: string | undefined; + /** + * Count is used only when the count mode is "ExactCount". Must be greater than zero. + * If AllocationMode is ExactCount and this field is not specified, the default is one. + * + * +optional + * +oneOf=AllocationMode + */ + count?: number | undefined; + /** + * If specified, the request's tolerations. + * + * Tolerations for NoSchedule are required to allocate a + * device which has a taint with that effect. The same applies + * to NoExecute. + * + * In addition, should any of the allocated devices get tainted + * with NoExecute after allocation and that effect is not tolerated, + * then all pods consuming the ResourceClaim get deleted to evict + * them. The scheduler will not let new pods reserve the claim while + * it has these tainted devices. Once all pods are evicted, the + * claim will get deallocated. + * + * The maximum number of tolerations is 16. + * + * This is a beta field and requires enabling the DRADeviceTaints + * feature gate. + * + * +optional + * +listType=atomic + * +featureGate=DRADeviceTaints + * +k8s:beta(since: "1.37")=+k8s:optional + */ + tolerations: DeviceToleration[]; + /** + * Capacity define resource requirements against each capacity. + * + * If this field is unset and the device supports multiple allocations, + * the default value will be applied to each capacity according to requestPolicy. + * For the capacity that has no requestPolicy, default is the full capacity value. + * + * Applies to each device allocation. + * If Count > 1, + * the request fails if there aren't enough devices that meet the requirements. + * If AllocationMode is set to All, + * the request fails if there are devices that otherwise match the request, + * and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request. + * + * +optional + * +featureGate=DRAConsumableCapacity + */ + capacity?: CapacityRequirements | undefined; + /** + * DerivedAttributes defines a set of virtual attributes computed via CEL expressions + * for each candidate device. These virtual attributes can be referenced in + * `.devices.constraints` to align and match different devices (e.g., co-allocating + * a GPU and a NIC on the same NUMA node) even if their drivers publish different + * attributes. Derived attributes are not available via `device.attributes` + * in the CEL environment when evaluating selector expressions. + * + * Derived attributes allow you to extract, transform, or normalize topology + * information (such as extracting a NUMA index from a complex topology string or + * renaming a vendor-specific attribute) into a common virtual attribute name at + * scheduling time. The scheduler then evaluates these virtual attributes exactly + * like static attributes when matching constraints. + * + * Every derived attribute defined in this list must be referenced by at least one + * MatchAttribute or DistinctAttribute constraint in the `.devices.constraints` list. + * + * The maximum number of derived attributes is 32. + * + * This is an alpha field and requires enabling the DRADerivedAttributes + * feature gate. + * + * +optional + * +listType=atomic + * +featureGate=DRADerivedAttributes + * +k8s:optional + * +k8s:maxItems=32 + */ + derivedAttributes: DeviceDerivedAttribute[]; +} + +/** + * The device this taint is attached to has the "effect" on + * any claim which does not tolerate the taint and, through the claim, + * to pods using the claim. + * + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface DeviceTaint { + /** + * The taint key to be applied to a device. + * Must be a label name. + * + * +required + */ + key?: string | undefined; + /** + * The taint value corresponding to the taint key. + * Must be a label value. + * + * +optional + */ + value?: string | undefined; + /** + * The effect of the taint on claims that do not tolerate the taint + * and through such claims on the pods using them. + * + * Valid effects are None, NoSchedule and NoExecute. PreferNoSchedule as used for + * nodes is not valid here. More effects may get added in the future. + * Consumers must treat unknown effects like None. + * + * +required + * +k8s:beta(since: "1.37")=+k8s:required + */ + effect?: string | undefined; + /** + * TimeAdded represents the time at which the taint was added or + * (only in a DeviceTaintRule) the effect was modified. + * Added automatically during create or update if not set. + * + * In addition, in a DeviceTaintRule a value provided during + * an update gets replaced with the current time if the provided + * value is the same as the old one and the new effect is different. + * Changing the key and/or value while keeping the effect unchanged + * is possible and does not update the time stamp because the eviction + * which uses it is either already started (NoExecute) or + * not started yet (NoEffect, NoSchedule). + * + * +optional + */ + timeAdded?: Time | undefined; +} + +/** + * DeviceTaintRule adds one taint to all devices which match the selector. + * This has the same effect as if the taint was specified directly + * in the ResourceSlice by the DRA driver. + * +k8s:supportsSubresource="/status" + */ +export interface DeviceTaintRule { + /** + * Standard object metadata + * +optional + */ + metadata?: ObjectMeta | undefined; + /** + * Spec specifies the selector and one taint. + * + * Changing the spec automatically increments the metadata.generation number. + * +required + */ + spec?: DeviceTaintRuleSpec | undefined; + /** + * Status provides information about what was requested in the spec. + * + * +optional + */ + status?: DeviceTaintRuleStatus | undefined; +} + +/** DeviceTaintRuleList is a collection of DeviceTaintRules. */ +export interface DeviceTaintRuleList { + /** + * Standard list metadata + * +optional + */ + metadata?: ListMeta | undefined; + /** Items is the list of DeviceTaintRules. */ + items: DeviceTaintRule[]; +} + +/** DeviceTaintRuleSpec specifies the selector and one taint. */ +export interface DeviceTaintRuleSpec { + /** + * DeviceSelector defines which device(s) the taint is applied to. + * All selector criteria must be satisfied for a device to + * match. The empty selector matches all devices. Without + * a selector, no devices are matches. + * + * +optional + */ + deviceSelector?: DeviceTaintSelector | undefined; + /** + * The taint that gets applied to matching devices. + * + * +required + */ + taint?: DeviceTaint | undefined; +} + +/** DeviceTaintRuleStatus provides information about an on-going pod eviction. */ +export interface DeviceTaintRuleStatus { + /** + * Conditions provide information about the state of the DeviceTaintRule + * and the cluster at some point in time, + * in a machine-readable and human-readable format. + * + * The following condition is currently defined as part of this API, more may + * get added: + * - Type: EvictionInProgress + * - Status: True if there are currently pods which need to be evicted, False otherwise + * (includes the effects which don't cause eviction). + * - Reason: not specified, may change + * - Message: includes information about number of pending pods and already evicted pods + * in a human-readable format, updated periodically, may change + * + * For `effect: None`, the condition above gets set once for each change to + * the spec, with the message containing information about what would happen + * if the effect was `NoExecute`. This feedback can be used to decide whether + * changing the effect to `NoExecute` will work as intended. It only gets + * set once to avoid having to constantly update the status. + * + * Must have 8 or fewer entries. + * + * +optional + * +listType=map + * +listMapKey=type + * +patchStrategy=merge + * +patchMergeKey=type + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:listType=map + * +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + */ + conditions: Condition[]; +} + +/** + * DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. + * The empty selector matches all devices. Without a selector, no devices + * are matched. + */ +export interface DeviceTaintSelector { + /** + * If driver is set, only devices from that driver are selected. + * This fields corresponds to slice.spec.driver. + * + * +optional + */ + driver?: string | undefined; + /** + * If pool is set, only devices in that pool are selected. + * + * Also setting the driver name may be useful to avoid + * ambiguity when different drivers use the same pool name, + * but this is not required because selecting pools from + * different drivers may also be useful, for example when + * drivers with node-local devices use the node name as + * their pool name. + * + * +optional + */ + pool?: string | undefined; + /** + * If device is set, only devices with that name are selected. + * This field corresponds to slice.spec.devices[].name. + * + * Setting also driver and pool may be required to avoid ambiguity, + * but is not required. + * + * +optional + */ + device?: string | undefined; +} + +/** + * The ResourceClaim this DeviceToleration is attached to tolerates any taint that matches + * the triple using the matching operator . + */ +export interface DeviceToleration { + /** + * Key is the taint key that the toleration applies to. Empty means match all taint keys. + * If the key is empty, operator must be Exists; this combination means to match all values and all keys. + * Must be a label name. + * + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + * +k8s:beta(since: "1.37")=+k8s:format=k8s-label-key + */ + key?: string | undefined; + /** + * Operator represents a key's relationship to the value. + * Valid operators are Exists and Equal. Defaults to Equal. + * Exists is equivalent to wildcard for value, so that a ResourceClaim can + * tolerate all taints of a particular category. + * + * +optional + * +default="Equal" + * +k8s:beta(since: "1.37")=+k8s:optional + */ + operator?: string | undefined; + /** + * Value is the taint value the toleration matches to. + * If the operator is Exists, the value must be empty, otherwise just a regular string. + * Must be a label value. + * + * +optional + */ + value?: string | undefined; + /** + * Effect indicates the taint effect to match. Empty means match all taint effects. + * When specified, allowed values are NoSchedule and NoExecute. + * + * +optional + * +k8s:beta(since: "1.37")=+k8s:optional + */ + effect?: string | undefined; + /** + * TolerationSeconds represents the period of time the toleration (which must be + * of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + * it is not set, which means tolerate the taint forever (do not evict). Zero and + * negative values will be treated as 0 (evict immediately) by the system. + * If larger than zero, the time when the pod needs to be evicted is calculated as