Skip to content

kob simplifies the programmatic construction of Kubernetes API object graphs

License

Notifications You must be signed in to change notification settings

vladimirvivien/kob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

deployment.Object(objmeta.Name("simple-dep")).Replicas(3).Strategy(StrategyDefault).PodSpec(container.Name("simple-container"))

Produces an Deployment object equivalent to the following:

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"},
				},
			},
		},
	},
}

About

kob simplifies the programmatic construction of Kubernetes API object graphs

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages