Documentation
¶
Overview ¶
Package kubewright builds and writes Kubernetes resources for an owner object: from a plain Go spec to a Deployment, Service, Secret or another built-in kind, with owner references set so the cluster removes them with their owner. It is a library, not a framework: no controller, no reconcile loop, no logging. You call it from your own.
Each kind is its own package under core, with the same verbs:
- Build returns the object for a spec and does no I/O.
- Create creates it if it does not exist.
- Apply writes it with server-side apply.
- Delete deletes it; DeleteIfOwned deletes it only if a predicate says the caller owns it.
Every verb takes a kubernetes.Interface (customresources takes a dynamic.Interface and a RESTMapper) and returns a types.Result, such as Created, Unchanged or NotOwned, with a nil error for every expected outcome. Calling a verb twice is safe: an object that already exists is Unchanged, and one already gone is NotFound.
The packages:
- core/<kind>: one package per kind, such as core/deployments
- core/types: the field types specs are made of, Owner, Options and Result
- core/apply: the one server-side apply every Apply writes through
- presets: named field settings ("medium", "restricted", "safe") that a spec refers to instead of spelling them out
Directories
¶
| Path | Synopsis |
|---|---|
|
core
|
|
|
apply
Package apply writes objects with server-side apply.
|
Package apply writes objects with server-side apply. |
|
clusterrolebindings
Package clusterrolebindings builds and writes ClusterRoleBindings with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package clusterrolebindings builds and writes ClusterRoleBindings with Build, Create, Apply, Delete and DeleteIfOwned. |
|
clusterroles
Package clusterroles builds and writes ClusterRoles with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package clusterroles builds and writes ClusterRoles with Build, Create, Apply, Delete and DeleteIfOwned. |
|
configmaps
Package configmaps builds and writes ConfigMaps with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package configmaps builds and writes ConfigMaps with Build, Create, Apply, Delete and DeleteIfOwned. |
|
cronjobs
Package cronjobs builds and writes CronJobs with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package cronjobs builds and writes CronJobs with Build, Create, Apply, Delete and DeleteIfOwned. |
|
customresources
Package customresources builds and writes custom resources, or any kind without a typed package, with the same verbs as the typed packages: Build, Create, Apply and DeleteIfOwned.
|
Package customresources builds and writes custom resources, or any kind without a typed package, with the same verbs as the typed packages: Build, Create, Apply and DeleteIfOwned. |
|
deployments
Package deployments builds and writes Deployments with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package deployments builds and writes Deployments with Build, Create, Apply, Delete and DeleteIfOwned. |
|
hpas
Package hpas builds and writes HorizontalPodAutoscalers with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package hpas builds and writes HorizontalPodAutoscalers with Build, Create, Apply, Delete and DeleteIfOwned. |
|
ingresses
Package ingresses builds and writes Ingresses with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package ingresses builds and writes Ingresses with Build, Create, Apply, Delete and DeleteIfOwned. |
|
jobs
Package jobs builds and writes Jobs with Build, Create, Delete and CreateForDelete.
|
Package jobs builds and writes Jobs with Build, Create, Delete and CreateForDelete. |
|
limitranges
Package limitranges builds and writes LimitRanges with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package limitranges builds and writes LimitRanges with Build, Create, Apply, Delete and DeleteIfOwned. |
|
namespaces
Package namespaces builds and writes Namespaces with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package namespaces builds and writes Namespaces with Build, Create, Apply, Delete and DeleteIfOwned. |
|
networkpolicies
Package networkpolicies builds and writes NetworkPolicies with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package networkpolicies builds and writes NetworkPolicies with Build, Create, Apply, Delete and DeleteIfOwned. |
|
pdbs
Package pdbs builds and writes PodDisruptionBudgets with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package pdbs builds and writes PodDisruptionBudgets with Build, Create, Apply, Delete and DeleteIfOwned. |
|
pods
Package pods builds and writes Pods with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package pods builds and writes Pods with Build, Create, Apply, Delete and DeleteIfOwned. |
|
pvcs
Package pvcs builds and writes PersistentVolumeClaims with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package pvcs builds and writes PersistentVolumeClaims with Build, Create, Apply, Delete and DeleteIfOwned. |
|
pvs
Package pvs builds and writes PersistentVolumes with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package pvs builds and writes PersistentVolumes with Build, Create, Apply, Delete and DeleteIfOwned. |
|
replicasets
Package replicasets builds and writes ReplicaSets with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package replicasets builds and writes ReplicaSets with Build, Create, Apply, Delete and DeleteIfOwned. |
|
resourcequotas
Package resourcequotas builds and writes ResourceQuotas with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package resourcequotas builds and writes ResourceQuotas with Build, Create, Apply, Delete and DeleteIfOwned. |
|
rolebindings
Package rolebindings builds and writes RoleBindings with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package rolebindings builds and writes RoleBindings with Build, Create, Apply, Delete and DeleteIfOwned. |
|
roles
Package roles builds and writes Roles with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package roles builds and writes Roles with Build, Create, Apply, Delete and DeleteIfOwned. |
|
secrets
Package secrets builds and writes Secrets with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package secrets builds and writes Secrets with Build, Create, Apply, Delete and DeleteIfOwned. |
|
serviceaccounts
Package serviceaccounts builds and writes ServiceAccounts with Build, Create, Delete and DeleteIfOwned.
|
Package serviceaccounts builds and writes ServiceAccounts with Build, Create, Delete and DeleteIfOwned. |
|
services
Package services builds and writes Services with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package services builds and writes Services with Build, Create, Apply, Delete and DeleteIfOwned. |
|
statefulsets
Package statefulsets builds and writes StatefulSets with Build, Create, Apply, Delete and DeleteIfOwned.
|
Package statefulsets builds and writes StatefulSets with Build, Create, Apply, Delete and DeleteIfOwned. |
|
types
Package types holds the field types a resource spec is made of: env and envFrom, resource requirements, probes, pod and container security, volumes, rolling update, HPA behavior, network policy rules, limit range items, labels and custom resource metadata.
|
Package types holds the field types a resource spec is made of: env and envFrom, resource requirements, probes, pod and container security, volumes, rolling update, HPA behavior, network policy rules, limit range items, labels and custom resource metadata. |
|
Command examples shows kubewright building the resources an App owns: presets expanded into fields, then each verb's result, then deletion that leaves another owner's objects alone.
|
Command examples shows kubewright building the resources an App owns: presets expanded into fields, then each verb's result, then deletion that leaves another owner's objects alone. |
|
internal
|
|
|
testutil
Package testutil holds what the kind packages' tests share: an owner to build for, and a check of the verbs' results against a fake clientset.
|
Package testutil holds what the kind packages' tests share: an owner to build for, and a check of the verbs' results against a fake clientset. |
|
Package presets names the field settings teams repeat: resource requests and limits, probe timings, container and pod security, rolling update, HPA and PDB behavior, network policy rules and namespace quotas.
|
Package presets names the field settings teams repeat: resource requests and limits, probe timings, container and pod security, rolling update, HPA and PDB behavior, network policy rules and namespace quotas. |