├── .changeset ├── README.md └── config.json ├── .eslintignore ├── .eslintrc ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── crd-package-request.md │ └── feature_request.md ├── actions │ ├── build-packages │ │ └── action.yml │ └── install-deps │ │ └── action.yml └── workflows │ ├── release.yml │ ├── snapshot-release.yml │ └── test.yml ├── .gitignore ├── .husky └── pre-commit ├── .npmrc ├── .prettierignore ├── .prettierrc ├── .vitest └── setup.ts ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── core ├── base │ ├── CHANGELOG.md │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ └── model.ts │ │ ├── index.ts │ │ ├── meta.ts │ │ └── model.ts │ └── tsconfig.json └── validate │ ├── CHANGELOG.md │ ├── package.json │ ├── src │ ├── __tests__ │ │ ├── formats.ts │ │ └── validate.ts │ ├── formats.ts │ ├── index.ts │ ├── runtime │ │ ├── equal.ts │ │ ├── parseJson.ts │ │ ├── quote.ts │ │ ├── re2.ts │ │ ├── timestamp.ts │ │ ├── ucs2length.ts │ │ ├── uri.ts │ │ └── validation_error.ts │ ├── utils.ts │ └── validate.ts │ ├── tsconfig.json │ └── types.d.ts ├── examples ├── basic.ts └── deno │ ├── crd.ts │ └── pod.ts ├── first-party ├── apimachinery │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── scripts │ │ └── generate.ts │ └── tsconfig.json └── kubernetes-models │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ ├── class.ts │ ├── esm.mjs │ ├── type-guard.ts │ └── validate.ts │ ├── package.json │ ├── scripts │ └── generate.ts │ └── tsconfig.json ├── internal └── publish-scripts │ ├── CHANGELOG.md │ ├── bin │ └── publish-scripts.js │ ├── package.json │ ├── src │ ├── build.ts │ ├── index.ts │ └── prepack.ts │ └── tsconfig.json ├── package.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── scripts ├── new-crd-package.ts └── publish.sh ├── third-party ├── argo-cd │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── argo-rollouts │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── argo-workflows │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── autoscaler │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ ├── class.ts │ │ └── validate.ts │ ├── package.json │ └── tsconfig.json ├── cert-manager │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ ├── class.ts │ │ ├── esm.mjs │ │ └── type-guard.ts │ ├── package.json │ └── tsconfig.json ├── cilium │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ ├── class.ts │ │ └── validate.ts │ ├── package.json │ └── tsconfig.json ├── cloudnative-pg │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── contour │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── elastic-cloud │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── envoy-gateway │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ ├── scripts │ │ └── download-crd.ts │ └── tsconfig.json ├── external-secrets │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── fission │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── flagger │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ ├── scripts │ │ └── download-crd.ts │ └── tsconfig.json ├── flux-cd │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── gateway-api │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── gke │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ ├── class.ts │ │ └── validate.ts │ ├── crd │ │ ├── backendconfigs.yaml │ │ ├── clusterimportconfigs.yaml │ │ ├── computeclasses.yaml │ │ ├── entitlements.yaml │ │ ├── frontendconfigs.yaml │ │ ├── managedcertificates.yaml │ │ ├── memberships.yaml │ │ ├── multidimpodautoscalers.yaml │ │ ├── networkloggings.yaml │ │ ├── podmonitors.yaml │ │ ├── redirectservices.yaml │ │ ├── serviceattachments.yaml │ │ ├── serviceexports.yaml │ │ ├── serviceimportconfigs.yaml │ │ ├── serviceimports.yaml │ │ ├── servicenetworkendpointgroups.yaml │ │ └── updateinfos.yaml │ ├── package.json │ ├── scripts │ │ └── dump-crd.ts │ └── tsconfig.json ├── grafana-agent-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── grafana-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── hierarchical-namespaces │ ├── CHANGELOG.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── istio │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── jaeger-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── k8ssandra-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── kapp-controller │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── karpenter │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── keda │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── knative │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── kubedb │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── kyverno │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── linkerd │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ ├── scripts │ │ └── download-crd.ts │ └── tsconfig.json ├── longhorn │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── nats │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── opentelemetry-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── pipelines-as-code │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── postgres-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ ├── class.ts │ │ └── validate.ts │ ├── package.json │ └── tsconfig.json ├── prometheus-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ ├── class.ts │ │ └── validate.ts │ ├── package.json │ └── tsconfig.json ├── rabbitmq-cluster-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── rabbitmq-messaging-topology-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── redis-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── sealed-secrets │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ ├── class.ts │ │ └── validate.ts │ ├── package.json │ └── tsconfig.json ├── seldon-core-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── shipwright │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ ├── v1alpha1.ts │ │ └── v1beta1.ts │ ├── package.json │ └── tsconfig.json ├── smi │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── spicedb │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── spiffe │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── thanos-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── tidb-operator │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── traefik │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ │ └── class.ts │ ├── package.json │ └── tsconfig.json └── victoria-metrics-operator │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── __tests__ │ └── class.ts │ ├── package.json │ └── tsconfig.json ├── tsc-multi.json ├── tsconfig.build.json ├── tsconfig.json ├── turbo.json ├── utils ├── crd-generate │ ├── CHANGELOG.md │ ├── bin │ │ └── crd-generate.js │ ├── package.json │ ├── src │ │ ├── cli.ts │ │ ├── generate.ts │ │ ├── generators │ │ │ ├── alias.ts │ │ │ ├── definition.ts │ │ │ └── schema.ts │ │ ├── index.ts │ │ └── utils.ts │ └── tsconfig.json ├── generate │ ├── CHANGELOG.md │ ├── package.json │ ├── src │ │ ├── import.ts │ │ ├── index.ts │ │ ├── interface.ts │ │ ├── nullable-ref.ts │ │ ├── pattern.ts │ │ ├── schema.ts │ │ ├── types.ts │ │ └── utils.ts │ └── tsconfig.json ├── openapi-generate │ ├── CHANGELOG.md │ ├── bin │ │ └── openapi-generate.js │ ├── package.json │ ├── src │ │ ├── cli.ts │ │ ├── context.ts │ │ ├── generate.ts │ │ ├── generators │ │ │ ├── alias.ts │ │ │ ├── definition.ts │ │ │ └── schema.ts │ │ ├── index.ts │ │ ├── string.ts │ │ └── utils.ts │ └── tsconfig.json ├── read-input │ ├── CHANGELOG.md │ ├── package.json │ ├── src │ │ ├── http.ts │ │ ├── index.ts │ │ └── read.ts │ └── tsconfig.json └── string-util │ ├── CHANGELOG.md │ ├── package.json │ ├── src │ ├── comment.ts │ ├── index.ts │ ├── string.ts │ └── unquote.ts │ └── tsconfig.json └── vitest.config.ts /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@1.6.0/schema.json", 3 | "changelog": [ 4 | "@changesets/changelog-github", 5 | { "repo": "tommy351/kubernetes-models-ts" } 6 | ], 7 | "commit": false, 8 | "linked": [], 9 | "access": "public", 10 | "baseBranch": "master", 11 | "updateInternalDependencies": "patch", 12 | "ignore": [] 13 | } 14 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | /coverage/ 3 | node_modules/ 4 | gen/ 5 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "plugins": ["@typescript-eslint", "vitest"], 5 | "extends": [ 6 | "eslint:recommended", 7 | "plugin:@typescript-eslint/eslint-recommended", 8 | "plugin:@typescript-eslint/recommended", 9 | "plugin:vitest/recommended", 10 | "plugin:node/recommended", 11 | "plugin:prettier/recommended" 12 | ], 13 | "rules": { 14 | "@typescript-eslint/no-explicit-any": "off", 15 | "@typescript-eslint/no-parameter-properties": "off", 16 | "@typescript-eslint/explicit-function-return-type": [ 17 | "warn", 18 | { "allowExpressions": true } 19 | ], 20 | "node/no-unsupported-features/es-syntax": [ 21 | "error", 22 | { 23 | "ignores": ["modules"] 24 | } 25 | ] 26 | }, 27 | "parserOptions": { 28 | "ecmaVersion": 2018 29 | }, 30 | "settings": { 31 | "node": { 32 | "tryExtensions": [".ts", ".js", ".cjs", ".mjs", ".json", ".node"] 33 | } 34 | }, 35 | "overrides": [ 36 | { 37 | "files": ["*.{js,cjs}"], 38 | "rules": { 39 | "@typescript-eslint/no-var-requires": "off", 40 | "@typescript-eslint/explicit-function-return-type": "off" 41 | } 42 | }, 43 | { 44 | "files": ["examples/**/*.ts"], 45 | "rules": { 46 | "node/no-missing-import": "off" 47 | } 48 | }, 49 | { 50 | "files": ["**/__tests__/**/*.{js,mjs,ts}"], 51 | "rules": { 52 | "@typescript-eslint/ban-ts-comment": "off", 53 | "node/no-unpublished-import": "off" 54 | } 55 | } 56 | ] 57 | } 58 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Additional context** 24 | Add any other context about the problem here. 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/crd-package-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: CRD package request 3 | about: Suggest a new CRD package 4 | title: '' 5 | labels: crd request 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Project info** 11 | Name and link of the project. 12 | 13 | **CRD YAML files** 14 | URL or content of YAML files. URLs should contain a version. (e.g. `https://github.com/jetstack/cert-manager/releases/download/v1.4.3/cert-manager.crds.yaml`) 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/actions/build-packages/action.yml: -------------------------------------------------------------------------------- 1 | name: Build packages 2 | 3 | runs: 4 | using: composite 5 | steps: 6 | - uses: rharkor/caching-for-turbo@v1.8 7 | - name: Build packages 8 | shell: bash 9 | run: pnpm run build 10 | -------------------------------------------------------------------------------- /.github/actions/install-deps/action.yml: -------------------------------------------------------------------------------- 1 | name: Install Node.js dependencies 2 | 3 | inputs: 4 | node-version: 5 | description: Node.js version 6 | required: true 7 | default: 20.x 8 | 9 | runs: 10 | using: composite 11 | steps: 12 | - uses: pnpm/action-setup@v4 13 | with: 14 | version: 7.33.0 15 | - uses: actions/setup-node@v4 16 | with: 17 | node-version: ${{ inputs.node-version }} 18 | cache: pnpm 19 | registry-url: https://registry.npmjs.org 20 | - name: Install dependencies 21 | shell: bash 22 | run: pnpm install 23 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | on: 3 | push: 4 | branches: 5 | - master 6 | 7 | jobs: 8 | release: 9 | runs-on: ubuntu-latest 10 | permissions: 11 | contents: write 12 | id-token: write 13 | pull-requests: write 14 | issues: read 15 | steps: 16 | - uses: actions/checkout@v4 17 | with: 18 | fetch-depth: 0 19 | - uses: ./.github/actions/install-deps 20 | - uses: ./.github/actions/build-packages 21 | - name: Create Release Pull Request or Publish to npm 22 | id: changesets 23 | uses: changesets/action@v1 24 | with: 25 | publish: ./scripts/publish.sh 26 | env: 27 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 28 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 29 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 30 | -------------------------------------------------------------------------------- /.github/workflows/snapshot-release.yml: -------------------------------------------------------------------------------- 1 | name: Snapshot Release 2 | on: 3 | push: 4 | branches: 5 | - snapshot 6 | - snapshots/** 7 | pull_request: 8 | 9 | jobs: 10 | release: 11 | runs-on: ubuntu-latest 12 | if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'snapshot') }} 13 | permissions: 14 | contents: read 15 | id-token: write 16 | steps: 17 | - uses: actions/checkout@v4 18 | with: 19 | fetch-depth: 0 20 | - uses: ./.github/actions/install-deps 21 | - uses: ./.github/actions/build-packages 22 | - name: Bump package version 23 | run: pnpm changeset version --snapshot 24 | env: 25 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 26 | - name: Publish snapshot packages 27 | run: pnpm publish -r --tag snapshot --no-git-checks 28 | env: 29 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 30 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 31 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | on: 3 | push: 4 | pull_request: 5 | 6 | jobs: 7 | lint: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v4 11 | - uses: ./.github/actions/install-deps 12 | - uses: ./.github/actions/build-packages 13 | - name: Lint files 14 | run: pnpm run lint 15 | test: 16 | runs-on: ubuntu-latest 17 | needs: 18 | - lint 19 | strategy: 20 | matrix: 21 | node-version: [14.x, 16.x, 18.x, 20.x] 22 | steps: 23 | - uses: actions/checkout@v3 24 | - uses: ./.github/actions/install-deps 25 | with: 26 | node-version: ${{ matrix.node-version }} 27 | - uses: ./.github/actions/build-packages 28 | - name: Run unit tests 29 | run: pnpm run test 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | /.idea/ 3 | *.tsbuildinfo 4 | dist/ 5 | gen/ 6 | *.log 7 | /.vscode/ 8 | 9 | # pnpm store dir on GitHub actions 10 | /.pnpm-store/ 11 | 12 | .turbo/ 13 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | save-workspace-protocol = rolling 2 | auto-install-peers = false 3 | provenance = true 4 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules/ 3 | gen/ 4 | pnpm-lock.yaml 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "useTabs": false, 4 | "trailingComma": "none" 5 | } 6 | -------------------------------------------------------------------------------- /.vitest/setup.ts: -------------------------------------------------------------------------------- 1 | import { expect } from "vitest"; 2 | import * as matchers from "jest-extended"; 3 | expect.extend(matchers); 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Tommy Chen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /core/base/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/base", 3 | "version": "5.0.1", 4 | "main": "dist/index.js", 5 | "module": "dist/index.mjs", 6 | "types": "dist/index.d.ts", 7 | "sideEffects": false, 8 | "exports": { 9 | "types": "./dist/index.d.ts", 10 | "import": "./dist/index.mjs", 11 | "require": "./dist/index.js" 12 | }, 13 | "scripts": { 14 | "build": "tsc-multi --config ../../tsc-multi.json" 15 | }, 16 | "description": "Base model for Kubernetes models.", 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 20 | }, 21 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/core/base", 22 | "author": "Tommy Chen ", 23 | "license": "MIT", 24 | "keywords": [ 25 | "kubernetes", 26 | "kubernetes-models" 27 | ], 28 | "publishConfig": { 29 | "access": "public" 30 | }, 31 | "files": [ 32 | "/dist/" 33 | ], 34 | "engines": { 35 | "node": ">=14" 36 | }, 37 | "dependencies": { 38 | "@kubernetes-models/validate": "workspace:^", 39 | "is-plain-object": "^5.0.0", 40 | "tslib": "^2.4.0" 41 | }, 42 | "devDependencies": { 43 | "tsc-multi": "^0.6.1", 44 | "typescript": "^4.8.4", 45 | "vitest": "^0.29.8" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /core/base/src/index.ts: -------------------------------------------------------------------------------- 1 | export { Model, ModelData, ModelConstructor, setValidateFunc } from "./model"; 2 | export { TypeMeta, TypeMetaGuard, createTypeMetaGuard } from "./meta"; 3 | -------------------------------------------------------------------------------- /core/base/src/meta.ts: -------------------------------------------------------------------------------- 1 | export interface TypeMeta { 2 | /** 3 | * APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources 4 | */ 5 | apiVersion: string; 6 | /** 7 | * Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 8 | */ 9 | kind: string; 10 | } 11 | 12 | function isNonNullObject(value: unknown): value is Record { 13 | return typeof value === "object" && value != null; 14 | } 15 | 16 | export type TypeMetaGuard = (value: unknown) => value is T; 17 | 18 | export function createTypeMetaGuard( 19 | meta: TypeMeta 20 | ): TypeMetaGuard { 21 | return (value): value is T => { 22 | return ( 23 | isNonNullObject(value) && 24 | value.apiVersion === meta.apiVersion && 25 | value.kind === meta.kind 26 | ); 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /core/base/src/model.ts: -------------------------------------------------------------------------------- 1 | import { isPlainObject } from "is-plain-object"; 2 | import { ValidateFunc, runValidateFunc } from "@kubernetes-models/validate"; 3 | import { TypeMeta } from "./meta"; 4 | 5 | function setDefinedProps(src: any, dst: any): any { 6 | for (const key of Object.keys(src)) { 7 | if (src[key] !== undefined) { 8 | // eslint-disable-next-line @typescript-eslint/no-use-before-define 9 | dst[key] = filterUndefinedValues(src[key]); 10 | } 11 | } 12 | 13 | return dst; 14 | } 15 | 16 | function filterUndefinedValues(data: unknown): unknown { 17 | if (Array.isArray(data)) { 18 | return data.map(filterUndefinedValues); 19 | } 20 | 21 | if (isPlainObject(data)) { 22 | return setDefinedProps(data, {}); 23 | } 24 | 25 | return data; 26 | } 27 | 28 | export type ModelData = T extends TypeMeta ? Omit : T; 29 | 30 | export type ModelConstructor = new (data?: ModelData) => Model; 31 | 32 | export class Model { 33 | public constructor(data?: ModelData) { 34 | if (data) { 35 | setDefinedProps(data, this); 36 | } 37 | } 38 | 39 | protected setDefinedProps(data?: ModelData): any { 40 | if (data) { 41 | setDefinedProps(data, this); 42 | } 43 | } 44 | 45 | public toJSON(): any { 46 | const result = {}; 47 | 48 | setDefinedProps(this, result); 49 | 50 | return result; 51 | } 52 | 53 | public validate(): void { 54 | // Use `setValidateFunc` to set the validate function 55 | } 56 | } 57 | 58 | export function setValidateFunc( 59 | ctor: ModelConstructor, 60 | fn: ValidateFunc 61 | ): void { 62 | ctor.prototype.validate = function () { 63 | runValidateFunc(fn, this); 64 | }; 65 | } 66 | -------------------------------------------------------------------------------- /core/base/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "stripInternal": true 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /core/validate/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/validate", 3 | "version": "4.0.0", 4 | "main": "dist/index.js", 5 | "module": "dist/index.mjs", 6 | "types": "dist/index.d.ts", 7 | "sideEffects": false, 8 | "exports": { 9 | ".": { 10 | "types": "./dist/index.d.ts", 11 | "import": "./dist/index.mjs", 12 | "require": "./dist/index.js" 13 | }, 14 | "./runtime/*": { 15 | "types": "./dist/runtime/*.d.ts", 16 | "import": "./dist/runtime/*.mjs", 17 | "require": "./dist/runtime/*.js" 18 | } 19 | }, 20 | "scripts": { 21 | "build": "tsc-multi --config ../../tsc-multi.json" 22 | }, 23 | "description": "Validation library for Kubernetes models.", 24 | "repository": { 25 | "type": "git", 26 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 27 | }, 28 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/core/validate", 29 | "author": "Tommy Chen ", 30 | "license": "MIT", 31 | "publishConfig": { 32 | "access": "public" 33 | }, 34 | "keywords": [ 35 | "kubernetes", 36 | "kubernetes-models", 37 | "validate" 38 | ], 39 | "files": [ 40 | "/dist/" 41 | ], 42 | "engines": { 43 | "node": ">=14" 44 | }, 45 | "dependencies": { 46 | "ajv": "^8.12.0", 47 | "ajv-formats": "^2.1.1", 48 | "ajv-formats-draft2019": "^1.6.1", 49 | "ajv-i18n": "^4.2.0", 50 | "is-cidr": "^4.0.0", 51 | "tslib": "^2.4.0" 52 | }, 53 | "devDependencies": { 54 | "tsc-multi": "^0.6.1", 55 | "typescript": "^4.8.4", 56 | "vitest": "^0.29.8" 57 | }, 58 | "optionalDependencies": { 59 | "re2-wasm": "^1.0.2" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /core/validate/src/__tests__/validate.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { describe, it, expect } from "vitest"; 3 | import Ajv from "ajv"; 4 | import { runValidateFunc } from "../validate"; 5 | 6 | const ajv = new Ajv({ 7 | strictTypes: false, 8 | allErrors: true, 9 | verbose: true 10 | }); 11 | 12 | describe("number", () => { 13 | const validate = ajv.compile({ type: "number" }); 14 | 15 | it("success", () => { 16 | expect(() => runValidateFunc(validate, 46)).not.toThrow(); 17 | }); 18 | 19 | it("failed", () => { 20 | expect(() => runValidateFunc(validate, false)).toThrowWithMessage( 21 | Ajv.ValidationError, 22 | "data must be number" 23 | ); 24 | }); 25 | }); 26 | 27 | describe("object", () => { 28 | const validate = ajv.compile({ 29 | type: "object", 30 | properties: { 31 | a: { type: "string" }, 32 | b: { type: "number" }, 33 | c: { type: "boolean" } 34 | } 35 | }); 36 | 37 | it("success", () => { 38 | expect(() => 39 | runValidateFunc(validate, { 40 | a: "abc", 41 | b: 3.14, 42 | c: true 43 | }) 44 | ).not.toThrow(); 45 | }); 46 | 47 | it("failed", () => { 48 | expect(() => 49 | runValidateFunc(validate, { 50 | a: true, 51 | b: 3.14, 52 | c: "abc" 53 | }) 54 | ).toThrowWithMessage( 55 | Ajv.ValidationError, 56 | "data/a must be string, data/c must be boolean" 57 | ); 58 | }); 59 | }); 60 | -------------------------------------------------------------------------------- /core/validate/src/index.ts: -------------------------------------------------------------------------------- 1 | export { formats } from "./formats"; 2 | export { type ValidateFunc, runValidateFunc } from "./validate"; 3 | -------------------------------------------------------------------------------- /core/validate/src/runtime/equal.ts: -------------------------------------------------------------------------------- 1 | import mod from "ajv/dist/runtime/equal.js"; 2 | import { exportDefault } from "../utils"; 3 | export default exportDefault(mod); 4 | -------------------------------------------------------------------------------- /core/validate/src/runtime/parseJson.ts: -------------------------------------------------------------------------------- 1 | export * from "ajv/dist/runtime/parseJson.js"; 2 | -------------------------------------------------------------------------------- /core/validate/src/runtime/quote.ts: -------------------------------------------------------------------------------- 1 | import mod from "ajv/dist/runtime/quote.js"; 2 | import { exportDefault } from "../utils"; 3 | export default exportDefault(mod); 4 | -------------------------------------------------------------------------------- /core/validate/src/runtime/re2.ts: -------------------------------------------------------------------------------- 1 | import { RE2 } from "re2-wasm"; 2 | export default RE2; 3 | -------------------------------------------------------------------------------- /core/validate/src/runtime/timestamp.ts: -------------------------------------------------------------------------------- 1 | import mod from "ajv/dist/runtime/timestamp.js"; 2 | import { exportDefault } from "../utils"; 3 | export default exportDefault(mod); 4 | -------------------------------------------------------------------------------- /core/validate/src/runtime/ucs2length.ts: -------------------------------------------------------------------------------- 1 | import mod from "ajv/dist/runtime/ucs2length.js"; 2 | import { exportDefault } from "../utils"; 3 | export default exportDefault(mod); 4 | -------------------------------------------------------------------------------- /core/validate/src/runtime/uri.ts: -------------------------------------------------------------------------------- 1 | import mod from "ajv/dist/runtime/uri.js"; 2 | import { exportDefault } from "../utils"; 3 | 4 | const uri: typeof mod = exportDefault(mod); 5 | 6 | export default uri; 7 | -------------------------------------------------------------------------------- /core/validate/src/runtime/validation_error.ts: -------------------------------------------------------------------------------- 1 | import mod from "ajv/dist/runtime/validation_error.js"; 2 | import { exportDefault } from "../utils"; 3 | export default exportDefault(mod); 4 | -------------------------------------------------------------------------------- /core/validate/src/utils.ts: -------------------------------------------------------------------------------- 1 | export function exportDefault(mod: T): T { 2 | return (mod as any).default ?? mod; 3 | } 4 | -------------------------------------------------------------------------------- /core/validate/src/validate.ts: -------------------------------------------------------------------------------- 1 | import type { ErrorObject } from "ajv"; 2 | import ValidationError from "./runtime/validation_error"; 3 | import localize from "ajv-i18n"; 4 | 5 | function generateErrorMessage(errors: ErrorObject[]): string { 6 | localize.en(errors); 7 | 8 | return errors 9 | .map((err) => `data${err.instancePath} ${err.message}`) 10 | .join(", "); 11 | } 12 | 13 | export interface ValidateFunc { 14 | (data: unknown): data is T; 15 | errors?: ErrorObject[] | null; 16 | } 17 | 18 | export function runValidateFunc( 19 | fn: ValidateFunc, 20 | data: unknown 21 | ): asserts data is T { 22 | if (!fn(data) && fn.errors) { 23 | const errors = fn.errors; 24 | 25 | const err = new ValidationError(errors); 26 | err.message = generateErrorMessage(errors); 27 | 28 | throw err; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /core/validate/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src", "types.d.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /core/validate/types.d.ts: -------------------------------------------------------------------------------- 1 | declare module "ajv-formats-draft2019" { 2 | import Ajv from "ajv"; 3 | 4 | export default function (ajv: Ajv): Ajv; 5 | } 6 | 7 | declare module "ajv-formats-draft2019/formats/index.js" { 8 | import { Format } from "ajv"; 9 | 10 | const formats: Record; 11 | 12 | export default formats; 13 | } 14 | -------------------------------------------------------------------------------- /examples/basic.ts: -------------------------------------------------------------------------------- 1 | import { Deployment } from "kubernetes-models/apps/v1"; 2 | import { Service } from "kubernetes-models/v1"; 3 | 4 | export const deployment = new Deployment({ 5 | metadata: { 6 | name: "demo" 7 | }, 8 | spec: { 9 | replicas: 3, 10 | selector: {}, 11 | template: { 12 | spec: { 13 | containers: [] 14 | } 15 | } 16 | } 17 | }); 18 | 19 | deployment.validate(); 20 | 21 | export const service = new Service({ 22 | metadata: { 23 | name: "demo" 24 | }, 25 | spec: { 26 | ports: [] 27 | } 28 | }); 29 | 30 | service.validate(); 31 | -------------------------------------------------------------------------------- /examples/deno/crd.ts: -------------------------------------------------------------------------------- 1 | import { Certificate } from "https://cdn.skypack.dev/@kubernetes-models/cert-manager/cert-manager.io/v1/Certificate?dts"; 2 | 3 | const cert = new Certificate({ 4 | metadata: { 5 | name: "foo" 6 | }, 7 | spec: { 8 | secretName: "foo-secret", 9 | dnsNames: ["foo.example.com"], 10 | issuerRef: { 11 | name: "letsencrypt-prod", 12 | kind: "Issuer" 13 | } 14 | } 15 | }); 16 | 17 | console.log(cert); 18 | cert.validate(); 19 | -------------------------------------------------------------------------------- /examples/deno/pod.ts: -------------------------------------------------------------------------------- 1 | import { Pod } from "https://cdn.skypack.dev/kubernetes-models/v1/Pod?dts"; 2 | 3 | const pod = new Pod({ 4 | metadata: { 5 | name: "demo" 6 | }, 7 | spec: { 8 | containers: [ 9 | { 10 | name: "nginx", 11 | image: "nginx:stable" 12 | } 13 | ] 14 | } 15 | }); 16 | 17 | console.log(pod); 18 | 19 | pod.validate(); 20 | -------------------------------------------------------------------------------- /first-party/apimachinery/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/apimachinery 2 | 3 | Types for Kubernetes API objects. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/apimachinery 11 | ``` 12 | 13 | ## License 14 | 15 | MIT 16 | -------------------------------------------------------------------------------- /first-party/apimachinery/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/apimachinery", 3 | "version": "2.0.2", 4 | "description": "Types for Kubernetes API objects", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/packages/apimachinery", 10 | "author": "Tommy Chen ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "ts-node scripts/generate.ts && publish-scripts build --include-hidden", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "apimachinery" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/base": "workspace:^", 35 | "@kubernetes-models/validate": "workspace:^", 36 | "@swc/helpers": "^0.5.8" 37 | }, 38 | "devDependencies": { 39 | "@kubernetes-models/openapi-generate": "workspace:^", 40 | "@kubernetes-models/publish-scripts": "workspace:^", 41 | "@kubernetes-models/read-input": "workspace:^", 42 | "@kubernetes-models/string-util": "workspace:^", 43 | "@types/lodash": "^4.14.186", 44 | "@types/node": "^18.7.23", 45 | "lodash": "^4.17.21", 46 | "openapi-types": "^12.0.2", 47 | "ts-node": "^10.9.1", 48 | "typescript": "^4.8.4" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /first-party/apimachinery/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /first-party/kubernetes-models/README.md: -------------------------------------------------------------------------------- 1 | # kubernetes-models 2 | 3 | [![](https://img.shields.io/npm/v/kubernetes-models.svg)](https://www.npmjs.com/package/kubernetes-models) [![](https://img.shields.io/badge/kubernetes-1.27.1-green.svg)](https://github.com/kubernetes/kubernetes/tree/v1.27.1) 4 | 5 | Kubernetes models in TypeScript. 6 | 7 | ## Installation 8 | 9 | Install with npm. 10 | 11 | ```sh 12 | npm install kubernetes-models 13 | ``` 14 | 15 | ## Usage 16 | 17 | ```js 18 | import { Pod } from "kubernetes-models/v1"; 19 | 20 | // Create a new instance 21 | const pod = new Pod({ 22 | metadata: { 23 | name: "foo" 24 | }, 25 | spec: { 26 | containers: [] 27 | } 28 | }); 29 | 30 | // Validate against JSON schema 31 | pod.validate(); 32 | ``` 33 | 34 | ## License 35 | 36 | MIT 37 | -------------------------------------------------------------------------------- /first-party/kubernetes-models/__tests__/esm.mjs: -------------------------------------------------------------------------------- 1 | import { describe, it, expect } from "vitest"; 2 | import { Pod } from "../dist/v1/Pod.mjs"; 3 | 4 | describe("Pod", () => { 5 | const pod = new Pod({ 6 | metadata: { 7 | name: "foo" 8 | }, 9 | spec: { 10 | containers: [ 11 | { 12 | name: "nginx", 13 | image: "nginx:stable" 14 | } 15 | ] 16 | } 17 | }); 18 | 19 | it("toJSON", () => { 20 | expect(pod.toJSON()).toEqual({ 21 | apiVersion: "v1", 22 | kind: "Pod", 23 | metadata: { 24 | name: "foo" 25 | }, 26 | spec: { 27 | containers: [ 28 | { 29 | name: "nginx", 30 | image: "nginx:stable" 31 | } 32 | ] 33 | } 34 | }); 35 | }); 36 | 37 | it("validate", () => { 38 | expect(() => pod.validate()).not.toThrow(); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /first-party/kubernetes-models/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kubernetes-models", 3 | "version": "4.4.2", 4 | "description": "Kubernetes models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/first-party/kubernetes-models", 10 | "author": "Tommy Chen ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "ts-node scripts/generate.ts && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models" 28 | ], 29 | "engines": { 30 | "node": ">=14" 31 | }, 32 | "dependencies": { 33 | "@kubernetes-models/apimachinery": "workspace:^", 34 | "@kubernetes-models/base": "workspace:^", 35 | "@kubernetes-models/validate": "workspace:^", 36 | "@swc/helpers": "^0.5.8" 37 | }, 38 | "devDependencies": { 39 | "@kubernetes-models/openapi-generate": "workspace:^", 40 | "@kubernetes-models/publish-scripts": "workspace:^", 41 | "@kubernetes-models/read-input": "workspace:^", 42 | "@types/node": "^18.7.23", 43 | "openapi-types": "^12.0.2", 44 | "ts-node": "^10.9.1", 45 | "typescript": "^4.8.4", 46 | "vitest": "^0.29.8" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /first-party/kubernetes-models/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /internal/publish-scripts/bin/publish-scripts.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require("../dist"); 4 | -------------------------------------------------------------------------------- /internal/publish-scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/publish-scripts", 3 | "version": "1.2.0", 4 | "private": true, 5 | "bin": { 6 | "publish-scripts": "./bin/publish-scripts.js" 7 | }, 8 | "scripts": { 9 | "build": "tsc" 10 | }, 11 | "engines": { 12 | "node": ">=14" 13 | }, 14 | "dependencies": { 15 | "@swc/core": "^1.4.11", 16 | "execa": "^5.1.1", 17 | "fast-glob": "^3.2.12", 18 | "fs-extra": "^10.1.0", 19 | "tslib": "^2.4.0", 20 | "typescript": "^4.8.4", 21 | "yargs": "^17.6.0" 22 | }, 23 | "devDependencies": { 24 | "@types/fs-extra": "^9.0.13", 25 | "@types/yargs": "^17.0.13" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /internal/publish-scripts/src/index.ts: -------------------------------------------------------------------------------- 1 | import yargs from "yargs/yargs"; 2 | import { build, BuildArguments } from "./build"; 3 | import { prePack, PrePackArguments } from "./prepack"; 4 | 5 | yargs(process.argv.slice(2)) 6 | .command( 7 | "build", 8 | "Run build script", 9 | (cmd) => { 10 | return cmd 11 | .option("cwd", { 12 | type: "string", 13 | default: process.cwd(), 14 | defaultDescription: "CWD", 15 | description: "Current working directory." 16 | }) 17 | .option("include-hidden", { 18 | type: "boolean", 19 | description: "Include hidden files in the export map." 20 | }); 21 | }, 22 | build 23 | ) 24 | .command( 25 | "prepack", 26 | "Run prepack script", 27 | (cmd) => { 28 | return cmd.option("cwd", { 29 | type: "string", 30 | default: process.cwd(), 31 | defaultDescription: "CWD", 32 | description: "Current working directory." 33 | }); 34 | }, 35 | prePack 36 | ) 37 | .demandCommand() 38 | .showHelpOnFail(false).argv; 39 | -------------------------------------------------------------------------------- /internal/publish-scripts/src/prepack.ts: -------------------------------------------------------------------------------- 1 | import { readJSON, writeJSON } from "fs-extra"; 2 | import { join } from "path"; 3 | 4 | export interface PrePackArguments { 5 | cwd: string; 6 | } 7 | 8 | export async function prePack(args: PrePackArguments): Promise { 9 | const rootPkgJsonPath = join(args.cwd, "package.json"); 10 | const distPkgJsonPath = join(args.cwd, "dist/package.json"); 11 | const rootPkgJson = await readJSON(rootPkgJsonPath); 12 | const distPkgJson = await readJSON(distPkgJsonPath); 13 | 14 | await writeJSON( 15 | distPkgJsonPath, 16 | { 17 | ...distPkgJson, 18 | version: rootPkgJson.version, 19 | dependencies: rootPkgJson.dependencies, 20 | devDependencies: rootPkgJson.devDependencies, 21 | peerDependencies: rootPkgJson.peerDependencies 22 | }, 23 | { spaces: 2 } 24 | ); 25 | console.log("Updated package.json dependencies"); 26 | } 27 | -------------------------------------------------------------------------------- /internal/publish-scripts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src"] 7 | } 8 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - internal/* 3 | - core/* 4 | - utils/* 5 | - first-party/* 6 | - third-party/* 7 | -------------------------------------------------------------------------------- /scripts/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | pnpm run clean 6 | pnpm run build 7 | pnpm publish -r 8 | -------------------------------------------------------------------------------- /third-party/argo-cd/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/argo-cd 2 | 3 | [Argo CD](https://argo-cd.readthedocs.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/argo-cd 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Application } from "@kubernetes-models/argo-cd/argoproj.io/v1alpha1/Application"; 17 | 18 | // Create a new Application 19 | const app = new Application({ 20 | metadata: { 21 | name: "guestbook" 22 | }, 23 | spec: { 24 | project: "default", 25 | source: { 26 | repoURL: "https://github.com/argoproj/argocd-example-apps.git", 27 | targetRevision: "HEAD", 28 | path: "guestbook" 29 | }, 30 | destination: { 31 | server: "https://kubernetes.default.svc", 32 | namespace: "guestbook" 33 | } 34 | } 35 | }); 36 | 37 | // Validate against JSON schema 38 | app.validate(); 39 | ``` 40 | 41 | ## License 42 | 43 | MIT 44 | -------------------------------------------------------------------------------- /third-party/argo-cd/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/argo-rollouts/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/argo-rollouts 2 | 3 | [Argo Rollouts](https://argoproj.github.io/argo-rollouts/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/argo-rollouts 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Rollout } from "@kubernetes-models/argo-rollouts/argoproj.io/v1alpha1/Rollout"; 17 | 18 | // Create a new Rollout 19 | const rollout = new Rollout({ 20 | metadata: { 21 | name: "rollouts-demo" 22 | }, 23 | spec: { 24 | replicas: 5, 25 | strategy: { 26 | canary: { 27 | steps: [ 28 | { setWeight: 20 }, 29 | { pause: {} }, 30 | { setWeight: 40 }, 31 | { pause: { duration: 10 } } 32 | ] 33 | } 34 | }, 35 | revisionHistoryLimit: 2, 36 | selector: { 37 | matchLabels: { 38 | app: "rollouts-demo" 39 | } 40 | }, 41 | template: { 42 | metadata: { 43 | labels: { 44 | app: "rollouts-demo" 45 | } 46 | }, 47 | spec: { 48 | containers: [ 49 | { 50 | name: "rollouts-demo", 51 | image: "argoproj/rollouts-demo:blue" 52 | } 53 | ] 54 | } 55 | } 56 | } 57 | }); 58 | 59 | // Validate against JSON schema 60 | rollout.validate(); 61 | ``` 62 | 63 | ## License 64 | 65 | MIT 66 | -------------------------------------------------------------------------------- /third-party/argo-rollouts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/argo-rollouts", 3 | "version": "0.4.2", 4 | "description": "Argo Rollouts models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/argo-rollouts", 10 | "author": "Tommy Chen ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "argo-rollouts" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://github.com/argoproj/argo-rollouts/releases/download/v1.5.0/install.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third-party/argo-rollouts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/argo-workflows/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/argo-workflows 2 | 3 | ## 0.1.2 4 | 5 | ### Patch Changes 6 | 7 | - [#220](https://github.com/tommy351/kubernetes-models-ts/pull/220) [`de414dd`](https://github.com/tommy351/kubernetes-models-ts/commit/de414ddbb16d37da1e88c2aacb5ce4f57cec2d02) Thanks [@RealityAnomaly](https://github.com/RealityAnomaly)! - Set model-defined props outside constructor to ensure `useDefineForClassFields` compatibility. 8 | 9 | - Updated dependencies [[`de414dd`](https://github.com/tommy351/kubernetes-models-ts/commit/de414ddbb16d37da1e88c2aacb5ce4f57cec2d02)]: 10 | - @kubernetes-models/base@5.0.1 11 | - @kubernetes-models/apimachinery@2.0.2 12 | 13 | ## 0.1.1 14 | 15 | ### Patch Changes 16 | 17 | - [#216](https://github.com/tommy351/kubernetes-models-ts/pull/216) [`db67b32`](https://github.com/tommy351/kubernetes-models-ts/commit/db67b3253d21d4247a50109ef9f18c2345d7ce7f) Thanks [@RealityAnomaly](https://github.com/RealityAnomaly)! - Append `/index` to generated paths to ensure correct import handling. 18 | 19 | - Updated dependencies [[`db67b32`](https://github.com/tommy351/kubernetes-models-ts/commit/db67b3253d21d4247a50109ef9f18c2345d7ce7f)]: 20 | - @kubernetes-models/apimachinery@2.0.1 21 | 22 | ## 0.1.0 23 | 24 | ### Minor Changes 25 | 26 | - [#202](https://github.com/tommy351/kubernetes-models-ts/pull/202) [`099371e`](https://github.com/tommy351/kubernetes-models-ts/commit/099371ea29eaf6e9a5379975bcf74145ebd07321) Thanks [@omerlh](https://github.com/omerlh)! - initial package code 27 | -------------------------------------------------------------------------------- /third-party/argo-workflows/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/argo-workflows 2 | 3 | [Argo Workflows](https://argoproj.github.io/argo-workflows/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/argo-workflows 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Rollout } from "@kubernetes-models/argo-workflows/argoproj.io/v1alpha1/Workflow"; 17 | 18 | // Create a new Rollout 19 | const workflow = new Workflow({ 20 | metadata: { 21 | name: "workflows-demo" 22 | }, 23 | spec: { 24 | entrypoint: "hello", 25 | templates: [ 26 | { 27 | name: "hello", 28 | container: { 29 | image: "alpine:latest", 30 | command: ["echo", "Hello, Argo!"] 31 | } 32 | } 33 | ] 34 | } 35 | }); 36 | 37 | // Validate against JSON schema 38 | workflow.validate(); 39 | ``` 40 | 41 | ## License 42 | 43 | MIT 44 | -------------------------------------------------------------------------------- /third-party/argo-workflows/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { Workflow } from "../gen/argoproj.io/v1alpha1/Workflow"; 3 | 4 | describe("Workflow", () => { 5 | let workflow: Workflow; 6 | 7 | beforeEach(() => { 8 | workflow = new Workflow({ 9 | metadata: { 10 | name: "workflows-demo" 11 | }, 12 | spec: { 13 | entrypoint: "hello", 14 | templates: [ 15 | { 16 | name: "hello", 17 | container: { 18 | image: "alpine:latest", 19 | command: ["echo", "Hello, Argo!"] 20 | } 21 | } 22 | ] 23 | } 24 | }); 25 | }); 26 | 27 | it("should set apiVersion", () => { 28 | expect(workflow).toHaveProperty("apiVersion", "argoproj.io/v1alpha1"); 29 | }); 30 | 31 | it("should set kind", () => { 32 | expect(workflow).toHaveProperty("kind", "Workflow"); 33 | }); 34 | 35 | it("validate", () => { 36 | expect(() => workflow.validate()).not.toThrow(); 37 | }); 38 | 39 | it("toJSON", () => { 40 | expect(workflow.toJSON()).toEqual({ 41 | apiVersion: "argoproj.io/v1alpha1", 42 | kind: "Workflow", 43 | metadata: { 44 | name: "workflows-demo" 45 | }, 46 | spec: { 47 | entrypoint: "hello", 48 | templates: [ 49 | { 50 | name: "hello", 51 | container: { 52 | image: "alpine:latest", 53 | command: ["echo", "Hello, Argo!"] 54 | } 55 | } 56 | ] 57 | } 58 | }); 59 | }); 60 | }); 61 | -------------------------------------------------------------------------------- /third-party/argo-workflows/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/argo-workflows", 3 | "version": "0.1.2", 4 | "description": "Argo Workflows models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/argo-workflows", 10 | "author": "Tommy Chen ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "argo-workflows" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://github.com/argoproj/argo-workflows/releases/download/v3.5.7/install.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third-party/argo-workflows/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/autoscaler/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/autoscaler 2 | 3 | [Kubernetes Autoscaler](https://github.com/kubernetes/autoscaler) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/autoscaler 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { VerticalPodAutoscaler } from "@kubernetes-models/autoscaler/autoscaling.k8s.io/v1/VerticalPodAutoscaler"; 17 | 18 | const vpa = new VerticalPodAutoscaler({ 19 | spec: { 20 | targetRef: { 21 | apiVersion: 'apps/v1', 22 | kind: 'Deployment', 23 | name: 'my-app' 24 | }, 25 | updatePolicy: { 26 | updateMode: 'Off' 27 | } 28 | } 29 | }); 30 | 31 | // Validate against JSON schema 32 | vpa.validate(); 33 | ``` 34 | 35 | ## License 36 | 37 | MIT 38 | -------------------------------------------------------------------------------- /third-party/autoscaler/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { VerticalPodAutoscaler } from "../gen/autoscaling.k8s.io/v1/VerticalPodAutoscaler"; 3 | 4 | describe("VerticalPodAutoscaler", () => { 5 | let vpa: VerticalPodAutoscaler; 6 | 7 | beforeEach(() => { 8 | vpa = new VerticalPodAutoscaler({ 9 | metadata: { 10 | name: "test" 11 | }, 12 | spec: { 13 | targetRef: { 14 | apiVersion: "apps/v1", 15 | kind: "Deployment", 16 | name: "my-app" 17 | } 18 | } 19 | }); 20 | }); 21 | 22 | it("should set apiVersion", () => { 23 | expect(vpa).toHaveProperty("apiVersion", "autoscaling.k8s.io/v1"); 24 | }); 25 | 26 | it("should set kind", () => { 27 | expect(vpa).toHaveProperty("kind", "VerticalPodAutoscaler"); 28 | }); 29 | 30 | it("should set metadata", () => { 31 | expect(vpa.metadata).toEqual({ name: "test" }); 32 | }); 33 | 34 | it("should set sepc", () => { 35 | expect(vpa).toHaveProperty("spec"); 36 | }); 37 | 38 | it("toJSON", () => { 39 | expect(vpa.toJSON()).toEqual({ 40 | apiVersion: "autoscaling.k8s.io/v1", 41 | kind: "VerticalPodAutoscaler", 42 | metadata: { 43 | name: "test" 44 | }, 45 | spec: { 46 | targetRef: { 47 | apiVersion: "apps/v1", 48 | kind: "Deployment", 49 | name: "my-app" 50 | } 51 | } 52 | }); 53 | }); 54 | }); 55 | -------------------------------------------------------------------------------- /third-party/autoscaler/__tests__/validate.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect } from "vitest"; 2 | import { VerticalPodAutoscaler } from "../gen/autoscaling.k8s.io/v1/VerticalPodAutoscaler"; 3 | 4 | describe("validate", () => { 5 | describe("when validation passed", () => { 6 | it("should pass", () => { 7 | const config = new VerticalPodAutoscaler({ 8 | spec: { 9 | targetRef: { 10 | apiVersion: "apps/v1", 11 | kind: "Deployment", 12 | name: "my-app" 13 | }, 14 | updatePolicy: { 15 | updateMode: "Off" 16 | } 17 | } 18 | }); 19 | 20 | expect(() => config.validate()).not.toThrow(); 21 | }); 22 | }); 23 | 24 | describe("when validation failed", () => { 25 | it("should throw an error", () => { 26 | const config = new VerticalPodAutoscaler({ 27 | spec: { 28 | targetRef: { 29 | apiVersion: "apps/v1", 30 | kind: "Deployment", 31 | name: "my-app" 32 | }, 33 | resourcePolicy: { 34 | containerPolicies: [ 35 | { 36 | // @ts-expect-error 37 | mode: "foo" 38 | } 39 | ] 40 | } 41 | } 42 | }); 43 | 44 | expect(() => config.validate()).toThrow( 45 | "data/spec/resourcePolicy/containerPolicies/0/mode must be equal to one of the allowed values" 46 | ); 47 | }); 48 | }); 49 | }); 50 | -------------------------------------------------------------------------------- /third-party/autoscaler/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/cert-manager/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/cert-manager 2 | 3 | [cert-manager](https://cert-manager.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/cert-manager 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Certificate } from "@kubernetes-models/cert-manager/cert-manager.io/v1/Certificate"; 17 | 18 | // Create a new certificate 19 | const cert = new Certificate({ 20 | metadata: { 21 | name: "foo" 22 | }, 23 | spec: { 24 | secretName: "foo-secret", 25 | dnsNames: ["foo.example.com"], 26 | issuerRef: { 27 | name: "letsencrypt-prod", 28 | kind: "Issuer" 29 | } 30 | } 31 | }); 32 | 33 | // Validate against JSON schema 34 | cert.validate(); 35 | ``` 36 | 37 | ## License 38 | 39 | MIT 40 | -------------------------------------------------------------------------------- /third-party/cert-manager/__tests__/esm.mjs: -------------------------------------------------------------------------------- 1 | import { describe, it, expect } from "vitest"; 2 | import { Certificate } from "../dist/cert-manager.io/v1/Certificate.mjs"; 3 | 4 | describe("Certificate", () => { 5 | const cert = new Certificate({ 6 | metadata: { 7 | name: "foo" 8 | }, 9 | spec: { 10 | secretName: "foo-secret", 11 | dnsNames: ["foo.example.com"], 12 | issuerRef: { 13 | name: "letsencrypt-prod", 14 | kind: "Issuer" 15 | } 16 | } 17 | }); 18 | 19 | it("toJSON", () => { 20 | expect(cert.toJSON()).toEqual({ 21 | apiVersion: "cert-manager.io/v1", 22 | kind: "Certificate", 23 | metadata: { 24 | name: "foo" 25 | }, 26 | spec: { 27 | secretName: "foo-secret", 28 | dnsNames: ["foo.example.com"], 29 | issuerRef: { 30 | name: "letsencrypt-prod", 31 | kind: "Issuer" 32 | } 33 | } 34 | }); 35 | }); 36 | 37 | it("validate", () => { 38 | expect(() => cert.validate()).not.toThrow(); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /third-party/cert-manager/__tests__/type-guard.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect } from "vitest"; 2 | import { Certificate } from "../gen/cert-manager.io/v1/Certificate"; 3 | 4 | describe.each([ 5 | // Interface with TypeMeta only 6 | [{ apiVersion: "cert-manager.io/v1", kind: "Certificate" }, true], 7 | // Interface with incorrect apiVersion 8 | [{ apiVersion: "cert-manager.io/v2", kind: "Certificate" }, false], 9 | // Interface with incorrect kind 10 | [{ apiVersion: "cert-manager.io/v1", kind: "CertificateRequest" }, false], 11 | // Interface with valid data 12 | [ 13 | { 14 | apiVersion: "cert-manager.io/v1", 15 | kind: "Certificate", 16 | metadata: { name: "test" } 17 | }, 18 | true 19 | ], 20 | // Interface with invalid data (it doesn't matter anyway) 21 | [{ apiVersion: "cert-manager.io/v1", kind: "Certificate", foo: "bar" }, true], 22 | // null 23 | [null, false], 24 | // undefined 25 | [undefined, false], 26 | // Empty object 27 | [{}, false], 28 | // Boolean 29 | [true, false], 30 | // Number 31 | [3.14, false], 32 | // Array 33 | [[], false], 34 | // String 35 | ["foo", false], 36 | // Class without any data 37 | [new Certificate(), true], 38 | // Class with valid data 39 | [ 40 | new Certificate({ 41 | metadata: { name: "test" }, 42 | spec: { 43 | issuerRef: { 44 | name: "" 45 | }, 46 | secretName: "" 47 | } 48 | }), 49 | true 50 | ] 51 | ])("Certificate.is(%p)", (value, expected) => { 52 | it(`should return ${expected}`, () => { 53 | expect(Certificate.is(value)).toEqual(expected); 54 | }); 55 | }); 56 | -------------------------------------------------------------------------------- /third-party/cert-manager/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/cilium/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/cilium 2 | 3 | [Cilium](https://cilium.io/) CRD. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/cilium 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { CiliumLocalRedirectPolicy } from "@kubernetes-models/cilium/cilium.io/v2/CiliumLocalRedirectPolicy"; 17 | 18 | const lrp = new CiliumLocalRedirectPolicy({ 19 | metadata: { 20 | name: "lrp" 21 | }, 22 | spec: { 23 | redirectFrontend: { 24 | serviceMatcher: { 25 | serviceName: "my-service", 26 | namespace: "default" 27 | } 28 | }, 29 | redirectBackend: { 30 | localEndpointSelector: { 31 | matchLabels: { 32 | name: "proxy" 33 | } 34 | }, 35 | toPorts: [ 36 | { 37 | port: "8080", 38 | protocol: "TCP" 39 | } 40 | ] 41 | } 42 | } 43 | }); 44 | 45 | // Validate against JSON schema 46 | lrp.validate(); 47 | ``` 48 | 49 | ## License 50 | 51 | MIT 52 | -------------------------------------------------------------------------------- /third-party/cilium/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/cloudnative-pg/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/cloudnative-pg 2 | 3 | ## 0.1.2 4 | 5 | ### Patch Changes 6 | 7 | - [#220](https://github.com/tommy351/kubernetes-models-ts/pull/220) [`de414dd`](https://github.com/tommy351/kubernetes-models-ts/commit/de414ddbb16d37da1e88c2aacb5ce4f57cec2d02) Thanks [@RealityAnomaly](https://github.com/RealityAnomaly)! - Set model-defined props outside constructor to ensure `useDefineForClassFields` compatibility. 8 | 9 | - Updated dependencies [[`de414dd`](https://github.com/tommy351/kubernetes-models-ts/commit/de414ddbb16d37da1e88c2aacb5ce4f57cec2d02)]: 10 | - @kubernetes-models/base@5.0.1 11 | - @kubernetes-models/apimachinery@2.0.2 12 | 13 | ## 0.1.1 14 | 15 | ### Patch Changes 16 | 17 | - [#216](https://github.com/tommy351/kubernetes-models-ts/pull/216) [`db67b32`](https://github.com/tommy351/kubernetes-models-ts/commit/db67b3253d21d4247a50109ef9f18c2345d7ce7f) Thanks [@RealityAnomaly](https://github.com/RealityAnomaly)! - Append `/index` to generated paths to ensure correct import handling. 18 | 19 | - Updated dependencies [[`db67b32`](https://github.com/tommy351/kubernetes-models-ts/commit/db67b3253d21d4247a50109ef9f18c2345d7ce7f)]: 20 | - @kubernetes-models/apimachinery@2.0.1 21 | 22 | ## 0.1.0 23 | 24 | ### Minor Changes 25 | 26 | - [#212](https://github.com/tommy351/kubernetes-models-ts/pull/212) [`762697b`](https://github.com/tommy351/kubernetes-models-ts/commit/762697bdcdbf7ade2da0e4ef120452f1d6b42240) Thanks [@alexandre-dos-reis](https://github.com/alexandre-dos-reis)! - First release. 27 | -------------------------------------------------------------------------------- /third-party/cloudnative-pg/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/cloudnative-pg 2 | 3 | [CloudNative PG](https://cloudnative-pg.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/cloudnative-pg 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Cluster } from "@kubernetes-models/cloudnative-pg/postgresql.cnpg.io/v1/Cluster"; 17 | 18 | // Create a new GitRepository 19 | const cluster = new Cluster({ 20 | metadata: { 21 | name: "cluster-example" 22 | }, 23 | spec: { 24 | instances: 3, 25 | storage: { 26 | size: "1Gi" 27 | } 28 | } 29 | }); 30 | 31 | // Validate against JSON schema 32 | cluster.validate(); 33 | ``` 34 | 35 | ## License 36 | 37 | MIT 38 | -------------------------------------------------------------------------------- /third-party/cloudnative-pg/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { Cluster } from "../gen/postgresql.cnpg.io/v1/Cluster"; 3 | 4 | describe("Application", () => { 5 | let cluster: Cluster; 6 | 7 | beforeEach(() => { 8 | cluster = new Cluster({ 9 | metadata: { 10 | name: "cluster-example" 11 | }, 12 | spec: { 13 | instances: 3, 14 | storage: { 15 | size: "1Gi" 16 | } 17 | } 18 | }); 19 | }); 20 | 21 | it("should set apiVersion", () => { 22 | expect(cluster).toHaveProperty("apiVersion", "postgresql.cnpg.io/v1"); 23 | }); 24 | 25 | it("should set kind", () => { 26 | expect(cluster).toHaveProperty("kind", "Cluster"); 27 | }); 28 | 29 | it("validate", () => { 30 | expect(() => cluster.validate()).not.toThrow(); 31 | }); 32 | 33 | it("toJSON", () => { 34 | expect(cluster.toJSON()).toEqual({ 35 | apiVersion: "postgresql.cnpg.io/v1", 36 | kind: "Cluster", 37 | metadata: { 38 | name: "cluster-example" 39 | }, 40 | spec: { 41 | instances: 3, 42 | storage: { 43 | size: "1Gi" 44 | } 45 | } 46 | }); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /third-party/cloudnative-pg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/cloudnative-pg", 3 | "version": "0.1.2", 4 | "description": "cloudnative-pg models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/cloudnative-pg", 10 | "author": "Alexandre Dos Reis ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "cloudnative-pg" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://github.com/cloudnative-pg/cloudnative-pg/releases/download/v1.24.1/cnpg-1.24.1.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third-party/cloudnative-pg/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } -------------------------------------------------------------------------------- /third-party/contour/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/contour 2 | 3 | [Contour](https://projectcontour.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/contour 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { HTTPProxy } from "@kubernetes-models/contour/projectcontour.io/v1"; 17 | 18 | // Create a new HTTP proxy 19 | const route = new HTTPProxy({ 20 | metadata: { 21 | name: "foo" 22 | }, 23 | spec: { 24 | virtualhost: { 25 | fqdn: "foo.example.com" 26 | }, 27 | routes: [ 28 | { 29 | conditions: [ 30 | { 31 | prefix: "/" 32 | } 33 | ], 34 | services: [ 35 | { 36 | name: "foo", 37 | port: 80 38 | } 39 | ] 40 | } 41 | ] 42 | } 43 | }); 44 | 45 | // Validate against JSON schema 46 | route.validate(); 47 | ``` 48 | 49 | ## License 50 | 51 | MIT 52 | -------------------------------------------------------------------------------- /third-party/contour/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/contour", 3 | "version": "4.3.2", 4 | "description": "Contour models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/contour", 10 | "author": "Tommy Chen ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "contour" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://raw.githubusercontent.com/projectcontour/contour/v1.5.0/examples/contour/01-crds.yaml", 47 | "https://raw.githubusercontent.com/projectcontour/contour/v1.25.0/examples/contour/01-crds.yaml" 48 | ], 49 | "output": "./gen" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /third-party/contour/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/elastic-cloud/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/elastic-cloud 2 | 3 | [Elastic Cloud on Kubernetes (ECK)](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-overview.html) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/elastic-cloud 11 | ``` 12 | 13 | ```js 14 | import { Elasticsearch } from '@kubernetes-models/elastic-cloud/elasticsearch.k8s.elastic.co/v1'; 15 | 16 | const elasticsearch = new Elasticsearch({ 17 | metadata: { 18 | name: "example" 19 | }, 20 | spec: { 21 | version: "8.9.2", 22 | nodeSets: [ 23 | { 24 | name: "example" 25 | } 26 | ] 27 | }, 28 | }); 29 | 30 | // Validate against JSON schema 31 | elasticsearch.validate(); 32 | ``` 33 | 34 | ## License 35 | 36 | MIT 37 | -------------------------------------------------------------------------------- /third-party/elastic-cloud/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { Elasticsearch } from "../gen/elasticsearch.k8s.elastic.co/v1"; 3 | 4 | describe("Elasticsearch", () => { 5 | let elasticsearch: Elasticsearch; 6 | 7 | beforeEach(() => { 8 | elasticsearch = new Elasticsearch({ 9 | metadata: { name: "hello" }, 10 | spec: { 11 | version: "8.9.2", 12 | nodeSets: [ 13 | { 14 | name: "hello-world" 15 | } 16 | ] 17 | } 18 | }); 19 | }); 20 | 21 | it("should set apiVersion", () => { 22 | expect(elasticsearch).toHaveProperty( 23 | "apiVersion", 24 | "elasticsearch.k8s.elastic.co/v1" 25 | ); 26 | }); 27 | 28 | it("should set kind", () => { 29 | expect(elasticsearch).toHaveProperty("kind", "Elasticsearch"); 30 | }); 31 | 32 | it("validate", () => { 33 | expect(() => elasticsearch.validate()).not.toThrow(); 34 | }); 35 | 36 | it("toJSON", () => { 37 | expect(elasticsearch.toJSON()).toEqual({ 38 | apiVersion: "elasticsearch.k8s.elastic.co/v1", 39 | kind: "Elasticsearch", 40 | metadata: { name: "hello" }, 41 | spec: { 42 | version: "8.9.2", 43 | nodeSets: [ 44 | { 45 | name: "hello-world" 46 | } 47 | ] 48 | } 49 | }); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /third-party/elastic-cloud/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/elastic-cloud", 3 | "version": "0.2.2", 4 | "description": "You Know, for Search.", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/elastic-cloud", 10 | "author": "Eddie Wen ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "elastic-cloud" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://download.elastic.co/downloads/eck/2.11.1/crds.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } -------------------------------------------------------------------------------- /third-party/elastic-cloud/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } -------------------------------------------------------------------------------- /third-party/envoy-gateway/.gitignore: -------------------------------------------------------------------------------- 1 | /crds/ 2 | -------------------------------------------------------------------------------- /third-party/envoy-gateway/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/envoy-gateway 2 | 3 | [Envoy Gateway](https://gateway.envoyproxy.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/envoy-gateway 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { BackendTrafficPolicy } from "@kubernetes-models/envoy-gateway/gateway.envoyproxy.io/v1alpha1"; 17 | 18 | // Create a new BackendTrafficPolicy 19 | const app = new BackendTrafficPolicy({ 20 | metadata: { 21 | namespace: "envoy-gateway", 22 | name: "target-gateway-1" 23 | }, 24 | spec: { 25 | targetRef: { 26 | group: "gateway.networking.k8s.io", 27 | kind: "Gateway", 28 | name: "gateway-1", 29 | namespace: "envoy-gateway" 30 | } 31 | } 32 | }); 33 | 34 | // Validate against JSON schema 35 | app.validate(); 36 | ``` 37 | 38 | ## License 39 | 40 | MIT 41 | -------------------------------------------------------------------------------- /third-party/envoy-gateway/scripts/download-crd.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable node/no-unpublished-import */ 2 | import { readInput } from "@kubernetes-models/read-input"; 3 | import { mkdir, writeFile } from "fs/promises"; 4 | import yaml from "js-yaml"; 5 | import { dirname, join } from "path"; 6 | 7 | const VERSIONS = ["0.5.0", "1.0.0"]; 8 | 9 | const outputPath = join(__dirname, "../crds/crd.yaml"); 10 | 11 | (async () => { 12 | const output: any[] = []; 13 | 14 | for (const version of VERSIONS) { 15 | const content = await readInput( 16 | `https://github.com/envoyproxy/gateway/releases/download/v${version}/install.yaml` 17 | ); 18 | const manifests: any[] = yaml.loadAll(content); 19 | 20 | for (const manifest of manifests) { 21 | if ( 22 | manifest && 23 | manifest.apiVersion === "apiextensions.k8s.io/v1" && 24 | manifest.kind === "CustomResourceDefinition" && 25 | (manifest.spec?.group === "config.gateway.envoyproxy.io" || 26 | manifest.spec?.group === "gateway.envoyproxy.io") 27 | ) { 28 | output.push(manifest); 29 | } 30 | } 31 | } 32 | 33 | await mkdir(dirname(outputPath), { recursive: true }); 34 | await writeFile(outputPath, output.map((x) => yaml.dump(x)).join("---\n")); 35 | })(); 36 | -------------------------------------------------------------------------------- /third-party/envoy-gateway/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } -------------------------------------------------------------------------------- /third-party/external-secrets/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/external-secrets 2 | 3 | [External secrets](https://external-secrets.io) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/external-secrets 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { ExternalSecret } from "@kubernetes-models/external-secrets/external-secrets.io/v1beta1/ExternalSecret"; 17 | 18 | // Create a new ExternalSecret 19 | const secret = new ExternalSecret({ 20 | metadata: { 21 | name: "example" 22 | }, 23 | spec: { 24 | refreshInterval: "1h", 25 | secretStoreRef: { 26 | name: "secret-store-sample", 27 | kind: "SecretStore" 28 | }, 29 | target: { 30 | name: "secret-to-be-created", 31 | creationPolicy: "Owner" 32 | }, 33 | data: [ 34 | { 35 | secretKey: "secret-key-to-be-managed", 36 | remoteRef: { 37 | key: "provider-key", 38 | version: "provider-key-version", 39 | property: "provider-key-property" 40 | } 41 | } 42 | ], 43 | dataFrom: [ 44 | { 45 | extract: { key: "remote-key-in-the-provider" } 46 | } 47 | ] 48 | } 49 | }); 50 | 51 | // Validate against JSON schema 52 | secret.validate(); 53 | ``` 54 | 55 | ## License 56 | 57 | MIT 58 | -------------------------------------------------------------------------------- /third-party/external-secrets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/external-secrets", 3 | "version": "0.6.0", 4 | "description": "External secrets models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/external-secrets", 10 | "author": "Tommy Chen ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "external-secrets" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://github.com/external-secrets/external-secrets/releases/download/v0.16.2/external-secrets.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third-party/external-secrets/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/fission/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/fission 2 | 3 | [Fission](https://fission.io) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/fission 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Package } from "@kubernetes-models/fission/fission.io/v1/Package"; 17 | 18 | // Create a new Package 19 | const pkg = new Package({ 20 | metadata: { 21 | name: "example" 22 | }, 23 | spec: { 24 | environment: { 25 | name: "nodejs", 26 | namespace: "fission-function" 27 | }, 28 | deployment: { 29 | type: "literal", 30 | literal: "console.log('Hello, World!')" 31 | } 32 | } 33 | }); 34 | 35 | // Validate against JSON schema 36 | pkg.validate(); 37 | ``` 38 | 39 | ## License 40 | 41 | MIT 42 | -------------------------------------------------------------------------------- /third-party/fission/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } -------------------------------------------------------------------------------- /third-party/flagger/.gitignore: -------------------------------------------------------------------------------- 1 | /crds/ 2 | -------------------------------------------------------------------------------- /third-party/flagger/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/flagger 2 | 3 | [Flagger](https://flagger.app/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/flagger 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Canary } from "@kubernetes-models/flagger/flagger.app/v1beta1/Canary"; 17 | 18 | // Create a new Canary 19 | const canary = new Canary({ 20 | metadata: { 21 | name: "example" 22 | }, 23 | spec: { 24 | targetRef: { 25 | apiVersion: "apps/v1", 26 | kind: "Deployment", 27 | name: "example" 28 | }, 29 | service: { port: 9898 }, 30 | analysis: { 31 | interval: "1m", 32 | threshold: 10, 33 | maxWeight: 50, 34 | stepWeight: 5 35 | } 36 | } 37 | }); 38 | 39 | // Validate against JSON schema 40 | canary.validate(); 41 | ``` 42 | 43 | ## License 44 | 45 | MIT 46 | -------------------------------------------------------------------------------- /third-party/flagger/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { Canary } from "../gen/flagger.app/v1beta1/Canary"; 3 | 4 | describe("Canary", () => { 5 | let canary: Canary; 6 | 7 | beforeEach(() => { 8 | canary = new Canary({ 9 | metadata: { 10 | name: "example" 11 | }, 12 | spec: { 13 | targetRef: { 14 | apiVersion: "apps/v1", 15 | kind: "Deployment", 16 | name: "example" 17 | }, 18 | service: { port: 9898 }, 19 | analysis: { 20 | interval: "1m", 21 | threshold: 10, 22 | maxWeight: 50, 23 | stepWeight: 5 24 | } 25 | } 26 | }); 27 | }); 28 | 29 | it("should set apiVersion", () => { 30 | expect(canary).toHaveProperty("apiVersion", "flagger.app/v1beta1"); 31 | }); 32 | 33 | it("should set kind", () => { 34 | expect(canary).toHaveProperty("kind", "Canary"); 35 | }); 36 | 37 | it("validate", () => { 38 | expect(() => canary.validate()).not.toThrow(); 39 | }); 40 | 41 | it("toJSON", () => { 42 | expect(canary.toJSON()).toEqual({ 43 | apiVersion: "flagger.app/v1beta1", 44 | kind: "Canary", 45 | metadata: { 46 | name: "example" 47 | }, 48 | spec: { 49 | targetRef: { 50 | apiVersion: "apps/v1", 51 | kind: "Deployment", 52 | name: "example" 53 | }, 54 | service: { port: 9898 }, 55 | analysis: { 56 | interval: "1m", 57 | threshold: 10, 58 | maxWeight: 50, 59 | stepWeight: 5 60 | } 61 | } 62 | }); 63 | }); 64 | }); 65 | -------------------------------------------------------------------------------- /third-party/flagger/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/flagger", 3 | "version": "0.4.2", 4 | "description": "Flagger models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/flagger", 10 | "author": "Tommy Chen ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "ts-node scripts/download-crd.ts && crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "flagger" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "@kubernetes-models/read-input": "workspace:^", 43 | "@types/js-yaml": "^4.0.5", 44 | "@types/node": "^18.7.23", 45 | "js-yaml": "^4.1.0", 46 | "ts-node": "^10.9.1", 47 | "typescript": "^4.8.4", 48 | "vitest": "^0.29.8" 49 | }, 50 | "crd-generate": { 51 | "input": [ 52 | "./crds/crd.yaml" 53 | ], 54 | "output": "./gen" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /third-party/flagger/scripts/download-crd.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable node/no-unpublished-import */ 2 | import { readInput } from "@kubernetes-models/read-input"; 3 | import { mkdir, writeFile } from "fs/promises"; 4 | import yaml from "js-yaml"; 5 | import { dirname, join } from "path"; 6 | 7 | const VERSION = "1.31.0"; 8 | 9 | const outputPath = join(__dirname, "../crds/crd.yaml"); 10 | 11 | (async () => { 12 | const content = await readInput( 13 | `https://raw.githubusercontent.com/fluxcd/flagger/v${VERSION}/artifacts/flagger/crd.yaml` 14 | ); 15 | const manifests: any[] = yaml.loadAll(content); 16 | 17 | for (const manifest of manifests) { 18 | if ( 19 | manifest.apiVersion === "apiextensions.k8s.io/v1" && 20 | manifest.kind === "CustomResourceDefinition" 21 | ) { 22 | for (const ver of manifest.spec.versions) { 23 | // The original description of `apiVersion` and `kind` is invalid in YAML. 24 | // Reset these properties to fix the issue. 25 | ver.schema.openAPIV3Schema.properties.apiVersion = { type: "string" }; 26 | ver.schema.openAPIV3Schema.properties.kind = { type: "string" }; 27 | } 28 | } 29 | } 30 | 31 | await mkdir(dirname(outputPath), { recursive: true }); 32 | await writeFile(outputPath, manifests.map((x) => yaml.dump(x)).join("---\n")); 33 | })(); 34 | -------------------------------------------------------------------------------- /third-party/flagger/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/flux-cd/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/flux-cd 2 | 3 | [Flux CD](https://fluxcd.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/flux-cd 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { GitRepository } from "@kubernetes-models/flux-cd/source.toolkit.fluxcd.io/v1beta1/GitRepository"; 17 | 18 | // Create a new GitRepository 19 | const repo = new GitRepository({ 20 | metadata: { 21 | name: "webapp" 22 | }, 23 | spec: { 24 | interval: "60m", 25 | url: "https://github.com/tommy351/kubernetes-models-ts", 26 | ref: { 27 | branch: "master" 28 | } 29 | } 30 | }); 31 | 32 | // Validate against JSON schema 33 | repo.validate(); 34 | ``` 35 | 36 | ## License 37 | 38 | MIT 39 | -------------------------------------------------------------------------------- /third-party/flux-cd/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { GitRepository } from "../gen/source.toolkit.fluxcd.io/v1beta1/GitRepository"; 3 | 4 | describe("Application", () => { 5 | let repo: GitRepository; 6 | 7 | beforeEach(() => { 8 | repo = new GitRepository({ 9 | metadata: { 10 | name: "webapp" 11 | }, 12 | spec: { 13 | interval: "60m", 14 | url: "https://github.com/tommy351/kubernetes-models-ts", 15 | ref: { 16 | branch: "master" 17 | } 18 | } 19 | }); 20 | }); 21 | 22 | it("should set apiVersion", () => { 23 | expect(repo).toHaveProperty( 24 | "apiVersion", 25 | "source.toolkit.fluxcd.io/v1beta1" 26 | ); 27 | }); 28 | 29 | it("should set kind", () => { 30 | expect(repo).toHaveProperty("kind", "GitRepository"); 31 | }); 32 | 33 | it("validate", () => { 34 | expect(() => repo.validate()).not.toThrow(); 35 | }); 36 | 37 | it("toJSON", () => { 38 | expect(repo.toJSON()).toEqual({ 39 | apiVersion: "source.toolkit.fluxcd.io/v1beta1", 40 | kind: "GitRepository", 41 | metadata: { 42 | name: "webapp" 43 | }, 44 | spec: { 45 | interval: "60m", 46 | url: "https://github.com/tommy351/kubernetes-models-ts", 47 | ref: { 48 | branch: "master" 49 | } 50 | } 51 | }); 52 | }); 53 | }); 54 | -------------------------------------------------------------------------------- /third-party/flux-cd/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/gateway-api/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/gateway-api 2 | 3 | [Gateway API](https://gateway-api.sigs.k8s.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/gateway-api 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { HTTPRoute } from "@kubernetes-models/gateway-api/gateway.networking.k8s.io/v1/HTTPRoute"; 17 | 18 | // Create a new HTTPRoute 19 | const route = new HTTPRoute({ 20 | metadata: { 21 | name: "http-route" 22 | }, 23 | spec: { 24 | parentRefs: [ 25 | { 26 | kind: "Gateway", 27 | name: "foo-gateway" 28 | } 29 | ], 30 | rules: [ 31 | { 32 | backendRefs: [{ name: "foo-svc", port: 8080 }] 33 | } 34 | ] 35 | } 36 | }); 37 | 38 | // Validate against JSON schema 39 | route.validate(); 40 | ``` 41 | 42 | ## License 43 | 44 | MIT 45 | -------------------------------------------------------------------------------- /third-party/gateway-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/gke/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/gke 2 | 3 | [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine/docs/concepts/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/gke 11 | ``` 12 | 13 | ## Usage 14 | 15 | ### Google Cloud CDN/IAP/Cloud Armor Settings 16 | 17 | via [BackendConfig](https://cloud.google.com/kubernetes-engine/docs/concepts/backendconfig) 18 | 19 | ```js 20 | import { BackendConfig } from "@kubernetes-models/gke/cloud.google.com/v1beta1/BackendConfig"; 21 | 22 | const config = new BackendConfig({ 23 | metadata: { 24 | name: "iap-example" 25 | }, 26 | spec: { 27 | iap: { 28 | enabled: true, 29 | oauthclientCredentials: { 30 | secretName: "iap-oauth-secret" 31 | } 32 | } 33 | } 34 | }); 35 | 36 | // Validate against JSON schema 37 | config.validate(); 38 | ``` 39 | 40 | ### Config Connector 41 | 42 | ```js 43 | import { SpannerInstance } from "@kubernetes-models/gke/spanner.cnrm.cloud.google.com/v1beta1/SpannerInstance"; 44 | 45 | const instance = new SpannerInstance({ 46 | metadata: { 47 | name: "spanner-example" 48 | }, 49 | spec: { 50 | config: "regional-us-west1", 51 | displayName: "Spanner Example", 52 | numNodes: 1 53 | } 54 | }); 55 | 56 | instance.validate(); 57 | ``` 58 | 59 | ## License 60 | 61 | MIT 62 | -------------------------------------------------------------------------------- /third-party/gke/__tests__/validate.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect } from "vitest"; 2 | import { BackendConfig } from "../gen/cloud.google.com/v1beta1/BackendConfig"; 3 | 4 | describe("validate", () => { 5 | describe("when validation passed", () => { 6 | it("should pass", () => { 7 | const config = new BackendConfig({ 8 | spec: { 9 | iap: { 10 | enabled: true, 11 | oauthclientCredentials: { 12 | secretName: "oauth-secret" 13 | } 14 | } 15 | } 16 | }); 17 | 18 | expect(() => config.validate()).not.toThrow(); 19 | }); 20 | }); 21 | 22 | describe("when validation failed", () => { 23 | it("should throw an error", () => { 24 | const config = new BackendConfig({ 25 | spec: { 26 | // @ts-expect-error 27 | iap: {} 28 | } 29 | }); 30 | 31 | expect(() => config.validate()).toThrow( 32 | "data/spec/iap must have required property enabled, data/spec/iap must have required property oauthclientCredentials" 33 | ); 34 | }); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /third-party/gke/crd/clusterimportconfigs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apiextensions.k8s.io/v1 2 | kind: CustomResourceDefinition 3 | metadata: 4 | name: clusterimportconfigs.net.gke.io 5 | spec: 6 | conversion: 7 | strategy: None 8 | group: net.gke.io 9 | names: 10 | kind: ClusterImportConfig 11 | listKind: ClusterImportConfigList 12 | plural: clusterimportconfigs 13 | singular: clusterimportconfig 14 | scope: Namespaced 15 | versions: 16 | - name: v1 17 | schema: 18 | openAPIV3Schema: 19 | properties: 20 | spec: 21 | properties: 22 | clusteripranges: 23 | items: 24 | properties: 25 | cidrs: 26 | items: 27 | type: string 28 | type: array 29 | cluster: 30 | type: string 31 | type: object 32 | type: array 33 | networks: 34 | items: 35 | type: string 36 | type: array 37 | zones: 38 | items: 39 | type: string 40 | type: array 41 | type: object 42 | required: 43 | - spec 44 | type: object 45 | served: true 46 | storage: true 47 | -------------------------------------------------------------------------------- /third-party/gke/crd/entitlements.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apiextensions.k8s.io/v1 2 | kind: CustomResourceDefinition 3 | metadata: 4 | name: entitlements.anthos.gke.io 5 | spec: 6 | conversion: 7 | strategy: None 8 | group: anthos.gke.io 9 | names: 10 | kind: Entitlement 11 | listKind: EntitlementList 12 | plural: entitlements 13 | singular: entitlement 14 | scope: Cluster 15 | versions: 16 | - name: v1alpha1 17 | schema: 18 | openAPIV3Schema: 19 | description: Entitlement is a CR representing that Anthos software may be run on 20 | a particular cluster. This is written to Anthos-enabled clusters by 21 | a Hub controller. This is read by in-cluster Anthos services 22 | performing Entitlement checks. 23 | properties: 24 | apiVersion: 25 | type: string 26 | kind: 27 | type: string 28 | metadata: 29 | type: object 30 | spec: 31 | properties: 32 | expirationTimestamp: 33 | description: ExpirationTimestamp is when this Entitlement expires. An RFC3339 34 | date/time. 35 | format: date-time 36 | type: string 37 | type: object 38 | required: 39 | - metadata 40 | type: object 41 | served: true 42 | storage: true 43 | -------------------------------------------------------------------------------- /third-party/gke/crd/serviceimportconfigs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apiextensions.k8s.io/v1 2 | kind: CustomResourceDefinition 3 | metadata: 4 | name: serviceimportconfigs.net.gke.io 5 | spec: 6 | conversion: 7 | strategy: None 8 | group: net.gke.io 9 | names: 10 | kind: ServiceImportConfig 11 | listKind: ServiceImportConfigList 12 | plural: serviceimportconfigs 13 | singular: serviceimportconfig 14 | scope: Namespaced 15 | versions: 16 | - name: v1 17 | schema: 18 | openAPIV3Schema: 19 | properties: 20 | spec: 21 | properties: 22 | clusters: 23 | items: 24 | properties: 25 | capacityScaler: 26 | type: string 27 | maxEatePerEndpoint: 28 | type: string 29 | maxrate: 30 | type: string 31 | membershipName: 32 | type: string 33 | neg: 34 | type: string 35 | type: object 36 | type: array 37 | negs: 38 | items: 39 | type: string 40 | type: array 41 | type: object 42 | required: 43 | - spec 44 | type: object 45 | served: true 46 | storage: true 47 | -------------------------------------------------------------------------------- /third-party/gke/crd/updateinfos.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apiextensions.k8s.io/v1 2 | kind: CustomResourceDefinition 3 | metadata: 4 | name: updateinfos.nodemanagement.gke.io 5 | spec: 6 | conversion: 7 | strategy: None 8 | group: nodemanagement.gke.io 9 | names: 10 | kind: UpdateInfo 11 | listKind: UpdateInfoList 12 | plural: updateinfos 13 | shortNames: 14 | - updinf 15 | singular: updateinfo 16 | scope: Namespaced 17 | versions: 18 | - name: v1alpha1 19 | schema: 20 | openAPIV3Schema: 21 | properties: 22 | spec: 23 | properties: 24 | Type: 25 | type: string 26 | instanceGroupUrl: 27 | type: string 28 | surgeNode: 29 | type: string 30 | targetNode: 31 | type: string 32 | validUntil: 33 | format: date-time 34 | type: string 35 | type: object 36 | type: object 37 | served: true 38 | storage: true 39 | -------------------------------------------------------------------------------- /third-party/gke/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/grafana-agent-operator/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/grafana-agent-operator 2 | 3 | [Grafana agent operator](https://grafana.com/docs/agent/latest/operator/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/grafana-agent-operator 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { GrafanaAgent } from "@kubernetes-models/grafana-agent-operator/monitoring.grafana.com/v1alpha1/GrafanaAgent"; 17 | 18 | // Create a new GrafanaAgent 19 | const agent = new GrafanaAgent({ 20 | metadata: { name: "grafana-agent" }, 21 | spec: { 22 | image: "grafana/agent:v0.21.2", 23 | logLevel: "info", 24 | metrics: { 25 | instanceSelector: { 26 | matchLabels: { 27 | agent: "grafana-agent-metrics" 28 | } 29 | } 30 | } 31 | } 32 | }); 33 | 34 | // Validate against JSON schema 35 | agent.validate(); 36 | ``` 37 | 38 | ## License 39 | 40 | See [LICENSE](../../LICENSE) 41 | -------------------------------------------------------------------------------- /third-party/grafana-agent-operator/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { GrafanaAgent } from "../gen/monitoring.grafana.com/v1alpha1/GrafanaAgent"; 3 | 4 | describe("GrafanaAgent", () => { 5 | let agent: GrafanaAgent; 6 | 7 | beforeEach(() => { 8 | agent = new GrafanaAgent({ 9 | metadata: { name: "grafana-agent" }, 10 | spec: { 11 | image: "grafana/agent:v0.21.2", 12 | logLevel: "info", 13 | metrics: { 14 | instanceSelector: { 15 | matchLabels: { 16 | agent: "grafana-agent-metrics" 17 | } 18 | } 19 | } 20 | } 21 | }); 22 | }); 23 | 24 | it("should set apiVersion", () => { 25 | expect(agent).toHaveProperty( 26 | "apiVersion", 27 | "monitoring.grafana.com/v1alpha1" 28 | ); 29 | }); 30 | 31 | it("should set kind", () => { 32 | expect(agent).toHaveProperty("kind", "GrafanaAgent"); 33 | }); 34 | 35 | it("validate", () => { 36 | expect(() => agent.validate()).not.toThrow(); 37 | }); 38 | 39 | it("toJSON", () => { 40 | expect(agent.toJSON()).toEqual({ 41 | apiVersion: "monitoring.grafana.com/v1alpha1", 42 | kind: "GrafanaAgent", 43 | metadata: { name: "grafana-agent" }, 44 | spec: { 45 | image: "grafana/agent:v0.21.2", 46 | logLevel: "info", 47 | metrics: { 48 | instanceSelector: { 49 | matchLabels: { 50 | agent: "grafana-agent-metrics" 51 | } 52 | } 53 | } 54 | } 55 | }); 56 | }); 57 | }); 58 | -------------------------------------------------------------------------------- /third-party/grafana-agent-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/grafana-operator/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/grafana-operator 2 | 3 | [Grafana operator](https://github.com/grafana-operator/grafana-operator) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/grafana-operator 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Grafana } from "@kubernetes-models/grafana-operator/integreatly.org/v1alpha1/Grafana"; 17 | 18 | // Create a new Grafana 19 | const grafana = new Grafana({ 20 | metadata: { name: "example" }, 21 | spec: { 22 | config: { 23 | log: { 24 | mode: "console", 25 | level: "error" 26 | } 27 | } 28 | } 29 | }); 30 | 31 | // Validate against JSON schema 32 | grafana.validate(); 33 | ``` 34 | 35 | ## License 36 | 37 | See [LICENSE](../../LICENSE) 38 | -------------------------------------------------------------------------------- /third-party/grafana-operator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/grafana-operator", 3 | "version": "2.4.2", 4 | "description": "Grafana operator models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/grafana-operator", 10 | "author": "Tommy Chen ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "grafana-operator" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://raw.githubusercontent.com/grafana-operator/grafana-operator/v4.8.0/deploy/manifests/v4.8.0/crds.yaml", 47 | "https://raw.githubusercontent.com/grafana/grafana-operator/v5.8.0/deploy/kustomize/base/crds.yaml" 48 | ], 49 | "output": "./gen" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /third-party/grafana-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/hierarchical-namespaces/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/hierarchical-namespaces", 3 | "version": "0.2.2", 4 | "description": "Kubernetes hierarchical-namespaces models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/hierarchical-namespaces", 10 | "license": "MIT", 11 | "main": "index.js", 12 | "module": "index.mjs", 13 | "types": "index.d.ts", 14 | "sideEffects": false, 15 | "scripts": { 16 | "build": "crd-generate && publish-scripts build", 17 | "prepack": "publish-scripts prepack" 18 | }, 19 | "publishConfig": { 20 | "access": "public", 21 | "directory": "dist", 22 | "linkDirectory": true 23 | }, 24 | "keywords": [ 25 | "kubernetes", 26 | "kubernetes-models", 27 | "hierarchical-namespaces" 28 | ], 29 | "engines": { 30 | "node": ">=14" 31 | }, 32 | "dependencies": { 33 | "@kubernetes-models/apimachinery": "workspace:^", 34 | "@kubernetes-models/base": "workspace:^", 35 | "@kubernetes-models/validate": "workspace:^", 36 | "@swc/helpers": "^0.5.8" 37 | }, 38 | "devDependencies": { 39 | "@kubernetes-models/crd-generate": "workspace:^", 40 | "@kubernetes-models/publish-scripts": "workspace:^", 41 | "vitest": "^0.29.8" 42 | }, 43 | "crd-generate": { 44 | "input": [ 45 | "https://github.com/kubernetes-sigs/hierarchical-namespaces/releases/download/v1.1.0/hrq.yaml" 46 | ], 47 | "output": "./gen" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /third-party/hierarchical-namespaces/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /third-party/istio/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/istio 2 | 3 | [Istio](https://istio.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/istio 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Gateway } from "@kubernetes-models/istio/networking.istio.io/v1beta1/Gateway"; 17 | 18 | // Create a new Gateway 19 | const gateway = new Gateway({ 20 | metadata: { 21 | name: "test" 22 | }, 23 | spec: { 24 | selector: { 25 | app: "istio" 26 | }, 27 | servers: [ 28 | { 29 | port: { 30 | number: 80 31 | }, 32 | hosts: ["*"] 33 | } 34 | ] 35 | } 36 | }); 37 | 38 | // Validate against JSON schema 39 | gateway.validate(); 40 | ``` 41 | 42 | ## License 43 | 44 | MIT 45 | -------------------------------------------------------------------------------- /third-party/istio/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { Gateway } from "../gen/networking.istio.io/v1beta1/Gateway"; 3 | 4 | describe("Gateway", () => { 5 | let gateway: Gateway; 6 | 7 | beforeEach(() => { 8 | gateway = new Gateway({ 9 | metadata: { 10 | name: "test" 11 | }, 12 | spec: { 13 | selector: { 14 | app: "istio" 15 | }, 16 | servers: [ 17 | { 18 | port: { 19 | number: 80 20 | }, 21 | hosts: ["*"] 22 | } 23 | ] 24 | } 25 | }); 26 | }); 27 | 28 | it("should set apiVersion", () => { 29 | expect(gateway).toHaveProperty("apiVersion", "networking.istio.io/v1beta1"); 30 | }); 31 | 32 | it("should set kind", () => { 33 | expect(gateway).toHaveProperty("kind", "Gateway"); 34 | }); 35 | 36 | it("validate", () => { 37 | expect(() => gateway.validate()).not.toThrow(); 38 | }); 39 | 40 | it("toJSON", () => { 41 | expect(gateway.toJSON()).toEqual({ 42 | apiVersion: "networking.istio.io/v1beta1", 43 | kind: "Gateway", 44 | metadata: { 45 | name: "test" 46 | }, 47 | spec: { 48 | selector: { 49 | app: "istio" 50 | }, 51 | servers: [ 52 | { 53 | port: { 54 | number: 80 55 | }, 56 | hosts: ["*"] 57 | } 58 | ] 59 | } 60 | }); 61 | }); 62 | }); 63 | -------------------------------------------------------------------------------- /third-party/istio/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/istio", 3 | "version": "2.4.2", 4 | "description": "Istio models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/istio", 10 | "author": "Tommy Chen ", 11 | "license": "MIT", 12 | "main": "index.cjs", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "istio" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://raw.githubusercontent.com/istio/istio/1.18.0/manifests/charts/base/crds/crd-all.gen.yaml", 47 | "https://raw.githubusercontent.com/istio/istio/1.18.0/manifests/charts/base/crds/crd-operator.yaml" 48 | ], 49 | "output": "./gen" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /third-party/istio/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/jaeger-operator/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/jaeger-operator 2 | 3 | [Jaeger operator](https://www.jaegertracing.io/docs/latest/operator/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/jaeger-operator 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Jaeger } from "@kubernetes-models/jaeger-operator/jaegertracing.io/v1/Jaeger"; 17 | 18 | // Create a new Jaeger 19 | const jaeger = new Jaeger({ 20 | metadata: { name: "hello" }, 21 | spec: { 22 | strategy: "production", 23 | collector: { 24 | maxReplicas: 5, 25 | resources: { 26 | limits: { 27 | cpu: "100m", 28 | memory: "128Mi" 29 | } 30 | } 31 | }, 32 | storage: { 33 | type: "elasticsearch", 34 | options: { 35 | es: { 36 | "server-urls": "http://elasticsearch:9200" 37 | } 38 | } 39 | } 40 | } 41 | }); 42 | 43 | // Validate against JSON schema 44 | jaeger.validate(); 45 | ``` 46 | 47 | ## License 48 | 49 | See [LICENSE](../../LICENSE) 50 | -------------------------------------------------------------------------------- /third-party/jaeger-operator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/jaeger-operator", 3 | "version": "2.3.2", 4 | "description": "Jaeger operator models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/jaeger-operator", 10 | "author": "Tommy Chen =14" 33 | }, 34 | "dependencies": { 35 | "@kubernetes-models/apimachinery": "workspace:^", 36 | "@kubernetes-models/base": "workspace:^", 37 | "@kubernetes-models/validate": "workspace:^", 38 | "@swc/helpers": "^0.5.8" 39 | }, 40 | "devDependencies": { 41 | "@kubernetes-models/crd-generate": "workspace:^", 42 | "@kubernetes-models/publish-scripts": "workspace:^", 43 | "vitest": "^0.29.8" 44 | }, 45 | "crd-generate": { 46 | "input": [ 47 | "https://raw.githubusercontent.com/jaegertracing/jaeger-operator/v1.39.0/config/crd/bases/jaegertracing.io_jaegers.yaml" 48 | ], 49 | "output": "./gen" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /third-party/jaeger-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/k8ssandra-operator/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/k8ssandra-operator 2 | 3 | [K8ssandra](https://k8ssandra.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/k8ssandra-operator 11 | ``` 12 | 13 | ```js 14 | import { K8ssandraCluster } from '@kubernetes-models/k8ssandra-operator/v1alpha1'; 15 | 16 | const cluster = new K8ssandraCluster({ 17 | metadata: { name: "example" }, 18 | spec: { 19 | cassandra: { 20 | datacenters: [ 21 | { 22 | metadata: { 23 | name: "example" 24 | }, 25 | size: 3 26 | } 27 | ] 28 | } 29 | } 30 | }); 31 | 32 | // Validate against JSON schema 33 | cluster.validate(); 34 | ``` 35 | 36 | ## License 37 | 38 | MIT 39 | -------------------------------------------------------------------------------- /third-party/k8ssandra-operator/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { K8ssandraCluster } from "../gen/k8ssandra.io/v1alpha1"; 3 | 4 | describe("K8ssandraCluster", () => { 5 | let cluster: K8ssandraCluster; 6 | 7 | beforeEach(() => { 8 | cluster = new K8ssandraCluster({ 9 | metadata: { name: "hello" }, 10 | spec: { 11 | cassandra: { 12 | datacenters: [ 13 | { 14 | metadata: { 15 | name: "hello" 16 | }, 17 | size: 3 18 | } 19 | ] 20 | } 21 | } 22 | }); 23 | }); 24 | 25 | it("should set apiVersion", () => { 26 | expect(cluster).toHaveProperty("apiVersion", "k8ssandra.io/v1alpha1"); 27 | }); 28 | 29 | it("should set kind", () => { 30 | expect(cluster).toHaveProperty("kind", "K8ssandraCluster"); 31 | }); 32 | 33 | it("validate", () => { 34 | expect(() => cluster.validate()).not.toThrow(); 35 | }); 36 | 37 | it("toJSON", () => { 38 | expect(cluster.toJSON()).toEqual({ 39 | apiVersion: "k8ssandra.io/v1alpha1", 40 | kind: "K8ssandraCluster", 41 | metadata: { name: "hello" }, 42 | spec: { 43 | cassandra: { 44 | datacenters: [ 45 | { 46 | metadata: { 47 | name: "hello" 48 | }, 49 | size: 3 50 | } 51 | ] 52 | } 53 | } 54 | }); 55 | }); 56 | }); 57 | -------------------------------------------------------------------------------- /third-party/k8ssandra-operator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/k8ssandra-operator", 3 | "version": "0.2.2", 4 | "description": "Manage Apache Cassandra and DSE on Kubernetes.", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/k8ssandra-operator", 10 | "author": "Eddie Wen ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "k8ssandra-operator" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://raw.githubusercontent.com/k8ssandra/k8ssandra-operator/release/1.13/charts/k8ssandra-operator/crds/k8ssandra-operator-crds.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } -------------------------------------------------------------------------------- /third-party/k8ssandra-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } -------------------------------------------------------------------------------- /third-party/kapp-controller/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/kapp-controller 2 | 3 | [Carvel kapp contoller](https://github.com/vmware-tanzu/carvel-kapp-controller) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/kapp-controller 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { App } from "@kubernetes-models/kapp-controller/kappctrl.k14s.io/v1alpha1/App"; 17 | 18 | // Create a new Application 19 | const app = new App({ 20 | metadata: { name: "hello" }, 21 | spec: { 22 | serviceAccountName: "default-ns-sa", 23 | fetch: [ 24 | { 25 | git: { 26 | url: "https://github.com/vmware-tanzu/carvel-simple-app-on-kubernetes", 27 | ref: "origin/develop", 28 | subPath: "config-step-2-template" 29 | } 30 | } 31 | ], 32 | template: [{ ytt: {} }], 33 | deploy: [{ kapp: {} }] 34 | } 35 | }); 36 | 37 | // Validate against JSON schema 38 | app.validate(); 39 | ``` 40 | 41 | ## License 42 | 43 | See [LICENSE](../../LICENSE) 44 | -------------------------------------------------------------------------------- /third-party/kapp-controller/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/kapp-controller", 3 | "version": "2.3.2", 4 | "description": "Carvel kapp contoller models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/kapp-controller", 10 | "license": "MIT", 11 | "main": "index.js", 12 | "module": "index.mjs", 13 | "types": "index.d.ts", 14 | "sideEffects": false, 15 | "scripts": { 16 | "build": "crd-generate && publish-scripts build", 17 | "prepack": "publish-scripts prepack" 18 | }, 19 | "publishConfig": { 20 | "access": "public", 21 | "directory": "dist", 22 | "linkDirectory": true 23 | }, 24 | "keywords": [ 25 | "kubernetes", 26 | "kubernetes-models", 27 | "kapp-controller" 28 | ], 29 | "engines": { 30 | "node": ">=14" 31 | }, 32 | "dependencies": { 33 | "@kubernetes-models/apimachinery": "workspace:^", 34 | "@kubernetes-models/base": "workspace:^", 35 | "@kubernetes-models/validate": "workspace:^", 36 | "@swc/helpers": "^0.5.8" 37 | }, 38 | "devDependencies": { 39 | "@kubernetes-models/crd-generate": "workspace:^", 40 | "@kubernetes-models/publish-scripts": "workspace:^", 41 | "vitest": "^0.29.8" 42 | }, 43 | "crd-generate": { 44 | "input": [ 45 | "https://github.com/vmware-tanzu/carvel-kapp-controller/releases/download/v0.44.1/release.yml" 46 | ], 47 | "output": "./gen" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /third-party/kapp-controller/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/karpenter/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/karpenter 2 | 3 | [Karpenter](https://karpenter.sh/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/karpenter 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```ts 16 | import { EC2NodeClass } from "@kubernetes-models/karpenter/karpenter.k8s.aws/v1beta1"; 17 | 18 | // Create a new EC2NodeClass 19 | const nodeClass = new EC2NodeClass({ 20 | metadata: { name: "test" }, 21 | spec: { 22 | amiFamily: "AL2", 23 | subnetSelectorTerms: [{ tags: { "aws-cdk:subnet-name": "private" } }], 24 | securityGroupSelectorTerms: [{ name: "test" }] 25 | } 26 | }); 27 | 28 | // Validate against JSON schema 29 | nodeClass.validate(); 30 | ``` 31 | 32 | ## License 33 | 34 | MIT 35 | -------------------------------------------------------------------------------- /third-party/karpenter/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/keda/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/keda 2 | 3 | [KEDA](https://github.com/kedacore/keda) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/keda 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { ScaledObject } from "@kubernetes-models/keda/keda.sh/v1alpha1/ScaledObject"; 17 | 18 | // Create a new ScaledObject 19 | const scaledObject = new ScaledObject({ 20 | metadata: { 21 | name: "example", 22 | }, 23 | spec: { 24 | scaleTargetRef: { 25 | name: 'example', 26 | }, 27 | triggers: [ 28 | { 29 | type: "cpu", 30 | metadata: { 31 | type: "Utilization", 32 | value: "70", 33 | }, 34 | } 35 | ], 36 | }, 37 | }); 38 | 39 | // Validate against JSON schema 40 | scaledObject.validate(); 41 | ``` 42 | 43 | ## License 44 | 45 | See [LICENSE](../../LICENSE) 46 | -------------------------------------------------------------------------------- /third-party/keda/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/keda", 3 | "version": "0.4.2", 4 | "description": "KEDA(Kubernetes Event-driven Autoscaling) models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/keda", 10 | "author": "Jay Chung ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "keda" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://github.com/kedacore/keda/releases/download/v2.10.1/keda-2.10.1.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third-party/keda/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/knative/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/knative 2 | 3 | [Knative](https://knative.dev/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/knative 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Service } from "@kubernetes-models/knative/serving.knative.dev/v1/Service"; 17 | 18 | // Create a service 19 | const service = new Service({ 20 | metadata: { name: "hello" }, 21 | spec: { 22 | template: { 23 | metadata: { name: "hello-world" }, 24 | spec: { 25 | containers: [ 26 | { 27 | image: "gcr.io/knative-samples/helloworld-go", 28 | ports: [{ containerPort: 8080 }] 29 | } 30 | ] 31 | } 32 | } 33 | } 34 | }); 35 | 36 | // Validate against JSON schema 37 | service.validate(); 38 | ``` 39 | 40 | ## License 41 | 42 | MIT 43 | -------------------------------------------------------------------------------- /third-party/knative/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/kubedb/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/kubedb 2 | 3 | [KubeDB](https://kubedb.com/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/kubedb 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { App } from "@kubernetes-models/kubedb/kubedb.com/v1alpha2/Postgres"; 17 | 18 | // Create a new Postgres 19 | const pg = new Postgres({ 20 | metadata: { name: "example" }, 21 | spec: { 22 | version: "13.2", 23 | storageType: "Durable", 24 | storage: { 25 | storageClassName: "standard", 26 | accessModes: ["ReadWriteOnce"], 27 | resources: { 28 | requests: { storage: "1Gi" } 29 | } 30 | }, 31 | terminationPolicy: "DoNotTerminate" 32 | } 33 | }); 34 | 35 | // Validate against JSON schema 36 | pg.validate(); 37 | ``` 38 | 39 | ## License 40 | 41 | See [LICENSE](../../LICENSE) 42 | -------------------------------------------------------------------------------- /third-party/kubedb/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { Postgres } from "../gen/kubedb.com/v1alpha2/Postgres"; 3 | 4 | describe("Postgres", () => { 5 | let pg: Postgres; 6 | 7 | beforeEach(() => { 8 | pg = new Postgres({ 9 | metadata: { name: "example" }, 10 | spec: { 11 | version: "13.2", 12 | storageType: "Durable", 13 | storage: { 14 | storageClassName: "standard", 15 | accessModes: ["ReadWriteOnce"], 16 | resources: { 17 | requests: { storage: "1Gi" } 18 | } 19 | }, 20 | terminationPolicy: "DoNotTerminate" 21 | } 22 | }); 23 | }); 24 | 25 | it("should set apiVersion", () => { 26 | expect(pg).toHaveProperty("apiVersion", "kubedb.com/v1alpha2"); 27 | }); 28 | 29 | it("should set kind", () => { 30 | expect(pg).toHaveProperty("kind", "Postgres"); 31 | }); 32 | 33 | it("validate", () => { 34 | expect(() => pg.validate()).not.toThrow(); 35 | }); 36 | 37 | it("toJSON", () => { 38 | expect(pg.toJSON()).toEqual({ 39 | apiVersion: "kubedb.com/v1alpha2", 40 | kind: "Postgres", 41 | metadata: { name: "example" }, 42 | spec: { 43 | version: "13.2", 44 | storageType: "Durable", 45 | storage: { 46 | storageClassName: "standard", 47 | accessModes: ["ReadWriteOnce"], 48 | resources: { 49 | requests: { storage: "1Gi" } 50 | } 51 | }, 52 | terminationPolicy: "DoNotTerminate" 53 | } 54 | }); 55 | }); 56 | }); 57 | -------------------------------------------------------------------------------- /third-party/kubedb/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/kubedb", 3 | "version": "0.4.2", 4 | "description": "KubeDB models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/kubedb", 10 | "author": "Tommy Chen ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "kubedb" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://raw.githubusercontent.com/kubedb/installer/v2023.04.10/crds/kubedb-crds.yaml", 47 | "https://raw.githubusercontent.com/kubedb/installer/v2023.04.10/crds/kubedb-catalog-crds.yaml" 48 | ], 49 | "output": "./gen" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /third-party/kubedb/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/kyverno/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/kyverno 2 | 3 | [Kyverno](https://kyverno.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/kyverno 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { ClusterPolicy } from "@kubernetes-models/kyverno/kyverno.io/v1/ClusterPolicy"; 17 | 18 | // Create a new ClusterPolicy 19 | const policy = new ClusterPolicy({ 20 | metadata: { 21 | name: "require-labels" 22 | }, 23 | spec: { 24 | validationFailureAction: "enforce", 25 | background: false, 26 | rules: [ 27 | { 28 | name: "check-team", 29 | match: { 30 | any: [ 31 | { 32 | resources: { 33 | namespaces: ["default"], 34 | kinds: ["Pod"] 35 | } 36 | } 37 | ] 38 | }, 39 | validate: { 40 | message: "label team must be set", 41 | pattern: { 42 | metadata: { 43 | labels: { 44 | team: "?*" 45 | } 46 | } 47 | } 48 | } 49 | } 50 | ] 51 | } 52 | }); 53 | 54 | // Validate against JSON schema 55 | policy.validate(); 56 | ``` 57 | 58 | ## License 59 | 60 | MIT 61 | -------------------------------------------------------------------------------- /third-party/kyverno/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/kyverno", 3 | "version": "0.3.2", 4 | "description": "Kyverno models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/kyverno", 10 | "author": "benjamin99 ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "kyverno" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://github.com/kyverno/kyverno/releases/download/v1.11.4/install.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } -------------------------------------------------------------------------------- /third-party/kyverno/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } -------------------------------------------------------------------------------- /third-party/linkerd/.gitignore: -------------------------------------------------------------------------------- 1 | /crds/ 2 | -------------------------------------------------------------------------------- /third-party/linkerd/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/linkerd 2 | 3 | [Linkerd](https://linkerd.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/linkerd 11 | ``` 12 | 13 | ```js 14 | import { ServiceProfile } from '@kubernetes-models/linkerd/linkerd.io/v1alpha2/ServiceProfile'; 15 | 16 | const serviceProfile = new ServiceProfile({ 17 | metadata: { 18 | name: "example" 19 | }, 20 | spec: { 21 | routes: [ 22 | { 23 | name: "example", 24 | condition: { 25 | method: "GET", 26 | pathRegex: "/v1/example/.*" 27 | } 28 | } 29 | ] 30 | }, 31 | }); 32 | 33 | // Validate against JSON schema 34 | serviceProfile.validate(); 35 | ``` 36 | 37 | ## License 38 | 39 | MIT -------------------------------------------------------------------------------- /third-party/linkerd/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/linkerd", 3 | "version": "0.4.1", 4 | "repository": { 5 | "type": "git", 6 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 7 | }, 8 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/linkerd", 9 | "author": "YC Kao ", 10 | "license": "MIT", 11 | "main": "index.js", 12 | "module": "index.mjs", 13 | "types": "index.d.ts", 14 | "sideEffects": false, 15 | "scripts": { 16 | "build": "ts-node scripts/download-crd.ts && crd-generate && publish-scripts build", 17 | "prepack": "publish-scripts prepack" 18 | }, 19 | "publishConfig": { 20 | "access": "public", 21 | "directory": "dist", 22 | "linkDirectory": true 23 | }, 24 | "keywords": [ 25 | "kubernetes", 26 | "kubernetes-models", 27 | "linkerd" 28 | ], 29 | "engines": { 30 | "node": ">=14" 31 | }, 32 | "dependencies": { 33 | "@kubernetes-models/apimachinery": "workspace:^", 34 | "@kubernetes-models/base": "workspace:^", 35 | "@kubernetes-models/validate": "workspace:^", 36 | "@swc/helpers": "^0.5.8" 37 | }, 38 | "devDependencies": { 39 | "@kubernetes-models/crd-generate": "workspace:^", 40 | "@kubernetes-models/publish-scripts": "workspace:^", 41 | "@kubernetes-models/read-input": "workspace:^", 42 | "@types/js-yaml": "^4.0.5", 43 | "@types/node": "^18.7.23", 44 | "execa": "^5.1.1", 45 | "js-yaml": "^4.1.0", 46 | "ts-node": "^10.9.1", 47 | "typescript": "^4.8.4", 48 | "vitest": "^0.29.8" 49 | }, 50 | "crd-generate": { 51 | "input": [ 52 | "./crds/crd.yaml" 53 | ], 54 | "output": "./gen" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /third-party/linkerd/scripts/download-crd.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable node/no-unpublished-import */ 2 | import execa from "execa"; 3 | import { mkdir, writeFile } from "fs/promises"; 4 | import yaml from "js-yaml"; 5 | import { dirname, join } from "path"; 6 | 7 | const outputPath = join(__dirname, "../crds/crd.yaml"); 8 | 9 | function isObject(obj: unknown): obj is Record { 10 | return typeof obj === "object" && obj != null; 11 | } 12 | 13 | async function render(name: string, version: string): Promise { 14 | const result = await execa("helm", [ 15 | "template", 16 | "--repo", 17 | "https://helm.linkerd.io/edge", 18 | name, 19 | name, 20 | "--version", 21 | version 22 | ]); 23 | 24 | return result.stdout; 25 | } 26 | 27 | (async () => { 28 | const commands = [ 29 | await render("linkerd-crds", "2024.11.8"), 30 | await render("linkerd-multicluster", "2024.11.8") 31 | ]; 32 | const manifests = yaml.loadAll(commands.join("---\n")); 33 | const chunks: string[] = []; 34 | 35 | for (const manifest of manifests) { 36 | if ( 37 | isObject(manifest) && 38 | manifest.kind === "CustomResourceDefinition" && 39 | isObject(manifest.metadata) && 40 | typeof manifest.metadata.name === "string" && 41 | !manifest.metadata.name.endsWith("networking.k8s.io") 42 | ) { 43 | chunks.push(yaml.dump(manifest)); 44 | } 45 | } 46 | 47 | await mkdir(dirname(outputPath), { recursive: true }); 48 | await writeFile(outputPath, chunks.join("---\n")); 49 | })(); 50 | -------------------------------------------------------------------------------- /third-party/linkerd/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /third-party/longhorn/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/longhorn 2 | 3 | ## 0.1.2 4 | 5 | ### Patch Changes 6 | 7 | - [#220](https://github.com/tommy351/kubernetes-models-ts/pull/220) [`de414dd`](https://github.com/tommy351/kubernetes-models-ts/commit/de414ddbb16d37da1e88c2aacb5ce4f57cec2d02) Thanks [@RealityAnomaly](https://github.com/RealityAnomaly)! - Set model-defined props outside constructor to ensure `useDefineForClassFields` compatibility. 8 | 9 | - Updated dependencies [[`de414dd`](https://github.com/tommy351/kubernetes-models-ts/commit/de414ddbb16d37da1e88c2aacb5ce4f57cec2d02)]: 10 | - @kubernetes-models/base@5.0.1 11 | - @kubernetes-models/apimachinery@2.0.2 12 | 13 | ## 0.1.1 14 | 15 | ### Patch Changes 16 | 17 | - [#216](https://github.com/tommy351/kubernetes-models-ts/pull/216) [`db67b32`](https://github.com/tommy351/kubernetes-models-ts/commit/db67b3253d21d4247a50109ef9f18c2345d7ce7f) Thanks [@RealityAnomaly](https://github.com/RealityAnomaly)! - Append `/index` to generated paths to ensure correct import handling. 18 | 19 | - Updated dependencies [[`db67b32`](https://github.com/tommy351/kubernetes-models-ts/commit/db67b3253d21d4247a50109ef9f18c2345d7ce7f)]: 20 | - @kubernetes-models/apimachinery@2.0.1 21 | 22 | ## 0.1.0 23 | 24 | ### Minor Changes 25 | 26 | - [#211](https://github.com/tommy351/kubernetes-models-ts/pull/211) [`ae61eda`](https://github.com/tommy351/kubernetes-models-ts/commit/ae61eda8999f97dc71d752314d5d831d85bf33c2) Thanks [@alexandre-dos-reis](https://github.com/alexandre-dos-reis)! - First release. 27 | -------------------------------------------------------------------------------- /third-party/longhorn/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/longhorn 2 | 3 | [Longhorn](https://longhorn.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/longhorn 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Backup } from "@kubernetes-models/longhorn/longhorn.io/v1beta1/Backup"; 17 | 18 | // Create a new Backup 19 | const backup = new Backup({ 20 | metadata: { 21 | name: "backup" 22 | }, 23 | spec: { 24 | backupMode: "incremental", 25 | snapshotName: "snapshot-name-example", 26 | labels: { 27 | app: "test" 28 | } 29 | } 30 | }); 31 | 32 | // Validate against JSON schema 33 | backup.validate(); 34 | ``` 35 | 36 | ## License 37 | 38 | MIT 39 | -------------------------------------------------------------------------------- /third-party/longhorn/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { Backup } from "../gen/longhorn.io/v1beta1/Backup"; 3 | 4 | describe("Application", () => { 5 | let backup: Backup; 6 | 7 | beforeEach(() => { 8 | backup = new Backup({ 9 | metadata: { 10 | name: "backup" 11 | }, 12 | spec: { 13 | backupMode: "incremental", 14 | snapshotName: "snapshot-name-example", 15 | labels: { 16 | app: "test" 17 | } 18 | } 19 | }); 20 | }); 21 | 22 | it("should set apiVersion", () => { 23 | expect(backup).toHaveProperty("apiVersion", "longhorn.io/v1beta1"); 24 | }); 25 | 26 | it("should set kind", () => { 27 | expect(backup).toHaveProperty("kind", "Backup"); 28 | }); 29 | 30 | it("validate", () => { 31 | expect(() => backup.validate()).not.toThrow(); 32 | }); 33 | 34 | it("toJSON", () => { 35 | expect(backup.toJSON()).toEqual({ 36 | apiVersion: "longhorn.io/v1beta1", 37 | kind: "Backup", 38 | metadata: { 39 | name: "backup" 40 | }, 41 | spec: { 42 | backupMode: "incremental", 43 | snapshotName: "snapshot-name-example", 44 | labels: { 45 | app: "test" 46 | } 47 | } 48 | }); 49 | }); 50 | }); 51 | -------------------------------------------------------------------------------- /third-party/longhorn/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/longhorn", 3 | "version": "0.1.2", 4 | "description": "Longhorn models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/longhorn", 10 | "author": "Alexandre Dos Reis ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "longhorn" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://github.com/longhorn/longhorn/releases/download/v1.7.2/longhorn.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third-party/longhorn/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } -------------------------------------------------------------------------------- /third-party/nats/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/nats", 3 | "version": "0.2.2", 4 | "description": "NATS models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/nats", 10 | "author": "Yz C ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "nats" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://github.com/nats-io/nack/releases/download/v0.14.0/crds.yml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } -------------------------------------------------------------------------------- /third-party/nats/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } -------------------------------------------------------------------------------- /third-party/opentelemetry-operator/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/opentelemetry-operator 2 | 3 | ## 0.1.0 4 | 5 | ### Minor Changes 6 | 7 | - [#228](https://github.com/tommy351/kubernetes-models-ts/pull/228) [`95d4b3d`](https://github.com/tommy351/kubernetes-models-ts/commit/95d4b3d72dd7a1b7dfbb07d7aea1223430107fb2) Thanks [@anacelto](https://github.com/anacelto)! - First release. 8 | -------------------------------------------------------------------------------- /third-party/opentelemetry-operator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/opentelemetry-operator", 3 | "version": "0.1.0", 4 | "description": "OpenTelemetry Operator models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/opentelemetry-operator", 10 | "author": "Oriol Mari ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "opentelemetry-operator" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://github.com/open-telemetry/opentelemetry-operator/releases/download/v0.124.0/opentelemetry-operator.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third-party/opentelemetry-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } -------------------------------------------------------------------------------- /third-party/pipelines-as-code/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/pipelines-as-code 2 | 3 | [Pipelines-as-Code](https://pipelinesascode.com/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/pipelines-as-code 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Repository } from "@kubernetes-models/pipelines-as-code/pipelinesascode.tekton.dev/v1alpha1/Repository"; 17 | 18 | // Create a new Application 19 | const repository = new Repository({ 20 | metadata: { 21 | name: "pac-repo" 22 | }, 23 | spec: { 24 | url: "https://github.com/linda/project", 25 | git_provider: { 26 | secret: { 27 | name: 'my-secret', 28 | key: 'repo-secret', 29 | }, 30 | webhook_secret: { 31 | name: 'my-secret', 32 | key: 'webhook-secret', 33 | }, 34 | }, 35 | }, 36 | }); 37 | 38 | // Validate against JSON schema 39 | app.validate(); 40 | ``` 41 | 42 | ## License 43 | 44 | MIT 45 | -------------------------------------------------------------------------------- /third-party/pipelines-as-code/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/pipelines-as-code", 3 | "version": "0.2.2", 4 | "description": "Pipelines-as-Code models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/pipelines-as-code", 10 | "author": "Christoph Jerolimov ", 11 | "license": "MIT", 12 | "main": "index.cjs", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "tekton", 29 | "tektoncd", 30 | "pipelines-as-code" 31 | ], 32 | "engines": { 33 | "node": ">=14" 34 | }, 35 | "dependencies": { 36 | "@kubernetes-models/apimachinery": "workspace:^", 37 | "@kubernetes-models/base": "workspace:^", 38 | "@kubernetes-models/validate": "workspace:^", 39 | "@swc/helpers": "^0.5.8" 40 | }, 41 | "devDependencies": { 42 | "@kubernetes-models/crd-generate": "workspace:^", 43 | "@kubernetes-models/publish-scripts": "workspace:^", 44 | "vitest": "^0.29.8" 45 | }, 46 | "crd-generate": { 47 | "input": [ 48 | "https://raw.githubusercontent.com/openshift-pipelines/pipelines-as-code/v0.21.1/config/300-repositories.yaml" 49 | ], 50 | "output": "./gen" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /third-party/pipelines-as-code/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/postgres-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/prometheus-operator/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/prometheus-operator 2 | 3 | [Prometheus operator](https://github.com/prometheus-operator/prometheus-operator/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/prometheus-operator 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { ServiceMonitor } from "@kubernetes-models/prometheus-operator/monitoring.coreos.com/v1/ServiceMonitor"; 17 | 18 | const monitor = new ServiceMonitor({ 19 | metadata: { 20 | name: "my-service-monitor" 21 | }, 22 | spec: { 23 | selector: { 24 | matchLabels: { 25 | app: "some-app" 26 | } 27 | }, 28 | endpoints: [ 29 | { 30 | port: web 31 | } 32 | ] 33 | } 34 | }); 35 | 36 | // Validate against JSON schema 37 | monitor.validate(); 38 | ``` 39 | 40 | ## License 41 | 42 | MIT 43 | -------------------------------------------------------------------------------- /third-party/prometheus-operator/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { ServiceMonitor } from "../gen/monitoring.coreos.com/v1/ServiceMonitor"; 3 | 4 | describe("ServiceMonitor", () => { 5 | let config: ServiceMonitor; 6 | 7 | beforeEach(() => { 8 | config = new ServiceMonitor({ 9 | metadata: { 10 | name: "test" 11 | }, 12 | spec: { 13 | selector: { 14 | matchLabels: { 15 | app: "some-app" 16 | } 17 | }, 18 | endpoints: [ 19 | { 20 | port: "web" 21 | } 22 | ] 23 | } 24 | }); 25 | }); 26 | 27 | it("should set apiVersion", () => { 28 | expect(config).toHaveProperty("apiVersion", "monitoring.coreos.com/v1"); 29 | }); 30 | 31 | it("should set kind", () => { 32 | expect(config).toHaveProperty("kind", "ServiceMonitor"); 33 | }); 34 | 35 | it("should set metadata", () => { 36 | expect(config.metadata).toEqual({ name: "test" }); 37 | }); 38 | 39 | it("toJSON", () => { 40 | expect(config.toJSON()).toEqual({ 41 | apiVersion: "monitoring.coreos.com/v1", 42 | kind: "ServiceMonitor", 43 | metadata: { 44 | name: "test" 45 | }, 46 | spec: { 47 | selector: { 48 | matchLabels: { 49 | app: "some-app" 50 | } 51 | }, 52 | endpoints: [ 53 | { 54 | port: "web" 55 | } 56 | ] 57 | } 58 | }); 59 | }); 60 | }); 61 | -------------------------------------------------------------------------------- /third-party/prometheus-operator/__tests__/validate.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect } from "vitest"; 2 | import { ServiceMonitor } from "../gen/monitoring.coreos.com/v1/ServiceMonitor"; 3 | 4 | describe("validate", () => { 5 | describe("when validation passed", () => { 6 | it("should pass", () => { 7 | const config = new ServiceMonitor({ 8 | spec: { 9 | selector: { 10 | matchLabels: { 11 | app: "some-app" 12 | } 13 | }, 14 | endpoints: [ 15 | { 16 | port: "web" 17 | } 18 | ] 19 | } 20 | }); 21 | 22 | expect(() => config.validate()).not.toThrow(); 23 | }); 24 | }); 25 | 26 | describe("when validation failed", () => { 27 | it("should throw an error", () => { 28 | const config = new ServiceMonitor({ 29 | spec: { 30 | // @ts-expect-error 31 | selector: "some-app", 32 | endpoints: [] 33 | } 34 | }); 35 | 36 | expect(() => config.validate()).toThrow( 37 | "data/spec/selector must be object" 38 | ); 39 | }); 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /third-party/prometheus-operator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/prometheus-operator", 3 | "version": "4.4.2", 4 | "description": "Kubernetes prometheus-operator models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/prometheus-operator", 10 | "author": "Julien Bouquillon ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "prometheus", 29 | "prometheus-operator" 30 | ], 31 | "dependencies": { 32 | "@kubernetes-models/apimachinery": "workspace:^", 33 | "@kubernetes-models/base": "workspace:^", 34 | "@kubernetes-models/validate": "workspace:^", 35 | "@swc/helpers": "^0.5.8" 36 | }, 37 | "devDependencies": { 38 | "@kubernetes-models/crd-generate": "workspace:^", 39 | "@kubernetes-models/publish-scripts": "workspace:^", 40 | "vitest": "^0.29.8" 41 | }, 42 | "crd-generate": { 43 | "input": [ 44 | "https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.65.1/stripped-down-crds.yaml" 45 | ], 46 | "output": "./gen" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /third-party/prometheus-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/rabbitmq-cluster-operator/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/rabbitmq-cluster-operator 2 | 3 | [RabbitMQ Cluster Operator](https://github.com/rabbitmq/cluster-operator) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/rabbitmq-cluster-operator 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { RabbitmqCluster } from "@kubernetes-models/rabbitmq-cluster-operator/rabbitmq.com/v1beta1/RabbitmqCluster"; 17 | 18 | // Create a new RabbitmqCluster 19 | const cluster = new RabbitmqCluster({ 20 | metadata: { name: "example" }, 21 | spec: { 22 | replicas: 3, 23 | service: { 24 | type: "LoadBalancer" 25 | } 26 | } 27 | }); 28 | 29 | // Validate against JSON schema 30 | cluster.validate(); 31 | ``` 32 | 33 | ## License 34 | 35 | See [LICENSE](../../LICENSE) 36 | -------------------------------------------------------------------------------- /third-party/rabbitmq-cluster-operator/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { RabbitmqCluster } from "../gen/rabbitmq.com/v1beta1/RabbitmqCluster"; 3 | 4 | describe("RabbitmqCluster", () => { 5 | let cluster: RabbitmqCluster; 6 | 7 | beforeEach(() => { 8 | cluster = new RabbitmqCluster({ 9 | metadata: { 10 | name: "example" 11 | }, 12 | spec: { 13 | replicas: 2, 14 | service: { 15 | type: "ClusterIP" 16 | }, 17 | persistence: { 18 | storageClassName: "standard", 19 | storage: "10Gi" 20 | }, 21 | rabbitmq: { 22 | additionalPlugins: ["rabbitmq_peer_discovery_k8s"] 23 | } 24 | } 25 | }); 26 | }); 27 | 28 | it("should set apiVersion", () => { 29 | expect(cluster).toHaveProperty("apiVersion", "rabbitmq.com/v1beta1"); 30 | }); 31 | 32 | it("should set kind", () => { 33 | expect(cluster).toHaveProperty("kind", "RabbitmqCluster"); 34 | }); 35 | 36 | it("validate", () => { 37 | expect(() => cluster.validate()).not.toThrow(); 38 | }); 39 | 40 | it("toJSON", () => { 41 | expect(cluster.toJSON()).toEqual({ 42 | apiVersion: "rabbitmq.com/v1beta1", 43 | kind: "RabbitmqCluster", 44 | metadata: { 45 | name: "example" 46 | }, 47 | spec: { 48 | replicas: 2, 49 | service: { 50 | type: "ClusterIP" 51 | }, 52 | persistence: { 53 | storageClassName: "standard", 54 | storage: "10Gi" 55 | }, 56 | rabbitmq: { 57 | additionalPlugins: ["rabbitmq_peer_discovery_k8s"] 58 | } 59 | } 60 | }); 61 | }); 62 | }); 63 | -------------------------------------------------------------------------------- /third-party/rabbitmq-cluster-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/rabbitmq-messaging-topology-operator/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/rabbitmq-messaging-topology-operator 2 | 3 | [RabbitMQ Messaging Topology Operator](https://github.com/rabbitmq/messaging-topology-operator) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/rabbitmq-messaging-topology-operator 11 | ``` 12 | 13 | ## Usage 14 | 15 | See [test](./__tests__/class.ts) for example usage. 16 | 17 | ## License 18 | 19 | See [LICENSE](../../LICENSE). 20 | -------------------------------------------------------------------------------- /third-party/rabbitmq-messaging-topology-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/redis-operator/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/redis-operator 2 | 3 | [Redis Operator](https://ot-container-kit.github.io/redis-operator/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/redis-operator 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { RedisCluster } from "@kubernetes-models/redis-operator/redis.redis.opstreelabs.in/v1beta1/RedisCluster"; 17 | 18 | const cluster = new RedisCluster({ 19 | metadata: { name: "example" }, 20 | spec: { 21 | clusterSize: 3, 22 | clusterVersion: "v7", 23 | persistenceEnabled: true, 24 | kubernetesConfig: { 25 | image: "quay.io/opstree/redis:v7.0.5" 26 | } 27 | } 28 | }); 29 | 30 | // Validate against JSON schema 31 | cluster.validate(); 32 | ``` 33 | 34 | ## License 35 | 36 | MIT 37 | -------------------------------------------------------------------------------- /third-party/redis-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/sealed-secrets/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/sealed-secrets 2 | 3 | [Sealed Secrets](https://github.com/bitnami-labs/sealed-secrets/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/sealed-secrets 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { SealedSecret } from "@kubernetes-models/sealed-secrets/bitnami.com/v1alpha1/SealedSecret"; 17 | 18 | const secret = new SealedSecret({ 19 | metadata: { 20 | name: "my-secret" 21 | }, 22 | spec: { 23 | encryptedData: { 24 | foo: "AgBy3i4OJSWK+PiTySYZZA9rO43cGDEq" 25 | } 26 | } 27 | }); 28 | 29 | // Validate against JSON schema 30 | secret.validate(); 31 | ``` 32 | 33 | ## License 34 | 35 | MIT 36 | -------------------------------------------------------------------------------- /third-party/sealed-secrets/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { SealedSecret } from "../gen/bitnami.com/v1alpha1/SealedSecret"; 3 | 4 | describe("SealedSecret", () => { 5 | let secret: SealedSecret; 6 | 7 | beforeEach(() => { 8 | secret = new SealedSecret({ 9 | metadata: { 10 | name: "test" 11 | }, 12 | spec: { 13 | encryptedData: { 14 | foo: "bar" 15 | } 16 | } 17 | }); 18 | }); 19 | 20 | it("should set apiVersion", () => { 21 | expect(secret).toHaveProperty("apiVersion", "bitnami.com/v1alpha1"); 22 | }); 23 | 24 | it("should set kind", () => { 25 | expect(secret).toHaveProperty("kind", "SealedSecret"); 26 | }); 27 | 28 | it("should set metadata", () => { 29 | expect(secret.metadata).toEqual({ name: "test" }); 30 | }); 31 | 32 | it("toJSON", () => { 33 | expect(secret.toJSON()).toEqual({ 34 | apiVersion: "bitnami.com/v1alpha1", 35 | kind: "SealedSecret", 36 | metadata: { 37 | name: "test" 38 | }, 39 | spec: { 40 | encryptedData: { 41 | foo: "bar" 42 | } 43 | } 44 | }); 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /third-party/sealed-secrets/__tests__/validate.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect } from "vitest"; 2 | import { SealedSecret } from "../gen/bitnami.com/v1alpha1/SealedSecret"; 3 | 4 | describe("validate", () => { 5 | describe("when validation passed", () => { 6 | it("should pass", () => { 7 | const config = new SealedSecret({ 8 | spec: { 9 | encryptedData: { 10 | foo: "12345679" 11 | } 12 | } 13 | }); 14 | 15 | expect(() => config.validate()).not.toThrow(); 16 | }); 17 | }); 18 | 19 | describe("when validation failed", () => { 20 | it("should throw an error", () => { 21 | const config = new SealedSecret({ 22 | spec: { 23 | // @ts-expect-error 24 | encryptedData: "sdf" 25 | } 26 | }); 27 | 28 | expect(() => config.validate()).toThrow( 29 | "data/spec/encryptedData must be object" 30 | ); 31 | }); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /third-party/sealed-secrets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/sealed-secrets", 3 | "version": "4.4.2", 4 | "description": "Kubernetes sealed-secrets models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/sealed-secrets", 10 | "author": "Douglas Duteil (https://douglasduteil.github.io)", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "sealed-secrets" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://github.com/bitnami-labs/sealed-secrets/releases/download/v0.20.5/controller.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third-party/sealed-secrets/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/seldon-core-operator/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/seldon-core-operator 2 | 3 | [SeldonCore operator](https://github.com/SeldonIO/seldon-core/tree/v1.15.0/helm-charts/seldon-core-operator) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/seldon-core-operator 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { SeldonDeployment } from "@kubernetes-models/seldon-core-operator/machinelearning.seldon.io/v1/SeldonDeployment"; 17 | 18 | // Create a new SeldonDeployment 19 | const deployment = new SeldonDeployment({ 20 | metadata: { name: "example" }, 21 | spec: { 22 | predictors: [ 23 | { 24 | name: "example", 25 | graph: { 26 | name: "classifier", 27 | children: [], 28 | endpoint: { 29 | type: "REST", 30 | }, 31 | type: "MODEL", 32 | }, 33 | } 34 | ] 35 | } 36 | }) 37 | 38 | // Validate against JSON schema 39 | deployment.validate(); 40 | ``` 41 | 42 | ## License 43 | 44 | See [LICENSE](../../LICENSE) 45 | -------------------------------------------------------------------------------- /third-party/seldon-core-operator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/seldon-core-operator", 3 | "version": "0.3.2", 4 | "description": "seldon core operator", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/seldon-core-operator", 10 | "author": "chris Hsieh ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "seldon-core-operator" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://raw.githubusercontent.com/SeldonIO/seldon-core/v1.15.0/operator/config/crd/bases/machinelearning.seldon.io_seldondeployments.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third-party/seldon-core-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/shipwright/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/shipwright 2 | 3 | [Shipwright](https://shipwright.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/shipwright 11 | ``` 12 | 13 | ## Usage 14 | 15 | Models contains the v1alpha1 version for the Shipwright Operator up to version 0.11 and the v1beta1 version that is part of the Shipwright Operator version 0.12+. 16 | 17 | ```js 18 | import { Build } from "@kubernetes-models/shipwright/shipwright.io/v1beta1/Build"; 19 | import { BuildRun } from "@kubernetes-models/shipwright/shipwright.io/v1beta1/BuildRun"; 20 | 21 | // Create a new Build 22 | const build = new Build({ 23 | metadata: { 24 | name: "buildah-golang-build", 25 | }, 26 | spec: { 27 | strategy: { 28 | kind: 'ClusterBuildStrategy', 29 | name: 'buildah', 30 | }, 31 | source: { 32 | git: { 33 | url: 'https://github.com/shipwright-io/sample-go', 34 | }, 35 | contextDir: 'docker-build', 36 | }, 37 | output: { 38 | image: 'registry/namespace/image:latest', 39 | }, 40 | }, 41 | }); 42 | 43 | // Validate against JSON schema 44 | build.validate(); 45 | 46 | // Create a BuildRun that links that Build 47 | const buildRun = new Build({ 48 | metadata: { 49 | generateName: "buildah-golang-build-", 50 | }, 51 | spec: { 52 | build: { 53 | name: 'buildah-golang-build', 54 | }, 55 | }, 56 | }); 57 | 58 | // Validate against JSON schema 59 | buildRun.validate(); 60 | ``` 61 | 62 | ## License 63 | 64 | MIT 65 | -------------------------------------------------------------------------------- /third-party/shipwright/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/smi/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/smi 2 | 3 | [Service Mesh Interface (SMI)](https://smi-spec.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/smi 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```ts 16 | import { TrafficSplit } from "@kubernetes-models/smi/split.smi-spec.io/v1alpha4/TrafficSplit"; 17 | 18 | // Create a new TrafficSplit 19 | const split = new TrafficSplit({ 20 | metadata: { name: "example" }, 21 | spec: { 22 | service: "example", 23 | backends: [ 24 | { service: "example-v1", weight: 90 }, 25 | { service: "example-v2", weight: 10 } 26 | ] 27 | } 28 | }); 29 | 30 | // Validate against JSON schema 31 | split.validate(); 32 | ``` 33 | 34 | ## License 35 | 36 | MIT 37 | -------------------------------------------------------------------------------- /third-party/smi/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { TrafficSplit } from "../gen/split.smi-spec.io/v1alpha4/TrafficSplit"; 3 | 4 | describe("TrafficSplit", () => { 5 | let repository: TrafficSplit; 6 | 7 | beforeEach(() => { 8 | repository = new TrafficSplit({ 9 | metadata: { name: "example" }, 10 | spec: { 11 | service: "example", 12 | backends: [ 13 | { service: "example-v1", weight: 90 }, 14 | { service: "example-v2", weight: 10 } 15 | ] 16 | } 17 | }); 18 | }); 19 | 20 | it("should set apiVersion", () => { 21 | expect(repository).toHaveProperty( 22 | "apiVersion", 23 | "split.smi-spec.io/v1alpha4" 24 | ); 25 | }); 26 | 27 | it("should set kind", () => { 28 | expect(repository).toHaveProperty("kind", "TrafficSplit"); 29 | }); 30 | 31 | it("validate", () => { 32 | expect(() => repository.validate()).not.toThrow(); 33 | }); 34 | 35 | it("toJSON", () => { 36 | expect(repository.toJSON()).toEqual({ 37 | apiVersion: "split.smi-spec.io/v1alpha4", 38 | kind: "TrafficSplit", 39 | metadata: { name: "example" }, 40 | spec: { 41 | service: "example", 42 | backends: [ 43 | { service: "example-v1", weight: 90 }, 44 | { service: "example-v2", weight: 10 } 45 | ] 46 | } 47 | }); 48 | }); 49 | }); 50 | -------------------------------------------------------------------------------- /third-party/smi/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } -------------------------------------------------------------------------------- /third-party/spicedb/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/spicedb 2 | 3 | [SpiceDB](https://authzed.com/docs) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/spicedb 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { SpiceDBCluster } from '@kubernetes-models/spicedb/authzed.com/v1alpha1/SpiceDBCluster'; 17 | 18 | // create the spiceDB cluster 19 | const cluster = new SpiceDBCluster({ 20 | metadata: { 21 | name: "dev" 22 | }, 23 | spec: { 24 | channel: 'stable', 25 | version: 'v1.14.0', 26 | config: { 27 | datastoreEngine: 'memory', 28 | }, 29 | secretName: 'dev-spicedb-secret', 30 | }, 31 | }); 32 | 33 | // Validate against JSON schema 34 | cluster.validate(); 35 | ``` 36 | 37 | ## License 38 | 39 | MIT 40 | -------------------------------------------------------------------------------- /third-party/spicedb/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { SpiceDBCluster } from "../gen/authzed.com/v1alpha1/SpiceDBCluster"; 3 | 4 | describe("SpiceDBCluster", () => { 5 | let cluster: SpiceDBCluster; 6 | 7 | beforeEach(() => { 8 | cluster = new SpiceDBCluster({ 9 | metadata: { 10 | name: "dev" 11 | }, 12 | spec: { 13 | channel: "stable", 14 | version: "v1.14.0", 15 | config: { 16 | datastoreEngine: "memory" 17 | }, 18 | secretName: "dev-spicedb-secret" 19 | } 20 | }); 21 | }); 22 | 23 | it("should set apiVersion", () => { 24 | expect(cluster).toHaveProperty("apiVersion", "authzed.com/v1alpha1"); 25 | }); 26 | 27 | it("should set kind", () => { 28 | expect(cluster).toHaveProperty("kind", "SpiceDBCluster"); 29 | }); 30 | 31 | it("validate", () => { 32 | expect(() => cluster.validate()).not.toThrow(); 33 | }); 34 | 35 | it("toJSON", () => { 36 | expect(cluster.toJSON()).toEqual({ 37 | apiVersion: "authzed.com/v1alpha1", 38 | kind: "SpiceDBCluster", 39 | metadata: { 40 | name: "dev" 41 | }, 42 | spec: { 43 | channel: "stable", 44 | version: "v1.14.0", 45 | config: { 46 | datastoreEngine: "memory" 47 | }, 48 | secretName: "dev-spicedb-secret" 49 | } 50 | }); 51 | }); 52 | }); 53 | -------------------------------------------------------------------------------- /third-party/spicedb/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/spicedb", 3 | "version": "0.2.2", 4 | "description": "SpiceDB models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/spicedb", 10 | "author": "benjamin99 ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "spicedb" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://github.com/authzed/spicedb-operator/releases/download/v1.12.0/bundle.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } -------------------------------------------------------------------------------- /third-party/spicedb/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } -------------------------------------------------------------------------------- /third-party/spiffe/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/spiffe 2 | 3 | [SPIFFE](https://spiffe.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/spiffe 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { SpiffeID } from "@kubernetes-models/spiffe/spiffeid.spiffe.io/v1beta1/SpiffeID"; 17 | 18 | const id = new SpiffeID({ 19 | metadata: { 20 | name: "test-id" 21 | }, 22 | spec: { 23 | parentId: 'spiffe://example.org/spire/server', 24 | spiffeId: 'spiffe://example.org/test', 25 | selector: { 26 | namespace: 'default', 27 | podName: 'test-pod' 28 | }, 29 | } 30 | }); 31 | 32 | // Validate against JSON schema 33 | id.validate(); 34 | ``` 35 | 36 | ## License 37 | 38 | MIT 39 | -------------------------------------------------------------------------------- /third-party/spiffe/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { SpiffeID } from "../gen/spiffeid.spiffe.io/v1beta1/SpiffeID"; 3 | 4 | describe("SpiffeID", () => { 5 | let id: SpiffeID; 6 | 7 | beforeEach(() => { 8 | id = new SpiffeID({ 9 | metadata: { 10 | name: "test-id" 11 | }, 12 | spec: { 13 | parentId: "spiffe://example.org/spire/server", 14 | spiffeId: "spiffe://example.org/test", 15 | selector: { 16 | namespace: "default", 17 | podName: "test-pod" 18 | } 19 | } 20 | }); 21 | }); 22 | 23 | it("should set apiVersion", () => { 24 | expect(id).toHaveProperty("apiVersion", "spiffeid.spiffe.io/v1beta1"); 25 | }); 26 | 27 | it("should set kind", () => { 28 | expect(id).toHaveProperty("kind", "SpiffeID"); 29 | }); 30 | 31 | it("should set metadata", () => { 32 | expect(id.metadata).toEqual({ name: "test-id" }); 33 | }); 34 | 35 | it("toJSON", () => { 36 | expect(id.toJSON()).toEqual({ 37 | apiVersion: "spiffeid.spiffe.io/v1beta1", 38 | kind: "SpiffeID", 39 | metadata: { 40 | name: "test-id" 41 | }, 42 | spec: { 43 | parentId: "spiffe://example.org/spire/server", 44 | spiffeId: "spiffe://example.org/test", 45 | selector: { 46 | namespace: "default", 47 | podName: "test-pod" 48 | } 49 | } 50 | }); 51 | }); 52 | }); 53 | -------------------------------------------------------------------------------- /third-party/spiffe/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/spiffe", 3 | "version": "1.2.2", 4 | "description": "SPIFFE models", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/spiffe", 10 | "author": "Tommy Chen =14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://raw.githubusercontent.com/spiffe/spire/v1.3.1/support/k8s/k8s-workload-registrar/mode-crd/config/spiffeid.spiffe.io_spiffeids.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third-party/spiffe/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/thanos-operator/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/thanos-operator 2 | 3 | [Thanos operator](https://github.com/banzaicloud/thanos-operator) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/thanos-operator 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { Thanos } from "@kubernetes-models/thanos-operator/monitoring.banzaicloud.io/v1alpha1/Thanos"; 17 | 18 | // Create a new Thanos 19 | const thanos = new Thanos({ 20 | metadata: { name: "example" }, 21 | spec: { 22 | query: {}, 23 | rule: {}, 24 | storeGateway: {} 25 | } 26 | }); 27 | 28 | // Validate against JSON schema 29 | thanos.validate(); 30 | ``` 31 | 32 | ## License 33 | 34 | See [LICENSE](../../LICENSE) 35 | -------------------------------------------------------------------------------- /third-party/thanos-operator/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { Thanos } from "../gen/monitoring.banzaicloud.io/v1alpha1/Thanos"; 3 | 4 | describe("Thanos", () => { 5 | let thanos: Thanos; 6 | 7 | beforeEach(() => { 8 | thanos = new Thanos({ 9 | metadata: { name: "example" }, 10 | spec: { 11 | query: {}, 12 | rule: {}, 13 | storeGateway: {} 14 | } 15 | }); 16 | }); 17 | 18 | it("should set apiVersion", () => { 19 | expect(thanos).toHaveProperty( 20 | "apiVersion", 21 | "monitoring.banzaicloud.io/v1alpha1" 22 | ); 23 | }); 24 | 25 | it("should set kind", () => { 26 | expect(thanos).toHaveProperty("kind", "Thanos"); 27 | }); 28 | 29 | it("validate", () => { 30 | expect(() => thanos.validate()).not.toThrow(); 31 | }); 32 | 33 | it("toJSON", () => { 34 | expect(thanos.toJSON()).toEqual({ 35 | apiVersion: "monitoring.banzaicloud.io/v1alpha1", 36 | kind: "Thanos", 37 | metadata: { name: "example" }, 38 | spec: { 39 | query: {}, 40 | rule: {}, 41 | storeGateway: {} 42 | } 43 | }); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /third-party/thanos-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /third-party/tidb-operator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/tidb-operator", 3 | "description": "TiDB Operator models", 4 | "version": "0.2.2", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/third-party/tidb-operator", 10 | "author": "Jay Chung ", 11 | "license": "MIT", 12 | "main": "index.js", 13 | "module": "index.mjs", 14 | "types": "index.d.ts", 15 | "sideEffects": false, 16 | "scripts": { 17 | "build": "crd-generate && publish-scripts build", 18 | "prepack": "publish-scripts prepack" 19 | }, 20 | "publishConfig": { 21 | "access": "public", 22 | "directory": "dist", 23 | "linkDirectory": true 24 | }, 25 | "keywords": [ 26 | "kubernetes", 27 | "kubernetes-models", 28 | "tidb-operator" 29 | ], 30 | "engines": { 31 | "node": ">=14" 32 | }, 33 | "dependencies": { 34 | "@kubernetes-models/apimachinery": "workspace:^", 35 | "@kubernetes-models/base": "workspace:^", 36 | "@kubernetes-models/validate": "workspace:^", 37 | "@swc/helpers": "^0.5.8" 38 | }, 39 | "devDependencies": { 40 | "@kubernetes-models/crd-generate": "workspace:^", 41 | "@kubernetes-models/publish-scripts": "workspace:^", 42 | "vitest": "^0.29.8" 43 | }, 44 | "crd-generate": { 45 | "input": [ 46 | "https://raw.githubusercontent.com/pingcap/tidb-operator/v1.4.4/manifests/crd.yaml" 47 | ], 48 | "output": "./gen" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third-party/tidb-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /third-party/traefik/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/traefik 2 | 3 | [Traefik](https://traefik.io/) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/traefik 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { IngressRoute } from "@kubernetes-models/traefik/traefik.containo.us/v1alpha1/IngressRoute"; 17 | 18 | // Create a new IngressRoute 19 | const ingressRoute = new IngressRoute({ 20 | metadata: { 21 | name: "test" 22 | }, 23 | spec: { 24 | entryPoints: ["web"], 25 | routes: [ 26 | { 27 | match: "Host(`example.com`)", 28 | kind: "Rule", 29 | services: [ 30 | { 31 | name: "test", 32 | port: 80 33 | } 34 | ] 35 | } 36 | ] 37 | } 38 | }); 39 | 40 | // Validate against JSON schema 41 | ingressRoute.validate(); 42 | ``` 43 | 44 | ## License 45 | 46 | MIT 47 | -------------------------------------------------------------------------------- /third-party/traefik/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": [ 8 | "gen" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /third-party/victoria-metrics-operator/.gitignore: -------------------------------------------------------------------------------- 1 | /crds/ 2 | -------------------------------------------------------------------------------- /third-party/victoria-metrics-operator/README.md: -------------------------------------------------------------------------------- 1 | # @kubernetes-models/victoria-metrics-operator 2 | 3 | [VictoriaMetrics operator](https://github.com/VictoriaMetrics/operator) models. 4 | 5 | ## Installation 6 | 7 | Install with npm. 8 | 9 | ```sh 10 | npm install @kubernetes-models/victoria-metrics-operator 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | import { VMCluster } from "@kubernetes-models/victoria-metrics-operator/operator.victoriametrics.com/v1beta1/VMCluster"; 17 | 18 | // Create a new VMCluster 19 | const cluster = new VMCluster({ 20 | metadata: { name: "example" }, 21 | spec: { 22 | retentionPeriod: "12", 23 | vmstorage: { 24 | replicaCount: 2 25 | } 26 | } 27 | }); 28 | 29 | // Validate against JSON schema 30 | cluster.validate(); 31 | ``` 32 | 33 | ## License 34 | 35 | See [LICENSE](../../LICENSE) 36 | -------------------------------------------------------------------------------- /third-party/victoria-metrics-operator/__tests__/class.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, beforeEach } from "vitest"; 2 | import { VMCluster } from "../gen/operator.victoriametrics.com/v1beta1/VMCluster"; 3 | 4 | describe("VMCluster", () => { 5 | let cluster: VMCluster; 6 | 7 | beforeEach(() => { 8 | cluster = new VMCluster({ 9 | metadata: { name: "example" }, 10 | spec: { 11 | retentionPeriod: "12", 12 | vmstorage: { 13 | replicaCount: 2 14 | } 15 | } 16 | }); 17 | }); 18 | 19 | it("should set apiVersion", () => { 20 | expect(cluster).toHaveProperty( 21 | "apiVersion", 22 | "operator.victoriametrics.com/v1beta1" 23 | ); 24 | }); 25 | 26 | it("should set kind", () => { 27 | expect(cluster).toHaveProperty("kind", "VMCluster"); 28 | }); 29 | 30 | it("validate", () => { 31 | expect(() => cluster.validate()).not.toThrow(); 32 | }); 33 | 34 | it("toJSON", () => { 35 | expect(cluster.toJSON()).toEqual({ 36 | apiVersion: "operator.victoriametrics.com/v1beta1", 37 | kind: "VMCluster", 38 | metadata: { name: "example" }, 39 | spec: { 40 | retentionPeriod: "12", 41 | vmstorage: { 42 | replicaCount: 2 43 | } 44 | } 45 | }); 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /third-party/victoria-metrics-operator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "sourceMap": false 6 | }, 7 | "include": ["gen"] 8 | } 9 | -------------------------------------------------------------------------------- /tsc-multi.json: -------------------------------------------------------------------------------- 1 | { 2 | "targets": [ 3 | { "extname": ".mjs", "module": "esnext" }, 4 | { "extname": ".js", "module": "commonjs" } 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "sourceMap": true 6 | }, 7 | "exclude": ["**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node14/tsconfig.json", 3 | "compilerOptions": { 4 | "noEmitHelpers": true, 5 | "importHelpers": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "globalDependencies": [ 4 | "tsc-multi.json", 5 | "tsconfig.json", 6 | "tsconfig.build.json" 7 | ], 8 | "tasks": { 9 | "build": { 10 | "dependsOn": [ 11 | "^build" 12 | ], 13 | "outputs": [ 14 | "dist/**", 15 | "gen/**", 16 | "*.tsbuildinfo" 17 | ] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /utils/crd-generate/bin/crd-generate.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const cli = require("../dist/cli"); 4 | 5 | cli.run(); 6 | -------------------------------------------------------------------------------- /utils/crd-generate/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/crd-generate", 3 | "version": "5.0.2", 4 | "description": "Generate Kubernetes models for custom resource definitions (CRD).", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/utils/crd-generate", 10 | "author": "Tommy Chen ", 11 | "license": "MIT", 12 | "scripts": { 13 | "build": "tsc-multi --config ../../tsc-multi.json" 14 | }, 15 | "main": "dist/index.js", 16 | "module": "dist/index.mjs", 17 | "types": "dist/index.d.ts", 18 | "sideEffects": false, 19 | "exports": { 20 | "types": "./dist/index.d.ts", 21 | "import": "./dist/index.mjs", 22 | "require": "./dist/index.js" 23 | }, 24 | "bin": { 25 | "crd-generate": "bin/crd-generate.js" 26 | }, 27 | "keywords": [ 28 | "kubernetes", 29 | "kubernetes-models", 30 | "crd" 31 | ], 32 | "publishConfig": { 33 | "access": "public" 34 | }, 35 | "files": [ 36 | "/bin/", 37 | "/dist/" 38 | ], 39 | "engines": { 40 | "node": ">=14" 41 | }, 42 | "dependencies": { 43 | "@kubernetes-models/generate": "workspace:^", 44 | "@kubernetes-models/read-input": "workspace:^", 45 | "@kubernetes-models/string-util": "workspace:^", 46 | "lodash": "^4.17.21", 47 | "tslib": "^2.4.0", 48 | "yaml": "^2.2.2", 49 | "yargs": "^17.6.0" 50 | }, 51 | "devDependencies": { 52 | "@types/lodash": "^4.14.186", 53 | "@types/yargs": "^17.0.13", 54 | "tsc-multi": "^0.6.1", 55 | "typescript": "^4.8.4" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /utils/crd-generate/src/cli.ts: -------------------------------------------------------------------------------- 1 | import yargs from "yargs"; 2 | import { readInput } from "@kubernetes-models/read-input"; 3 | import { generate, GenerateOptions } from "./generate"; 4 | 5 | async function readFiles(paths: string[]): Promise { 6 | const documents: string[] = []; 7 | 8 | for (const path of paths) { 9 | console.log("Reading:", path); 10 | documents.push(await readInput(path)); 11 | } 12 | 13 | return documents.join("\n---\n"); 14 | } 15 | 16 | export async function run(): Promise { 17 | const args = await yargs 18 | .pkgConf("crd-generate") 19 | .option("input", { 20 | type: "array", 21 | describe: "Path of the input file or URL", 22 | string: true, 23 | demandOption: true 24 | }) 25 | .option("output", { 26 | type: "string", 27 | describe: "Path of output files", 28 | demandOption: true 29 | }) 30 | .option("yamlVersion", { 31 | type: "string", 32 | describe: "YAML version.", 33 | choices: ["1.0", "1.1", "1.2"] 34 | }) 35 | .parse(); 36 | 37 | try { 38 | await generate({ 39 | input: await readFiles(args.input), 40 | outputPath: args.output, 41 | yamlVersion: args.yamlVersion as GenerateOptions["yamlVersion"] 42 | }); 43 | } catch (err) { 44 | console.error(err); 45 | // eslint-disable-next-line no-process-exit 46 | process.exit(1); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /utils/crd-generate/src/generators/alias.ts: -------------------------------------------------------------------------------- 1 | import { Generator, OutputFile } from "@kubernetes-models/generate"; 2 | import { set } from "lodash"; 3 | import { camelCase } from "@kubernetes-models/string-util"; 4 | 5 | interface KeyMap { 6 | [key: string]: string | KeyMap; 7 | } 8 | 9 | function generate(map: KeyMap, parent = ""): OutputFile[] { 10 | const path = parent + "index.ts"; 11 | let children: OutputFile[] = []; 12 | let content = ""; 13 | 14 | for (const key of Object.keys(map)) { 15 | const val = map[key]; 16 | 17 | if (typeof val === "string") { 18 | content += `export * from "./${val}";\n`; 19 | } else { 20 | const exportedName = camelCase(key, ".-"); 21 | content += `export * as ${exportedName} from "./${key}/index";\n`; 22 | children = children.concat(generate(val, parent + key + "/")); 23 | } 24 | } 25 | 26 | return [{ path, content }, ...children]; 27 | } 28 | 29 | const generateAliases: Generator = async (definitions) => { 30 | const map: KeyMap = {}; 31 | 32 | for (const def of definitions) { 33 | for (const gvk of def.gvk || []) { 34 | set(map, [gvk.group, gvk.version, gvk.kind], gvk.kind); 35 | } 36 | } 37 | 38 | return generate(map); 39 | }; 40 | 41 | export default generateAliases; 42 | -------------------------------------------------------------------------------- /utils/crd-generate/src/generators/schema.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Generator, 3 | transformSchema, 4 | compileSchema, 5 | OutputFile 6 | } from "@kubernetes-models/generate"; 7 | import { getSchemaPath } from "../utils"; 8 | import { trimSuffix } from "@kubernetes-models/string-util"; 9 | 10 | const generateSchemas: Generator = async (definitions) => { 11 | const files: OutputFile[] = []; 12 | 13 | for (const def of definitions) { 14 | const schema = { ...transformSchema(def.schema), $id: def.schemaId }; 15 | 16 | files.push( 17 | { 18 | path: getSchemaPath(def.schemaId), 19 | content: await compileSchema(schema, { 20 | "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta": 21 | "@kubernetes-models/apimachinery/_schemas/IoK8sApimachineryPkgApisMetaV1ObjectMeta" 22 | }) 23 | }, 24 | // TODO: Move this to @kubernetes-models/generate 25 | { 26 | path: trimSuffix(getSchemaPath(def.schemaId), ".js") + ".d.ts", 27 | content: `export function validate(data: unknown): boolean;` 28 | } 29 | ); 30 | } 31 | 32 | return files; 33 | }; 34 | 35 | export default generateSchemas; 36 | -------------------------------------------------------------------------------- /utils/crd-generate/src/index.ts: -------------------------------------------------------------------------------- 1 | export { generate } from "./generate"; 2 | -------------------------------------------------------------------------------- /utils/crd-generate/src/utils.ts: -------------------------------------------------------------------------------- 1 | import { camelCase, upperFirst } from "@kubernetes-models/string-util"; 2 | import { trimSuffix } from "@kubernetes-models/string-util"; 3 | import { posix } from "path"; 4 | 5 | // TODO: Move to @kubernetes-models/generate 6 | export function getClassName(s: string): string { 7 | return upperFirst(camelCase(s, ".-")); 8 | } 9 | 10 | // TODO: Move to @kubernetes-models/generate 11 | export function getSchemaPath(id: string): string { 12 | return `_schemas/${getClassName(id)}.js`; 13 | } 14 | 15 | // TODO: Move to @kubernetes-models/generate 16 | export function getRelativePath(from: string, to: string): string { 17 | const ext = posix.extname(to); 18 | const path = trimSuffix(posix.relative(posix.dirname(from), to), ext); 19 | 20 | if (!path.startsWith(".")) { 21 | return `./${path}`; 22 | } 23 | 24 | return path; 25 | } 26 | -------------------------------------------------------------------------------- /utils/crd-generate/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src"] 7 | } 8 | -------------------------------------------------------------------------------- /utils/generate/src/import.ts: -------------------------------------------------------------------------------- 1 | export interface Import { 2 | name: string; 3 | alias?: string; 4 | path: string; 5 | } 6 | 7 | export function generateImports(imports: readonly Import[]): string { 8 | const importMap = new Map>(); 9 | 10 | for (const { path, name, alias } of imports) { 11 | let names = importMap.get(path); 12 | 13 | if (!names) { 14 | names = new Set(); 15 | importMap.set(path, names); 16 | } 17 | 18 | if (alias) { 19 | names.add(`${name} as ${alias}`); 20 | } else { 21 | names.add(name); 22 | } 23 | } 24 | 25 | return [...importMap.entries()] 26 | .map( 27 | ([path, names]) => 28 | `import { ${[...names].join(", ")} } from ${JSON.stringify(path)};` 29 | ) 30 | .join("\n"); 31 | } 32 | -------------------------------------------------------------------------------- /utils/generate/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types"; 2 | export * from "./utils"; 3 | export * from "./interface"; 4 | export * from "./import"; 5 | export * from "./schema"; 6 | -------------------------------------------------------------------------------- /utils/generate/src/nullable-ref.ts: -------------------------------------------------------------------------------- 1 | import { type KeywordDefinition, _ } from "ajv"; 2 | import ref from "ajv/dist/vocabularies/core/ref"; 3 | 4 | const keyword: KeywordDefinition = { 5 | keyword: "nullableRef", 6 | schemaType: "string", 7 | errors: false, 8 | code(cxt) { 9 | const { gen, data } = cxt; 10 | 11 | gen.if(_`${data} !== null`); 12 | ref.code(cxt); 13 | gen.endIf(); 14 | } 15 | }; 16 | 17 | export default keyword; 18 | -------------------------------------------------------------------------------- /utils/generate/src/pattern.ts: -------------------------------------------------------------------------------- 1 | import { type KeywordDefinition, str, _, Name } from "ajv"; 2 | import { RE2 } from "re2-wasm"; 3 | 4 | // https://github.com/ajv-validator/ajv/blob/c8b37f448f77448656222a5a5e279432857f7e9f/lib/vocabularies/validation/pattern.ts 5 | const keyword: KeywordDefinition = { 6 | keyword: "pattern", 7 | type: "string", 8 | schemaType: "string", 9 | error: { 10 | message: ({ schemaCode }) => str`must match pattern "${schemaCode}"`, 11 | params: ({ schemaCode }) => _`{pattern: ${schemaCode}}` 12 | }, 13 | code(cxt) { 14 | const { data, schema, it, gen } = cxt; 15 | const u = it.opts.unicodeRegExp ? "u" : ""; 16 | let pattern: Name; 17 | 18 | try { 19 | const re = new RegExp(schema, u); 20 | pattern = gen.scopeValue("pattern", { 21 | key: schema, 22 | ref: re, 23 | code: _`new RegExp(${schema}, ${u})` 24 | }); 25 | } catch { 26 | const re = new RE2(schema, u); 27 | const func = gen.scopeValue("func", { 28 | ref: RE2, 29 | code: _`require("ajv/dist/runtime/re2").default` 30 | }); 31 | pattern = gen.scopeValue("pattern", { 32 | key: schema, 33 | ref: re, 34 | code: _`new ${func}(${schema}, ${u})` 35 | }); 36 | } 37 | 38 | cxt.fail(_`!${pattern}.test(${data})`); 39 | } 40 | }; 41 | 42 | export default keyword; 43 | -------------------------------------------------------------------------------- /utils/generate/src/types.ts: -------------------------------------------------------------------------------- 1 | export interface GroupVersionKind { 2 | group: string; 3 | kind: string; 4 | version: string; 5 | } 6 | 7 | export interface Schema { 8 | description?: string; 9 | type?: string | string[]; 10 | format?: string; 11 | items?: Schema; 12 | $ref?: string | Schema; 13 | properties?: { [key: string]: Schema }; 14 | required?: string[]; 15 | additionalProperties?: Schema; 16 | enum?: any[]; 17 | const?: any; 18 | not?: Schema; 19 | oneOf?: Schema[]; 20 | anyOf?: Schema[]; 21 | allOf?: Schema[]; 22 | nullable?: boolean; 23 | pattern?: string; 24 | [key: string]: any; 25 | } 26 | 27 | export interface Definition { 28 | gvk?: readonly GroupVersionKind[]; 29 | schemaId: string; 30 | schema: Schema; 31 | } 32 | 33 | export interface OutputFile { 34 | path: string; 35 | content: string; 36 | } 37 | 38 | export interface Generator { 39 | (definitions: readonly Definition[]): Promise; 40 | } 41 | 42 | export interface SchemaTransformer { 43 | (schema: Schema): Schema; 44 | } 45 | -------------------------------------------------------------------------------- /utils/generate/src/utils.ts: -------------------------------------------------------------------------------- 1 | import { Generator, GroupVersionKind, OutputFile } from "./types"; 2 | import { outputFile } from "fs-extra"; 3 | import { join } from "path"; 4 | 5 | export class PathConflictError extends Error { 6 | constructor(public path: string) { 7 | super(`Path conflict: ${path}`); 8 | } 9 | } 10 | 11 | PathConflictError.prototype.name = "PathConflictError"; 12 | 13 | export function composeGenerators(generators: readonly Generator[]): Generator { 14 | return async (definitions) => { 15 | const fileMap = new Map(); 16 | 17 | for (const g of generators) { 18 | const files = await g(definitions); 19 | 20 | for (const f of files) { 21 | if (fileMap.has(f.path)) { 22 | throw new PathConflictError(f.path); 23 | } 24 | 25 | fileMap.set(f.path, f); 26 | } 27 | } 28 | 29 | return [...fileMap.values()]; 30 | }; 31 | } 32 | 33 | export async function writeOutputFiles( 34 | outDir: string, 35 | files: readonly OutputFile[] 36 | ): Promise { 37 | for (const f of files) { 38 | console.log("Writing:", f.path); 39 | await outputFile(join(outDir, f.path), f.content); 40 | } 41 | } 42 | 43 | export function getAPIVersion({ group, version }: GroupVersionKind): string { 44 | return group ? `${group}/${version}` : version; 45 | } 46 | -------------------------------------------------------------------------------- /utils/generate/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src"] 7 | } 8 | -------------------------------------------------------------------------------- /utils/openapi-generate/bin/openapi-generate.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const cli = require("../dist/cli"); 4 | 5 | cli.run(); 6 | -------------------------------------------------------------------------------- /utils/openapi-generate/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/openapi-generate", 3 | "version": "5.0.2", 4 | "description": "Generate Kubernetes models from OpenAPI schema.", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 8 | }, 9 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/utils/openapi-generate", 10 | "author": "Tommy Chen ", 11 | "license": "MIT", 12 | "scripts": { 13 | "build": "tsc-multi --config ../../tsc-multi.json" 14 | }, 15 | "main": "dist/index.js", 16 | "module": "dist/index.mjs", 17 | "types": "dist/index.d.ts", 18 | "sideEffects": false, 19 | "exports": { 20 | "types": "./dist/index.d.ts", 21 | "import": "./dist/index.mjs", 22 | "require": "./dist/index.js" 23 | }, 24 | "bin": { 25 | "openapi-generate": "bin/openapi-generate.js" 26 | }, 27 | "publishConfig": { 28 | "access": "public" 29 | }, 30 | "keywords": [ 31 | "kubernetes", 32 | "kubernetes-models", 33 | "openapi" 34 | ], 35 | "files": [ 36 | "/bin/", 37 | "/dist/" 38 | ], 39 | "engines": { 40 | "node": ">=14" 41 | }, 42 | "dependencies": { 43 | "@kubernetes-models/generate": "workspace:^", 44 | "@kubernetes-models/read-input": "workspace:^", 45 | "@kubernetes-models/string-util": "workspace:^", 46 | "lodash": "^4.17.21", 47 | "tslib": "^2.4.0", 48 | "yargs": "^17.6.0" 49 | }, 50 | "devDependencies": { 51 | "@types/lodash": "^4.14.186", 52 | "@types/yargs": "^17.0.13", 53 | "tsc-multi": "^0.6.1", 54 | "typescript": "^4.8.4" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /utils/openapi-generate/src/cli.ts: -------------------------------------------------------------------------------- 1 | import yargs from "yargs"; 2 | import { readInput } from "@kubernetes-models/read-input"; 3 | import { generate } from "./generate"; 4 | import { mergeOpenAPISpecs } from "./utils"; 5 | 6 | async function readFiles(paths: string[]): Promise { 7 | const contents: string[] = []; 8 | 9 | for (const path of paths) { 10 | console.log("Reading:", path); 11 | contents.push(await readInput(path)); 12 | } 13 | 14 | const spec = mergeOpenAPISpecs(contents.map((x) => JSON.parse(x))); 15 | 16 | return JSON.stringify(spec); 17 | } 18 | 19 | export async function run(): Promise { 20 | const args = await yargs 21 | .pkgConf("openapi-generate") 22 | .option("input", { 23 | type: "array", 24 | describe: "Path of the input file or URL", 25 | demandOption: true, 26 | string: true 27 | }) 28 | .option("output", { 29 | type: "string", 30 | describe: "Path of output files", 31 | demandOption: true 32 | }) 33 | .parse(); 34 | 35 | try { 36 | await generate({ 37 | input: await readFiles(args.input), 38 | outputPath: args.output 39 | }); 40 | } catch (err) { 41 | console.error(err); 42 | // eslint-disable-next-line no-process-exit 43 | process.exit(1); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /utils/openapi-generate/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./generate"; 2 | export { mergeOpenAPISpecs, isAPIMachineryID } from "./utils"; 3 | -------------------------------------------------------------------------------- /utils/openapi-generate/src/string.ts: -------------------------------------------------------------------------------- 1 | import { 2 | upperFirst, 3 | camelCase, 4 | trimPrefix 5 | } from "@kubernetes-models/string-util"; 6 | 7 | export function getClassName(s: string): string { 8 | return upperFirst(camelCase(s, ".-")); 9 | } 10 | 11 | export function getInterfaceName(s: string): string { 12 | return "I" + getClassName(s); 13 | } 14 | 15 | export function getShortClassName(s: string): string { 16 | const arr = s.split("."); 17 | return arr[arr.length - 1]; 18 | } 19 | 20 | export function getShortInterfaceName(s: string): string { 21 | return "I" + getShortClassName(s); 22 | } 23 | 24 | export function trimRefPrefix(ref: string): string { 25 | return trimPrefix(ref, "#/definitions/"); 26 | } 27 | -------------------------------------------------------------------------------- /utils/openapi-generate/src/utils.ts: -------------------------------------------------------------------------------- 1 | import { trimSuffix } from "@kubernetes-models/string-util"; 2 | import { posix } from "path"; 3 | import { getClassName } from "./string"; 4 | 5 | export function mergeOpenAPISpecs< 6 | T extends { 7 | definitions?: Record; 8 | } 9 | >(specs: readonly T[]): T { 10 | let result: T = {} as T; 11 | 12 | for (const spec of specs) { 13 | result = { 14 | ...spec, 15 | definitions: { 16 | ...result.definitions, 17 | ...spec.definitions 18 | } 19 | }; 20 | } 21 | 22 | return result; 23 | } 24 | 25 | export function getSchemaPath(id: string): string { 26 | return `_schemas/${getClassName(id)}.js`; 27 | } 28 | 29 | export function getRelativePath(from: string, to: string): string { 30 | const ext = posix.extname(to); 31 | const path = trimSuffix(posix.relative(posix.dirname(from), to), ext); 32 | 33 | if (!path.startsWith(".")) { 34 | return `./${path}`; 35 | } 36 | 37 | return path; 38 | } 39 | 40 | export function isAPIMachineryID(id: string): boolean { 41 | return id.startsWith("io.k8s.apimachinery."); 42 | } 43 | -------------------------------------------------------------------------------- /utils/openapi-generate/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src"] 7 | } 8 | -------------------------------------------------------------------------------- /utils/read-input/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/read-input", 3 | "version": "3.1.1", 4 | "main": "dist/index.js", 5 | "module": "dist/index.mjs", 6 | "types": "dist/index.d.ts", 7 | "sideEffects": false, 8 | "exports": { 9 | "types": "./dist/index.d.ts", 10 | "import": "./dist/index.mjs", 11 | "require": "./dist/index.js" 12 | }, 13 | "scripts": { 14 | "build": "tsc-multi --config ../../tsc-multi.json" 15 | }, 16 | "description": "Read input from file, URL or stdin.", 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 20 | }, 21 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/utils/read-input", 22 | "author": "Tommy Chen ", 23 | "license": "MIT", 24 | "publishConfig": { 25 | "access": "public" 26 | }, 27 | "files": [ 28 | "/dist/" 29 | ], 30 | "keywords": [ 31 | "kubernetes", 32 | "kubernetes-models" 33 | ], 34 | "engines": { 35 | "node": ">=14" 36 | }, 37 | "dependencies": { 38 | "find-cache-dir": "^3.3.2", 39 | "get-stdin": "^8.0.0", 40 | "make-fetch-happen": "^10.2.1", 41 | "tslib": "^2.4.0" 42 | }, 43 | "devDependencies": { 44 | "@types/find-cache-dir": "^3.2.1", 45 | "@types/make-fetch-happen": "^10.0.0", 46 | "tsc-multi": "^0.6.1", 47 | "typescript": "^4.8.4" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /utils/read-input/src/http.ts: -------------------------------------------------------------------------------- 1 | import fetch from "make-fetch-happen"; 2 | import findCacheDir from "find-cache-dir"; 3 | 4 | export async function httpGet(url: string): Promise { 5 | const res = await fetch(url, { 6 | cachePath: findCacheDir({ name: "kubernetes-models-read-input" }) 7 | }); 8 | 9 | if (!res.ok) { 10 | throw new Error(`Request "${url}" failed: ${res.status} ${res.statusText}`); 11 | } 12 | 13 | return res.text(); 14 | } 15 | -------------------------------------------------------------------------------- /utils/read-input/src/index.ts: -------------------------------------------------------------------------------- 1 | export { readInput } from "./read"; 2 | -------------------------------------------------------------------------------- /utils/read-input/src/read.ts: -------------------------------------------------------------------------------- 1 | import getStdin from "get-stdin"; 2 | import { readFile } from "fs/promises"; 3 | import { httpGet } from "./http"; 4 | 5 | const urlRegex = /^https?:\/\//; 6 | 7 | export async function readInput(path: string): Promise { 8 | if (path === "-") { 9 | return getStdin(); 10 | } 11 | 12 | if (urlRegex.test(path)) { 13 | return httpGet(path); 14 | } 15 | 16 | return readFile(path, "utf8"); 17 | } 18 | -------------------------------------------------------------------------------- /utils/read-input/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src"] 7 | } 8 | -------------------------------------------------------------------------------- /utils/string-util/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@kubernetes-models/string-util", 3 | "version": "3.0.1", 4 | "main": "dist/index.js", 5 | "module": "dist/index.mjs", 6 | "types": "dist/index.d.ts", 7 | "sideEffects": false, 8 | "exports": { 9 | "types": "./dist/index.d.ts", 10 | "import": "./dist/index.mjs", 11 | "require": "./dist/index.js" 12 | }, 13 | "scripts": { 14 | "build": "tsc-multi --config ../../tsc-multi.json" 15 | }, 16 | "description": "Utility functions for strings.", 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/tommy351/kubernetes-models-ts.git" 20 | }, 21 | "homepage": "https://github.com/tommy351/kubernetes-models-ts/tree/master/utils/string-util", 22 | "author": "Tommy Chen ", 23 | "license": "MIT", 24 | "publishConfig": { 25 | "access": "public" 26 | }, 27 | "keywords": [ 28 | "kubernetes", 29 | "kubernetes-models" 30 | ], 31 | "files": [ 32 | "/dist/" 33 | ], 34 | "engines": { 35 | "node": ">=14" 36 | }, 37 | "dependencies": { 38 | "tslib": "^2.4.0" 39 | }, 40 | "devDependencies": { 41 | "tsc-multi": "^0.6.1", 42 | "typescript": "^4.8.4" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /utils/string-util/src/comment.ts: -------------------------------------------------------------------------------- 1 | export function formatComment( 2 | content: string, 3 | props: { [key: string]: boolean } = {} 4 | ): string { 5 | let output = "/**\n"; 6 | 7 | for (const line of content.split("\n")) { 8 | output += 9 | " * " + line.replace(/\*/g, "\\*").replace(/\*\//g, "*\\/") + "\n"; 10 | } 11 | 12 | for (const key of Object.keys(props)) { 13 | if (props[key]) output += ` * @${key}\n`; 14 | } 15 | 16 | output += " */\n"; 17 | return output; 18 | } 19 | 20 | export function stripComment(s: string): string { 21 | return s.replace(/\/\*{2}[\s\S]+?\*\//g, ""); 22 | } 23 | -------------------------------------------------------------------------------- /utils/string-util/src/index.ts: -------------------------------------------------------------------------------- 1 | export { formatComment, stripComment } from "./comment"; 2 | export { unquote } from "./unquote"; 3 | export { 4 | upperFirst, 5 | lowerFirst, 6 | camelCase, 7 | trimPrefix, 8 | trimSuffix 9 | } from "./string"; 10 | -------------------------------------------------------------------------------- /utils/string-util/src/string.ts: -------------------------------------------------------------------------------- 1 | export function upperFirst(s: string): string { 2 | return s[0].toUpperCase() + s.substring(1); 3 | } 4 | 5 | export function lowerFirst(s: string): string { 6 | return s[0].toLowerCase() + s.substring(1); 7 | } 8 | 9 | export function camelCase(input: string, chars: string): string { 10 | let output = ""; 11 | let upper = false; 12 | 13 | for (const s of input) { 14 | if (chars.includes(s)) { 15 | upper = true; 16 | } else { 17 | output += upper ? s.toUpperCase() : s; 18 | upper = false; 19 | } 20 | } 21 | 22 | return output; 23 | } 24 | 25 | export function trimPrefix(s: string, prefix: string): string { 26 | if (s.substring(0, prefix.length) === prefix) { 27 | return s.substring(prefix.length); 28 | } 29 | 30 | return s; 31 | } 32 | 33 | export function trimSuffix(s: string, suffix: string): string { 34 | const end = s.length - suffix.length; 35 | 36 | if (s.substring(end) === suffix) { 37 | return s.substring(0, end); 38 | } 39 | 40 | return s; 41 | } 42 | -------------------------------------------------------------------------------- /utils/string-util/src/unquote.ts: -------------------------------------------------------------------------------- 1 | const QUOTES = `'"`; 2 | 3 | export function unquote(s: string): string { 4 | const first = s[0]; 5 | if (QUOTES.indexOf(first) === -1) return s; 6 | if (s[s.length - 1] !== first) return s; 7 | 8 | return s.substring(1, s.length - 1); 9 | } 10 | -------------------------------------------------------------------------------- /utils/string-util/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src"] 7 | } 8 | -------------------------------------------------------------------------------- /vitest.config.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line node/no-missing-import, node/no-unpublished-import 2 | import { defineConfig } from "vitest/config"; 3 | 4 | export default defineConfig({ 5 | test: { 6 | include: ["**/__tests__/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], 7 | setupFiles: ["./.vitest/setup.ts"] 8 | } 9 | }); 10 | --------------------------------------------------------------------------------