{"id":13645116,"url":"https://github.com/krisnova/naml","last_synced_at":"2025-05-16T05:04:14.362Z","repository":{"id":41238789,"uuid":"376186782","full_name":"krisnova/naml","owner":"krisnova","description":"Convert Kubernetes YAML to Golang","archived":false,"fork":false,"pushed_at":"2023-07-21T08:28:22.000Z","size":80979,"stargazers_count":1261,"open_issues_count":15,"forks_count":36,"subscribers_count":21,"default_branch":"main","last_synced_at":"2025-05-16T05:04:06.487Z","etag":null,"topics":["go","kubernetes","programming-language","yaml-templating"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krisnova.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-06-12T02:40:30.000Z","updated_at":"2025-05-16T00:41:58.000Z","dependencies_parsed_at":"2022-07-16T23:31:10.463Z","dependency_job_id":null,"html_url":"https://github.com/krisnova/naml","commit_stats":null,"previous_names":["kris-nova/naml","kris-nova/yamyams","kris-nova/yam-yams"],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krisnova%2Fnaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krisnova%2Fnaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krisnova%2Fnaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krisnova%2Fnaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krisnova","download_url":"https://codeload.github.com/krisnova/naml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471061,"owners_count":22076585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","kubernetes","programming-language","yaml-templating"],"created_at":"2024-08-02T01:02:27.657Z","updated_at":"2025-05-16T05:04:14.342Z","avatar_url":"https://github.com/krisnova.png","language":"Go","readme":"[![Go Reference](https://pkg.go.dev/badge/github.com/kris-nova/naml.svg)](https://pkg.go.dev/github.com/kris-nova/naml)\n\n# Not Another Markup Language.\n\n---\n\nPlease help me become an independent programmer by donating directly below.\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/D1D8CXLHZ) \n\n---\n\n\u003e NAML is a Go library and command line tool that can be used as a framework to develop and deploy Kubernetes applications.\n\nReplace Kubernetes YAML with raw Go!\n\nSay so long 👋 to YAML and start using the Go 🎉 programming language to represent and deploy applications with Kubernetes.\n\nKubernetes applications are complicated, so lets use a proper Turing complete language to reason about them.\n\n✅ Take advantage of all the lovely features of Go (Syntax highlighting, Cross compiling, Code generation, Documentation)\n\n✅ Test your code directly in local Kubernetes using [kind](https://github.com/kubernetes-sigs/kind). Yes you can really deploy your applications to Kubernetes.\n\n✅ 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.\n\n## Convert YAML to Go\n\n```bash\ncat deploy.yaml | naml codify \u003e main.go\n```\n\nTurn existing YAML into formatted and syntactically correct Go that implements the `Deployable` interface.\n\n```bash\nmkdir out\n\n# Get started quickly with all objects in a namespace\nkubectl get all -n default -o yaml | naml codify \u003e out/main.go\n\n# Overload the template with your information\ncat app.yaml | naml codify \\\n  --author-name=\"Charlie\" \\\n  --author-email=\"\u003ccharlie@nivenly.com\u003e\" \u003e out/main.go\n  \n# Combine files in one command\nprintf \"\\n\\n---\\n\\n\" | cat file1.yaml - file2.yaml - file3.yaml | naml codify \u003e out/main.go\n```\n\nThen compile and run your application against Kubernetes.\n\n```bash \ncd out\nnaml build -o app\n./app -o yaml\n./app install \n./app uninstall\n```\n\nUse `make help` for more. Happy coding 🎉.\n\n## Example Projects\n\nThere is a \"repository\" of examples to borrow/fork:\n\n- [simple](https://github.com/naml-examples/simple) quick and simple example.\n- [examples](https://github.com/naml-examples) GitHub organization.\n\n\n### The Deployable Interface\n\nAs 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.\n\n```go\n// Deployable is an interface that can be implemented\n// for deployable applications.\ntype Deployable interface {\n\n// Install will attempt to install in Kubernetes\nInstall(client kubernetes.Interface) error\n\n// Uninstall will attempt to uninstall in Kubernetes\nUninstall(client kubernetes.Interface) error\n\n// Meta returns a NAML Meta structure which embed Kubernetes *metav1.ObjectMeta\nMeta() *AppMeta\n\n// Objects will return the runtime objects defined for each application\nObjects() []runtime.Object\n}\n```\n\nIn order to get the raw Kubernetes objects in Go without installing them anywhere, you pass in `nil` in place of an authenticated Kubernetes `Clientset`. \n\nThen you can access the objects in memory.\n\n```go\n    app.Install(nil)\n    objects := app.Objects()\n```\n\n## Nothing fancy\n\nThere isn't anything special here. 🤷‍♀ We use the same client the rest of Kubernetes does.\n\n ❎ No new complex tools.\n\n ❎ No charts.\n\n ❎ No templating at runtime.\n\n ❎ No vague error messages.\n \n ❎ No more YAML guessing/checking.\n\n ✅ Just Go. 🎉\n\n## Features\n\n - Express applications in 🎉 Go instead of YAML.\n - Use the Go compiler to check your syntax.\n - Write **real tests** 🤓 using Go to check and validate your deployments.\n - Test your applications in Kubernetes using [kind](https://github.com/kubernetes-sigs/kind).\n - Define custom installation logic. What happens if it fails? What about logical concerns at runtime?\n - Define custom application registries. Multiple apps of the same flavor? No problem.\n - Use the latest client (the same client the rest of Kubernetes uses).\n","funding_links":["https://ko-fi.com/D1D8CXLHZ"],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrisnova%2Fnaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrisnova%2Fnaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrisnova%2Fnaml/lists"}