Giter Club home page Giter Club logo

naml's Introduction

Go Reference

Not Another Markup Language.


Please help me become an independent programmer by donating directly below.

ko-fi


NAML is a Go library and command line tool that can be used as a framework to develop and deploy Kubernetes applications.

Replace Kubernetes YAML with raw Go!

Say so long ๐Ÿ‘‹ to YAML and start using the Go ๐ŸŽ‰ programming language to represent and deploy applications with Kubernetes.

Kubernetes applications are complicated, so lets use a proper Turing complete language to reason about them.

โœ… Take advantage of all the lovely features of Go (Syntax highlighting, Cross compiling, Code generation, Documentation)

โœ… Test your code directly in local Kubernetes using kind. Yes you can really deploy your applications to Kubernetes.

โœ… Get your application directly into Go instead of YAML and use it in controllers, operators, CRs/CRDs easily. Use the Go compiler to your advantage.

Convert YAML to Go

cat deploy.yaml | naml codify > main.go

Turn existing YAML into formatted and syntactically correct Go that implements the Deployable interface.

mkdir out

# Get started quickly with all objects in a namespace
kubectl get all -n default -o yaml | naml codify > out/main.go

# Overload the template with your information
cat app.yaml | naml codify \
  --author-name="Charlie" \
  --author-email="<[email protected]>" > out/main.go
  
# Combine files in one command
printf "\n\n---\n\n" | cat file1.yaml - file2.yaml - file3.yaml | naml codify > out/main.go

Then compile and run your application against Kubernetes.

cd out
naml build -o app
./app -o yaml
./app install 
./app uninstall

Use make help for more. Happy coding ๐ŸŽ‰.

Example Projects

There is a "repository" of examples to borrow/fork:

The Deployable Interface

As long as there is a Go system that implements this interface it can be used with naml. See examples for how to include an implementation in your project.

// Deployable is an interface that can be implemented
// for deployable applications.
type Deployable interface {

// Install will attempt to install in Kubernetes
Install(client kubernetes.Interface) error

// Uninstall will attempt to uninstall in Kubernetes
Uninstall(client kubernetes.Interface) error

// Meta returns a NAML Meta structure which embed Kubernetes *metav1.ObjectMeta
Meta() *AppMeta

// Objects will return the runtime objects defined for each application
Objects() []runtime.Object
}

In order to get the raw Kubernetes objects in Go without installing them anywhere, you pass in nil in place of an authenticated Kubernetes Clientset.

Then you can access the objects in memory.

    app.Install(nil)
    objects := app.Objects()

Nothing fancy

There isn't anything special here. ๐Ÿคทโ€โ™€ We use the same client the rest of Kubernetes does.

โŽ No new complex tools.

โŽ No charts.

โŽ No templating at runtime.

โŽ No vague error messages.

โŽ No more YAML guessing/checking.

โœ… Just Go. ๐ŸŽ‰

Features

  • Express applications in ๐ŸŽ‰ Go instead of YAML.
  • Use the Go compiler to check your syntax.
  • Write real tests ๐Ÿค“ using Go to check and validate your deployments.
  • Test your applications in Kubernetes using kind.
  • Define custom installation logic. What happens if it fails? What about logical concerns at runtime?
  • Define custom application registries. Multiple apps of the same flavor? No problem.
  • Use the latest client (the same client the rest of Kubernetes uses).

naml's People

Contributors

amalic avatar andrewrynhard avatar bweston92 avatar deadmoose avatar depado avatar fkautz avatar koletyst avatar krisnova avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.