2.1.0 • Published 3 months ago

@himenon/kubernetes-typescript-openapi v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

@himenon/kubernetes-typescript-openapi

npm  i   @himenon/kubernetes-typescript-openapi
# or
pnpm i   @himenon/kubernetes-typescript-openapi
# or
yarn add @himenon/kubernetes-typescript-openapi

Usage

import * as fs from "fs";
import * as yaml from "js-yaml"; // yarn add js-yaml @types/js-yaml
import type { Schemas } from "@himenon/kubernetes-typescript-openapi/dist/v1.29.1";

const podTemplateSpec: Schemas.io$k8s$api$core$v1$PodTemplateSpec = {
  metadata: {
    labels: {
      app: "nginx",
    },
  },
  spec: {
    containers: [
      {
        name: "nginx",
        image: "nginx:1.14.2",
        ports: [
          {
            containerPort: 80,
          },
        ],
      },
    ],
  },
};

const deployment: Schemas.io$k8s$api$apps$v1$Deployment = {
  apiVersion: "apps/v1",
  kind: "Deployment",
  metadata: {
    name: "nginx-deployment",
    labels: {
      app: "nginx",
    },
  },
  spec: {
    replicas: 3,
    selector: {
      matchLabels: {
        app: "nginx",
      },
    },
    template: podTemplateSpec,
  },
};

const text = yaml.dump(deployment, { noRefs: true, lineWidth: 144 });
fs.writeFileSync("deployment.yml", text, "utf-8");

Build

pnpm build

OpenAPI Source for Kubernetes

OpenAPI TypeScript Code Generator

You can also just use the type definition

Use Another Version

Edit config.ts

LICENCE

@Himenon/kubernetes-typescript-openapi・MIT

1.4.1

3 months ago

2.1.0

3 months ago

1.4.0

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago