Documentation ¶
Index ¶
- Variables
- func DecodeYAMLToJSON(node *yaml.RNode, v interface{}) error
- func FieldPath(p string, data map[string]string) ([]string, error)
- func PreserveFieldMatcherPath(fieldMatcher yaml.FieldMatcher) yaml.Filter
- type CommentClearer
- type ExperimentMigrationFilter
- type FieldRenamer
- type HasFilter
- type IntOrString
- type ObjectList
- type ObjectSlice
- type TeeMatchedFilter
Constants ¶
This section is empty.
Variables ¶
var Scheme = runtime.NewScheme()
Scheme is used globally to ensure the runtime helpers produce and consume RNodes with type metadata (kind and apiVersion) and Go typing. In general, there isn't a convenient way to parameterize the Read/Write calls (i.e. no Context), thus the global variable. By default, the scheme is loaded with the known Kubernetes API types and the types from this project (e.g Experiments).
Functions ¶
func DecodeYAMLToJSON ¶
DecodeYAMLToJSON is an alternative to `node.YNode().Decode(v)` that explicit round trips through JSON.
func FieldPath ¶
FieldPath evaluates a path template using the supplied context and then splits it into individual path segments (honoring escaped slashes).
func PreserveFieldMatcherPath ¶
func PreserveFieldMatcherPath(fieldMatcher yaml.FieldMatcher) yaml.Filter
PreserveFieldMatcherPath wraps a field matcher so the resulting nodes have their field path set accordingly (incoming path + field name).
Types ¶
type CommentClearer ¶
type CommentClearer struct { // The name of the field to remove comments from. Name string // The collection of exact matching comments to clear. yaml.Comments }
CommentClearer is filter for clearing specific comments.
func ClearFieldComment ¶
func ClearFieldComment(name string, lineComment string) CommentClearer
ClearFieldComment returns a filter which will clear matching line comments from a named field.
type ExperimentMigrationFilter ¶
type ExperimentMigrationFilter struct { }
ExperimentMigrationFilter is a KYAML filter for perform experiment migration.
func (*ExperimentMigrationFilter) Filter ¶
Filter applies migration changes to all recognized experiment nodes in the supplied list.
func (*ExperimentMigrationFilter) MigrateExperimentV1alpha1 ¶
func (f *ExperimentMigrationFilter) MigrateExperimentV1alpha1(node *yaml.RNode) (*yaml.RNode, error)
MigrateExperimentV1alpha1 converts a resource node from a v1alpha1 Experiment to a v1beta1 Experiment.
func (*ExperimentMigrationFilter) MigrateExperimentV1beta1 ¶
MigrateExperimentV1beta1 converts a resource node from a v1beta1 Experiment to the latest format.
type FieldRenamer ¶
type FieldRenamer struct { // The field to rename. From string // The target field name. To string }
FieldRenamer is a filter for renaming fields.
func RenameField ¶
func RenameField(from, to string) FieldRenamer
RenameField returns a filter that renames a field, merging the content if the "to" field already exists.
type HasFilter ¶
HasFilter is an alternative to a "tee" filter in that it applies a list of filters. However, unlike "tee" filter, if the result of the filters is nil, the final result is also nil. This allows for constructing filter pipelines that with simplified conditional logic.
type IntOrString ¶
type IntOrString struct {
intstr.IntOrString
}
func (*IntOrString) UnmarshalYAML ¶
func (is *IntOrString) UnmarshalYAML(value *yaml.Node) error
type ObjectList ¶
ObjectList allows a generic list type to be used as a KYAML writer to provide interoperability between the YAML streaming and runtime objects.
type ObjectSlice ¶
ObjectSlices allows a slice of object instances to be read as resource nodes.
type TeeMatchedFilter ¶
type TeeMatchedFilter struct { PathMatcher yaml.PathMatcher Filters []yaml.Filter }
TeeMatchedFilter is a filter that applies a set of filters to the nodes matched by a path matcher.
func TeeMatched ¶
func TeeMatched(pathMatcher yaml.PathMatcher, filters ...yaml.Filter) TeeMatchedFilter
TeeMatched acts as a "tee" filter for nodes matched by the supplied path matcher: each matched node is processed by the supplied filters and the result of the entire operation is the initial node (or an error).