Documentation ¶
Index ¶
- Constants
- func AddCommentsToManifests(packagePath, annotationPrefix string) error
- func HandleComments(filter FilterWithCallback, ...) kio.Filter
- func NewAddCommentsFilter(annotationPrefix string, ...) kio.Filter
- func NewStripCommentsFilter(annotationPrefix string, ...) kio.Filter
- func StripCommentsFromManifests(packagePath, annotationPrefix string) error
- type AddCommentsFilter
- type FilterWithCallback
- type StripCommentsFilter
Constants ¶
const DefaultAnnotationPrefix = "comment.kyaml.io/set."
Variables ¶
This section is empty.
Functions ¶
func AddCommentsToManifests ¶
func HandleComments ¶
func NewAddCommentsFilter ¶
func NewStripCommentsFilter ¶
Types ¶
type AddCommentsFilter ¶
type AddCommentsFilter struct { AnnotationPrefix string Callback func(field, oldValue, newValue string) }
AddCommentsFilter adds annotation values as comment to a field in the yaml document with the path defined in the annotation key. The key must be of the form "{AnnotationPrefix}{FieldPath}"
One known limitation is that comments can only be added to scalar fields (e.g. strings, integers, booleans), but not to maps and sequences.
Example input: ```yaml metadata:
annotations: comment.kyaml.io/set.spec.values.imageTag: '{"$imagepolicy": "flux-system:podinfo:tag"}'
spec:
values: imageTag: 5.0.0
```
Example output (AnnotationPrefix="comment.kyaml.io/set."): ```yaml metadata:
annotations: comment.kyaml.io/set.spec.values.imageTag: '{"$imagepolicy": "flux-system:podinfo:tag"}'
spec:
values: imageTag: 5.0.0 #{"$imagepolicy": "flux-system:podinfo:tag"}
```
func (*AddCommentsFilter) SetCallback ¶
func (a *AddCommentsFilter) SetCallback(cb func(field, oldValue, newValue string))
type FilterWithCallback ¶
type StripCommentsFilter ¶
type StripCommentsFilter struct { AnnotationPrefix string Callback func(field, oldValue, newValue string) }
StripCommentsFilter removes comments from fields in the yaml document as defined in the annotations. This filter is useful for cleaning up comments set by AddCommentsFilter when used in a filter pipe.
Example input: ```yaml metadata:
annotations: comment.kyaml.io/set.spec.values.imageTag: '{"$imagepolicy": "flux-system:podinfo:tag"}'
spec:
values: imageTag: 5.0.0 #{"$imagepolicy": "flux-system:podinfo:tag"}
```
Example output (AnnotationPrefix="comment.kyaml.io/set."): ```yaml metadata:
annotations: comment.kyaml.io/set.spec.values.imageTag: '{"$imagepolicy": "flux-system:podinfo:tag"}'
spec:
values: imageTag: 5.0.0
```
func (*StripCommentsFilter) SetCallback ¶
func (s *StripCommentsFilter) SetCallback(cb func(field, oldValue, newValue string))