Skip to content

louis-vinchon/KubeScript

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cover

KubeScript is a DRY infrastructure as code solution to Kubernetes DevOps

demo


Status

Beta

Features

  • No yaml files.
  • No boilerplate or hack.
  • Type based code completion with Typescript.
  • Safe sandbox with Deno.
screencast.mov

Quickstart

Prerequisites

  1. Install deno by following the official guide.

  2. Install KubeScript by running the following command.

    deno install --unstable -A --root /usr/local -n ks https://deno.land/x/kube_script/main.ts

Quick demo

You can try KubeScript without writing any code.

ks https://deno.land/x/kube_script/example/web/mod.ts

A full example

  1. Checkout this project.

    git clone https://github.com/in-fun/KubeScript.git
  2. Generate k8s yaml files.

    ks example/nginx
  3. Show diff from current settings.

    ks example/nginx --env production | kubectl diff -f -
  4. Apply k8s resources.

    ks example/nginx --env production | kubectl apply -f -

FAQ

  1. Kubernetes resource manifests are declarative, why adding a scripting layer?

    I agree declarative style is preferable, if the problem domain is not complex. But when things goes to some level of complexity, all so called declarative solution turns out to be procedural or requires procedural style hacks. I will give an example to illustrate it below.

    This is a helm manifest for argocd-server deployment. As we can see, it uses procedural style statements including for loop (range), and if-else branching. The end result is mixing 2 languages in one: yaml and mustache; so it's even more complicated than a scripting language.

    Our opinion is that real-world kubernetes manifests are so complex, that a fully declarative style of writing is almost impossible. On the other hand, procedural style is more flexible, easier to maintain, thus better.

  2. Why use deno instead of node.js?

    Deno is more developer friendly than node.js. For example, deno resolves dependencies on the fly, so no npm install any more.

  3. How does KubeScript comopare to other solutions?

    We have summarized that in this doc.

About

Kubernetes meets Typescript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 60.6%
  • Go 33.7%
  • Dockerfile 3.0%
  • Shell 1.6%
  • Makefile 1.1%