Documentation ¶
Overview ¶
Package options provides functionality for adding options to components.
Options, in this context, are values that need to be added to components at runtime. Sometimes these are called 'last-mile' customizations. For example, you might want the Cluster IP or the Cluster Name to a specific value.
The parent options package provides common functionality and types while the subdirectories provide specific option-applying instances.
Index ¶
- Constants
- func ApplyCommon(ref bundle.ComponentReference, objs []*unstructured.Unstructured, ...) ([]*unstructured.Unstructured, error)
- func PartitionObjectTemplates(allObjects []*unstructured.Unstructured, templateKind string) ([]*unstructured.Unstructured, []*unstructured.Unstructured)
- type Applier
- type JSONOptions
- type ObjHandler
Constants ¶
const ( // MissingKeyError is an option for go templates. Execution stops immediately // with an error. This is the used as the default in the ClusterBundle. MissingKeyError = "missingkey=error" // MissingKeyDefault is same as MissingKeyInvalid. MissingKeyDefault = "missingkey=default" // MissingKeyInvalid ihe default behavior: Do nothing and continue execution. // If printed, the result of the index operation is the string MissingKeyInvalid = "missingkey=invalid" // MissingKeyZero is an option for go templates. The operation returns the // zero value for the map type's element. MissingKeyZero = "missingkey=zero" )
Variables ¶
This section is empty.
Functions ¶
func ApplyCommon ¶
func ApplyCommon(ref bundle.ComponentReference, objs []*unstructured.Unstructured, opts JSONOptions, objFn ObjHandler) ([]*unstructured.Unstructured, error)
ApplyCommon provides common functionality for applying options, deferring the specific object handling logic. The objects will be modified in-place; the caller should copy them if needed.
func PartitionObjectTemplates ¶ added in v0.11.0
func PartitionObjectTemplates(allObjects []*unstructured.Unstructured, templateKind string) ([]*unstructured.Unstructured, []*unstructured.Unstructured)
PartitionObjectTemplates returns all the ObjectTemplates that match a specified TemplateKind and all other objects that don't match, in that order.
Types ¶
type Applier ¶
type Applier interface { // ApplyOptions applys options to some subset objects from the component. The // returned component should be copy of the original, with (perhaps) modifications made to the original. ApplyOptions(comp *bundle.Component, opts JSONOptions) (*bundle.Component, error) }
Applier represents an object that can take options and apply them to components.
type JSONOptions ¶
type JSONOptions map[string]interface{}
JSONOptions is an instance of options, represented as a JSON object encoded as map[string]interface{}. See more at the go docs for `encoding/json`.
type ObjHandler ¶
type ObjHandler func(obj *unstructured.Unstructured, ref bundle.ComponentReference, opts JSONOptions) ([]*unstructured.Unstructured, error)
ObjHandler is a function that can apply options to a Kubernetes object.
Directories ¶
Path | Synopsis |
---|---|
Package gotmpl creates objects from ObjectTemplate objects for ObjectTemplates of type "go-template".
|
Package gotmpl creates objects from ObjectTemplate objects for ObjectTemplates of type "go-template". |
Package multi is an applier that performs multiple different applier approaches.
|
Package multi is an applier that performs multiple different applier approaches. |
Package openapi provides methods for using the OpenAPI schema for validation and defaulting.
|
Package openapi provides methods for using the OpenAPI schema for validation and defaulting. |