cub k8s crd-spec
cub k8s crd-spec
Write the resource-type spec for a CustomResourceDefinition
Synopsis
Read a CustomResourceDefinition and write the resource-type spec for the types it defines.
A spec is what tells ConfigHub how to address the fields of a resource type: which arrays are keyed and by what, which sibling fields are mutually exclusive, which objects are freeform maps, which fields cannot change after creation, and where a pod template sits. Without one, a custom resource's containers are addressed by position, so a protected value moves when something is inserted ahead of it, and the container and pod functions do not see the type at all.
Most of that is already in the CRD's own schema, so this reads it rather than asking you to transcribe it. The output is the stanza to add to the built-in specs; it goes to stdout, and anything the reader saw but declined to decide goes to stderr.
What a CRD does not say is which of its fields name other resources, what the type's apply order is, and which types it is interchangeable with. Those are left out for you to add.
One stanza is written per version the CRD declares, because a version is part of a resource type.
Examples:
# Write the spec for a CRD
cub k8s crd-spec autoscalingrunnerset-crd.yaml
# Read from stdin
kubectl get crd autoscalingrunnersets.actions.github.com -o yaml | cub k8s crd-spec -
# Declare the arrays inside a pod spec explicitly, instead of embedding the shape
cub k8s crd-spec my-crd.yaml --no-pod-spec-match
# As a structured document rather than a stanza to paste
cub k8s crd-spec my-crd.yaml -o yaml
cub k8s crd-spec <crd-file> [flags]
Options
-h, --help help for crd-spec
--no-pod-spec-match Do not look for a pod spec; declare the arrays inside one explicitly instead
-o, --output string Output format. One of: json, yaml, name, wide, mutations, jq=<expr>, yq=<expr>, custom-columns=<spec>
Options inherited from parent commands
--context string The context to use for this command
--debug Debug output
SEE ALSO
- cub k8s - Kubernetes commands