Documentation ¶
Index ¶
- Variables
- func DecodeYAMLToJSON(node *yaml.RNode, v interface{}) error
- func FieldPath(p string, data map[string]string) ([]string, error)
- func PathMatcher(p ...string) yaml.PathMatcher
- func PreserveFieldMatcherPath(fieldMatcher yaml.FieldMatcher) yaml.Filter
- type CommentClearer
- type ExperimentMigrationFilter
- func (f *ExperimentMigrationFilter) Filter(node *yaml.RNode) (*yaml.RNode, error)
- func (f *ExperimentMigrationFilter) MayNeedConversionFromV1alpha1(node *yaml.RNode) (*yaml.RNode, error)
- func (f *ExperimentMigrationFilter) MigrateApplicationV1alpha1(node *yaml.RNode) (*yaml.RNode, error)
- func (f *ExperimentMigrationFilter) MigrateExperimentV1alpha1(node *yaml.RNode) (*yaml.RNode, error)
- func (f *ExperimentMigrationFilter) MigrateExperimentV1beta1(node *yaml.RNode) (*yaml.RNode, error)
- func (f *ExperimentMigrationFilter) MigrateExperimentV1beta2(node *yaml.RNode) (*yaml.RNode, error)
- func (f *ExperimentMigrationFilter) MigrateRSOApplicationV1alpha1(node *yaml.RNode) (*yaml.RNode, error)
- type FieldRenamer
- type HasFilter
- type MetadataMigrationFilter
- type ObjectList
- type ObjectSlice
- type PrefixClearer
- 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 PathMatcher ¶
func PathMatcher(p ...string) yaml.PathMatcher
PathMatcher returns a `yaml.PathMatcher` from the supplied path.
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 {
ApplicationsAPI applications.API
}
ExperimentMigrationFilter is a KYAML filter for performing experiment migration.
func (*ExperimentMigrationFilter) Filter ¶
Filter applies migration changes to all recognized experiment nodes in the supplied list.
func (*ExperimentMigrationFilter) MayNeedConversionFromV1alpha1 ¶ added in v2.0.1
func (f *ExperimentMigrationFilter) MayNeedConversionFromV1alpha1(node *yaml.RNode) (*yaml.RNode, error)
MayNeedConversionFromV1alpha1 mimics the legacy conversion behavior of checking for a "spec.template" field to determine if an Experiment should be treated as if the version were "v1alpha1".
func (*ExperimentMigrationFilter) MigrateApplicationV1alpha1 ¶
func (f *ExperimentMigrationFilter) MigrateApplicationV1alpha1(node *yaml.RNode) (*yaml.RNode, error)
MigrateApplicationV1alpha1 converts a resource node from a v1alpha1 Application to the latest format.
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 a v1beta2 Experiment.
func (*ExperimentMigrationFilter) MigrateExperimentV1beta2 ¶
MigrateExperimentV1beta2 converts a resource node from a v1beta2 Experiment to the latest format.
func (*ExperimentMigrationFilter) MigrateRSOApplicationV1alpha1 ¶
func (f *ExperimentMigrationFilter) MigrateRSOApplicationV1alpha1(node *yaml.RNode) (*yaml.RNode, error)
MigrateRSOApplicationV1alpha1 converts a resource node from an apps.redskyops.dev/v1alpha1 Application to a v1alpha1 Application.
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 MetadataMigrationFilter ¶
type MetadataMigrationFilter struct { }
MetadataMigrationFilter is a KYAML filter for performing label/annotation migration.
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 PrefixClearer ¶
type PrefixClearer struct {
Value string
}
PrefixClearer removes a prefix from a node value.
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).