Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCustomInputType ¶ added in v0.1.5
AddCustomInputType allows types that do not implement client.Object to be used as fields of Inputs structs.
Example ¶
type myType struct { SecretKey string } AddCustomInputType(func(in *corev1.Secret) (*myType, error) { return &myType{ SecretKey: string(in.Data["key"]), }, nil }) type exampleInputs struct { CustomInput *myType `eno_key:"test-secret"` } fn := func(inputs exampleInputs) ([]client.Object, error) { output := &corev1.Pod{} output.Name = string(inputs.CustomInput.SecretKey) return []client.Object{output}, nil } ir := newTestInputReader() main(fn, ir, NewDefaultOutputWriter())
Output: {"apiVersion":"config.kubernetes.io/v1","kind":"ResourceList","items":[{"metadata":{"creationTimestamp":null,"name":"foobar\n"},"spec":{"containers":null},"status":{}}]}
func Main ¶ added in v0.1.4
Main is the entrypoint for Eno synthesizer processes written using the framework defined by this package.
Example ¶
fn := func(inputs struct{}) ([]client.Object, error) { output := &corev1.Pod{} output.Name = "test-pod" return []client.Object{output}, nil } Main(fn)
Output: {"apiVersion":"config.kubernetes.io/v1","kind":"ResourceList","items":[{"metadata":{"creationTimestamp":null,"name":"test-pod"},"spec":{"containers":null},"status":{}}]}
Types ¶
type InputReader ¶
type InputReader struct {
// contains filtered or unexported fields
}
func NewDefaultInputReader ¶
func NewDefaultInputReader() (*InputReader, error)
func NewInputReader ¶
func NewInputReader(r io.Reader) (*InputReader, error)
func (*InputReader) All ¶ added in v0.0.15
func (i *InputReader) All() map[string]*unstructured.Unstructured
type Inputs ¶ added in v0.1.4
type Inputs interface{}
Inputs is satisfied by any struct that defines the inputs required by a SynthFunc. Use the `eno_key` struct tag to specify the corresponding ref key for each input. Each field must either be a client.Object or a custom type registered with AddCustomInputType.
Example ¶
type exampleInputs struct { MySecret *corev1.Secret `eno_key:"test-secret"` } fn := func(inputs exampleInputs) ([]client.Object, error) { output := &corev1.Pod{} output.Name = string(inputs.MySecret.Data["key"]) return []client.Object{output}, nil } ir := newTestInputReader() main(fn, ir, NewDefaultOutputWriter())
Output: {"apiVersion":"config.kubernetes.io/v1","kind":"ResourceList","items":[{"metadata":{"creationTimestamp":null,"name":"foobar\n"},"spec":{"containers":null},"status":{}}]}
type MungeFunc ¶ added in v0.0.19
type MungeFunc func(*unstructured.Unstructured)
type OutputWriter ¶
type OutputWriter struct {
// contains filtered or unexported fields
}
func NewDefaultOutputWriter ¶
func NewDefaultOutputWriter() *OutputWriter
func NewOutputWriter ¶
func NewOutputWriter(w io.Writer, munge MungeFunc) *OutputWriter
func (*OutputWriter) AddResult ¶ added in v0.1.4
func (w *OutputWriter) AddResult(result *krmv1.Result)
func (*OutputWriter) Write ¶
func (w *OutputWriter) Write() error
Click to show internal directories.
Click to hide internal directories.