Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wozniakjan/reverse-kube-resource
Revert kubernetes yaml files to native go code
https://github.com/wozniakjan/reverse-kube-resource
golang kubernetes yaml
Last synced: 3 months ago
JSON representation
Revert kubernetes yaml files to native go code
- Host: GitHub
- URL: https://github.com/wozniakjan/reverse-kube-resource
- Owner: wozniakjan
- License: unlicense
- Created: 2021-07-08T15:50:00.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-25T11:08:18.000Z (4 months ago)
- Last Synced: 2024-10-25T13:17:41.693Z (4 months ago)
- Topics: golang, kubernetes, yaml
- Language: Go
- Homepage:
- Size: 430 KB
- Stars: 30
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Reverse Kube Resources
===![test](https://github.com/wozniakjan/reverse-kube-resource/actions/workflows/test.yaml/badge.svg)
This tool is intended to generate golang code tightly coupled with [Kubernetes client-go](https://github.com/kubernetes/client-go).
The input are raw yaml manifests and the tool leverages Kubernetes scheme to generate valid golang structures compatible with client-go.
### Example:
The directory [`examples`](./examples) contains few sample yaml files with kubernetes resources.```yaml
apiVersion: v1
kind: Namespace
metadata:
name: test
spec: {}
status: {}
```After executing the generator with following arguments:
```
$ go run github.com/wozniakjan/reverse-kube-resource -package test -src ./examples/ns.yaml > output/ns.go
```The output is a buildable go file:
```go
// Code generated by reverse-kube-resource. DO NOT EDIT.package test
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)var testNamespace = corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
},
Spec: corev1.NamespaceSpec{},
Status: corev1.NamespaceStatus{},
}
```