https://github.com/vladimirvivien/kob
kob simplifies the programmatic construction of Kubernetes API object graphs
https://github.com/vladimirvivien/kob
go golang kubernetes kubernetes-api
Last synced: 3 months ago
JSON representation
kob simplifies the programmatic construction of Kubernetes API object graphs
- Host: GitHub
- URL: https://github.com/vladimirvivien/kob
- Owner: vladimirvivien
- License: mit
- Created: 2023-04-21T22:37:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-11T23:37:28.000Z (about 2 years ago)
- Last Synced: 2025-01-08T08:39:38.125Z (10 months ago)
- Topics: go, golang, kubernetes, kubernetes-api
- Language: Go
- Homepage:
- Size: 21.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kob 🦌
Kubernetes Object Builder
Project `kob` uses a builder pattern to simplify the construction and composition of Kubernetes API object graphs. It provides helper constructors to reduce typing and insert sensible defaults where needed.
### Example
The following:
```go
deployment.Object(objmeta.Name("simple-dep")).Replicas(3).Strategy(StrategyDefault).PodSpec(container.Name("simple-container"))
```
Produces an Deployment object equivalent to the following:
```go
reps := int32(3)
appsV1.Deployment{
ObjectMeta: metaV1.ObjectMeta{Name: "simple-dep"},
Spec: appsV1.DeploymentSpec{
Replicas: &reps,
Strategy: appsV1.DeploymentStrategy{
Type: appsV1.RecreateDeploymentStrategyType,
},
Template: coreV1.PodTemplateSpec{
Spec: coreV1.PodSpec{
Containers: []coreV1.Container{
{Name: "simple-container"},
},
},
},
},
}
```