View Source Bonny.CRD (bonny v1.4.0)
Represents the spec
portion of a Kubernetes CustomResourceDefinition manifest.
The CustomResourceDefinition API resource allows you to define custom resources. Defining a CRD object creates a new custom resource with a name and schema that you specify. The Kubernetes API serves and handles the storage of your custom resource.
Summary
Functions
Gets group version from CRD spec
Default CLI printer columns.
CRD Kind or plural name
Generates the map equivalent of the Kubernetes CRD YAML manifest
Types
Functions
Gets group version from CRD spec
Examples
Returns apiVersion for an operator
iex> Bonny.CRD.api_version(%Bonny.CRD{group: "hello.example.com", version: "v1", scope: :namespaced, names: %{}})
"hello.example.com/v1"
Returns apiVersion for apps
resources
iex> Bonny.CRD.api_version(%Bonny.CRD{group: "apps", version: "v1", scope: :namespaced, names: %{}})
"apps/v1"
Returns apiVersion for core
resources
iex> Bonny.CRD.api_version(%Bonny.CRD{group: "", version: "v1", scope: :namespaced, names: %{}})
"v1"
iex> Bonny.CRD.api_version(%Bonny.CRD{group: nil, version: "v1", scope: :namespaced, names: %{}})
"v1"
@spec default_columns() :: [map()]
Default CLI printer columns.
These are added to the CRDs columns when columns are set.
The kubernetes API returns these by default when they are not set.
CRD Kind or plural name
Examples
iex> Bonny.CRD.kind(%Bonny.CRD{names: %{plural: "greetings"}, scope: :namespaced, group: "test", version: "v1"})
"greetings"
Generates the map equivalent of the Kubernetes CRD YAML manifest
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: widgets.example.com
spec:
group: example.com
names:
kind: Widget
plural: widgets
scope: Namespaced
version: v1