k8sjs
A package for applying JS templated Kubernetes manifests created with k8sresources
.
Usage
Installation
npm install --global k8sjs k8sresources;
Applying a JS file template
You will need kubectl
on your machine before this will work. To check if the plugin was installed successfully, use kubectl plugin list
.
To test a deployment, create a file with the following contents:
const createDeployment = ; const deployment = ;deploymentspectemplatespeccontainers; moduleexports = deployment;
Then run:
kubectl js template ./yourfile.js | kubectl apply -f -# or for typescript files... kubectl ts template ./yourfile.ts | kubectl apply -f -
To just view the templated output, avoid applying it:
kubectl js template ./yourfile.js# or for typescript files... kubectl ts template ./yourfile.ts
Development Runbook
Development
- Install dependencies with
npm install
- Run
npm link
to link the binaries - Open a separate terminal and run
npm run dev
to start the file watcher/compiler - Run
kubectl js template
to test your changes (wait fortsc --project .
to complete running first)
Publishing
- Bump the version in the
package.json
- Build the project using
npm run build
- Commit all changes and push to the Git remote
- Run
npm publish
to publish to the NPM registry
License
This code is licensed under the MIT license.