Documentation ¶
Index ¶
- func ImportYaml(r io.Reader) (*TypeSpec, Properties, error)
- func MakePaths(a app.App, env string) ([]string, error)
- func MakePathsByNamespace(a app.App, env string) (map[Namespace][]string, error)
- func Path(a app.App, name string) (string, error)
- type Component
- type GVK
- type Jsonnet
- func (j *Jsonnet) DeleteParam(path []string, options ParamOptions) error
- func (j *Jsonnet) Name(wantsNameSpaced bool) string
- func (j *Jsonnet) Objects(paramsStr, envName string) ([]*unstructured.Unstructured, error)
- func (j *Jsonnet) Params() ([]NamespaceParameter, error)
- func (j *Jsonnet) SetParam(path []string, value interface{}, options ParamOptions) error
- func (j *Jsonnet) Summarize() ([]Summary, error)
- type Namespace
- func ExtractNamespacedComponent(a app.App, path string) (Namespace, string)
- func GetNamespace(a app.App, nsName string) (Namespace, error)
- func Namespaces(a app.App) ([]Namespace, error)
- func NamespacesFromEnv(a app.App, env string) ([]Namespace, error)
- func NewNamespace(ksApp app.App, path string) Namespace
- func (n *Namespace) Components() ([]Component, error)
- func (n *Namespace) Dir() string
- func (n *Namespace) Name() string
- func (n *Namespace) Params() ([]NamespaceParameter, error)
- func (n *Namespace) ParamsPath() string
- func (n *Namespace) ResolvedParams() (string, error)
- func (n *Namespace) SetParam(path []string, value interface{}) error
- type NamespaceParameter
- type ParamOptions
- type Properties
- type PropertyPath
- type Summary
- type TypeSpec
- type ValueExtractor
- type Values
- type YAML
- func (y *YAML) DeleteParam(path []string, options ParamOptions) error
- func (y *YAML) Name(wantsNameSpaced bool) string
- func (y *YAML) Objects(paramsStr, envName string) ([]*unstructured.Unstructured, error)
- func (y *YAML) Params() ([]NamespaceParameter, error)
- func (y *YAML) SetParam(path []string, value interface{}, options ParamOptions) error
- func (y *YAML) Summarize() ([]Summary, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImportYaml ¶
func ImportYaml(r io.Reader) (*TypeSpec, Properties, error)
ImportYaml converts a reader containing YAML to a TypeSpec and Properties.
func MakePathsByNamespace ¶
MakePathsByNamespace creates a map of component paths categorized by namespace.
Types ¶
type Component ¶
type Component interface { // Name is the component name. Name(wantsNamedSpaced bool) string // Objects converts the component to a set of objects. Objects(paramsStr, envName string) ([]*unstructured.Unstructured, error) // SetParams sets a component paramaters. SetParam(path []string, value interface{}, options ParamOptions) error // DeleteParam deletes a component parameter. DeleteParam(path []string, options ParamOptions) error // Params returns a list of all parameters for a component. Params() ([]NamespaceParameter, error) // Summarize returns a summary of the component. Summarize() ([]Summary, error) }
Component is a ksonnet Component interface.
type Jsonnet ¶
type Jsonnet struct {
// contains filtered or unexported fields
}
Jsonnet is a component base on jsonnet.
func NewJsonnet ¶
NewJsonnet creates an instance of Jsonnet.
func (*Jsonnet) DeleteParam ¶
func (j *Jsonnet) DeleteParam(path []string, options ParamOptions) error
DeleteParam deletes a param.
func (*Jsonnet) Objects ¶
func (j *Jsonnet) Objects(paramsStr, envName string) ([]*unstructured.Unstructured, error)
Objects converts jsonnet to a slice of apimachinery unstructured objects.
func (*Jsonnet) Params ¶
func (j *Jsonnet) Params() ([]NamespaceParameter, error)
Params returns params for a component.
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace is a component namespace.
func ExtractNamespacedComponent ¶
ExtractNamespacedComponent extracts a namespace and a component from a path.
func GetNamespace ¶
GetNamespace gets a namespace by path.
func Namespaces ¶
Namespaces returns all component namespaces
func NamespacesFromEnv ¶
NamespacesFromEnv returns all namespaces given an environment.
func NewNamespace ¶
NewNamespace creates an instance of Namespace.
func (*Namespace) Components ¶
Components returns the components in a namespace.
func (*Namespace) Params ¶
func (n *Namespace) Params() ([]NamespaceParameter, error)
Params returns the params for a namespace.
func (*Namespace) ParamsPath ¶
ParamsPath generates the path to params.libsonnet for a namespace.
func (*Namespace) ResolvedParams ¶
ResolvedParams resolves paramaters for a namespace. It returns a JSON encoded string of component parameters.
type NamespaceParameter ¶
NamespaceParameter is a namespaced paramater.
type Properties ¶
type Properties map[interface{}]interface{}
Properties are document properties
func (Properties) Name ¶
func (p Properties) Name() (string, error)
Name extract name or generateName from metadata. If either are not found, it returns an error.
func (Properties) Paths ¶
func (p Properties) Paths(gvk GVK) []PropertyPath
Paths returns a list of paths in properties.
func (Properties) Value ¶
func (p Properties) Value(path []string) (interface{}, error)
Value returns the value at a path.
type PropertyPath ¶
type PropertyPath struct { Path []string Value interface{} }
PropertyPath contains a property path.
type Summary ¶
type Summary struct { ComponentName string IndexStr string Index int Type string APIVersion string Kind string Name string }
Summary summarizes items found in components.
type TypeSpec ¶
type TypeSpec struct {
// contains filtered or unexported fields
}
TypeSpec describes an object's type.
func NewTypeSpec ¶
NewTypeSpec creates an instance of TypeSpec.
type ValueExtractor ¶
type ValueExtractor struct {
// contains filtered or unexported fields
}
ValueExtractor extracts Values from a manifest.
func NewValueExtractor ¶
func NewValueExtractor(root *astext.Object) *ValueExtractor
NewValueExtractor creates an instance of ValueExtractor.
func (*ValueExtractor) Extract ¶
func (ve *ValueExtractor) Extract(gvk GVK, props Properties) (map[string]Values, error)
Extract extracts values from an object.
type YAML ¶
type YAML struct {
// contains filtered or unexported fields
}
YAML represents a YAML component. Since JSON is a subset of YAML, it can handle JSON as well.
func (*YAML) DeleteParam ¶
func (y *YAML) DeleteParam(path []string, options ParamOptions) error
DeleteParam deletes a param.
func (*YAML) Objects ¶
func (y *YAML) Objects(paramsStr, envName string) ([]*unstructured.Unstructured, error)
Objects converts YAML to a slice of apimachinery Unstructured objects. Params for a YAML based component are keyed like, `name-id`, where `name` is the file name sans the extension, and the id is the position within the file (starting at 0). Params are named this way because a YAML file can contain more than one object.
func (*YAML) Params ¶
func (y *YAML) Params() ([]NamespaceParameter, error)
Params returns params for a component.