Loading Helm Chart
Kosko supports loading manifests from Helm charts. You have to install the Helm CLI before using this package.
@kosko/helm uses the helm template command to render Helm chart templates. Most options of helm template command are supported. See API documentation for available options.
Under the hood, @kosko/helm uses @kosko/yaml to load YAML, which means the loadChart function supports all options of the loadString function. See loading Kubernetes YAML for more details.
Install
- NPM
- Yarn
- PNPM
npm install @kosko/helm @kosko/yaml
yarn add @kosko/helm @kosko/yaml
pnpm install @kosko/helm @kosko/yaml
Load from a Local Chart
- TypeScript
- JavaScript (ESM)
- JavaScript (CJS)
import { loadChart } from "@kosko/helm";
loadChart({
chart: "./nginx"
});
import { loadChart } from "@kosko/helm";
loadChart({
chart: "./nginx"
});
const { loadChart } = require("@kosko/helm");
loadChart({
chart: "./nginx"
});
Load from a Repository
- TypeScript
- JavaScript (ESM)
- JavaScript (CJS)
import { loadChart } from "@kosko/helm";
loadChart({
chart: "prometheus",
repo: "https://prometheus-community.github.io/helm-charts",
version: "13.6.0"
});
import { loadChart } from "@kosko/helm";
loadChart({
chart: "prometheus",
repo: "https://prometheus-community.github.io/helm-charts",
version: "13.6.0"
});
const { loadChart } = require("@kosko/helm");
loadChart({
chart: "prometheus",
repo: "https://prometheus-community.github.io/helm-charts",
version: "13.6.0"
});
Specify Release Name
- TypeScript
- JavaScript (ESM)
- JavaScript (CJS)
import { loadChart } from "@kosko/helm";
loadChart({
chart: "./nginx",
name: "http-server"
});
import { loadChart } from "@kosko/helm";
loadChart({
chart: "./nginx",
name: "http-server"
});
const { loadChart } = require("@kosko/helm");
loadChart({
chart: "./nginx",
name: "http-server"
});
Specify Values
- TypeScript
- JavaScript (ESM)
- JavaScript (CJS)
import { loadChart } from "@kosko/helm";
loadChart({
chart: "./nginx",
values: {
replicaCount: 5
}
});
import { loadChart } from "@kosko/helm";
loadChart({
chart: "./nginx",
values: {
replicaCount: 5
}
});
const { loadChart } = require("@kosko/helm");
loadChart({
chart: "./nginx",
values: {
replicaCount: 5
}
});
Include CRDs
- TypeScript
- JavaScript (ESM)
- JavaScript (CJS)
import { loadChart } from "@kosko/helm";
loadChart({
chart: "traefik",
repo: "https://helm.traefik.io/traefik",
includeCrds: true
});
import { loadChart } from "@kosko/helm";
loadChart({
chart: "traefik",
repo: "https://helm.traefik.io/traefik",
includeCrds: true
});
const { loadChart } = require("@kosko/helm");
loadChart({
chart: "traefik",
repo: "https://helm.traefik.io/traefik",
includeCrds: true
});
Related
📄️ @kosko/helm
@kosko/helm package
📄️ Loading Kubernetes YAML
If you already have lots of existing Kubernetes YAML files, you don't have to rewrite all of them in JavaScript. Kosko provides two ways for you to load Kubernetes YAML files.