Skip to content

Go Webapp to convert kubernetes manifests (YAML) to Go (golang) code

License

Notifications You must be signed in to change notification settings

veggiemonk/lingonweb

Repository files navigation

Lingon Web

Intro

Lingon Web is a web-based interface for Lingon. Lingon is a library and command line tool to write HCL (Terraform) and kubernetes manifest (YAML) in Go.

This web app is an example of how to use the library to convert kubernetes manifests to Go code.

See Rationale for why we built this.

Lingon is not a platform, it is a library meant to be consumed in a Go application that platform engineers write to manage their platforms. It is a tool to build and automate the creation and the management of platforms regardless of the target infrastructure and services.

Screenshot

lingon webapp screenshot

Who is this for?

Lingon is aimed at people who need to automate the lifecycle of their cloud infrastructure and have suffered the pain of configuration languages and complexity of gluing tools together with more tools. We prefer to write Go code and use the same language for everything. It's not a popular opinion but it works for us.

All the Examples are in the documentation.

A big example is Platypus which shows how the kubernetes and terraform libraries can be used together.

Works with CRDs

Lingon can convert CRDs (Custom Resource Definitions) as well. Although it is not possible to convert all CRDs, as we would need to register them all. See serializer.go for an example of how to register the custom resource types.

Open an issue or a PR if you want to add more CRDs. 🥲

Output format is txtar

A txtar archive is zero or more comment lines and then a sequence of file entries. Each file entry begins with a file marker line of the form "-- FILENAME --" and is followed by zero or more file content lines making up the file data. The comment or file content ends at the next file marker line. The file marker line must begin with the three-byte sequence "-- " and end with the three-byte sequence " --", but the enclosed file name can be surrounding by additional white space, all of which is stripped. If the txtar file is missing a trailing newline on the final line, parsers should consider a final newline to be present anyway. There are no possible syntax errors in a txtar archive.

We are using github.com/rogpeppe/go-internal version. see the doc for the API.

It is also used by the Go playground. See the example: https://go.dev/play/p/3ThdpZyPj-b

Example:

-- other.go --
package main

func hello() string {
	return "Hello, 世界"
}

-- main.go --
package main

import "fmt"

func main() {
	fmt.Println(hello())
}