Documentation ¶
Index ¶
Constants ¶
const ( PackageFile = "kobold.yaml" CommentPrefix = "# kobold: " DefaultImagerefTemplate = "{{ .Image }}:{{ .Tag }}@{{ .Digest }}" )
const ( TypeExact = "exact" TypeSemver = "semver" TypeRegex = "regex" )
const ( KeyType = "type" KeyTag = "tag" )
const ( KubeFieldContainerImage = "image" KubeFieldContainerName = "name" )
const ( ComposeFieldServices = "services" ComposeFieldImage = "image" )
const ( KoFieldDefaultBaseImage = "defaultBaseImage" KoFieldBaseImageOverrides = "baseImageOverrides" )
Variables ¶
This section is empty.
Functions ¶
func NewRenderer ¶
func NewRenderer(opts ...RendererOption) renderer
create a new renderer with the given options
Types ¶
type ImageNodeHandler ¶
type ImageNodeHandler struct {
// contains filtered or unexported fields
}
The ImageNodeHandler is used to encapsulate the logic of handling update nodes. It holds a template to avoid creating it on each run new
func NewImageNodeHandler ¶
func NewImageNodeHandler(t string, nameOptions ...name.Option) *ImageNodeHandler
FIXME: this panics on invalid template. There should be a better way since this function will not only run at program start
func (*ImageNodeHandler) AddNameOptions ¶
func (h *ImageNodeHandler) AddNameOptions(opts ...name.Option)
func (*ImageNodeHandler) HandleImageNode ¶
func (h *ImageNodeHandler) HandleImageNode(imgNode *yaml.MapNode, events []events.PushData) (bool, Change, error)
Check if the given map node is eligible for an image update and update the image of so. The check is based on an inline comment in the form of:
kobold: tag: [tag|semver-constraint|regex-pattern]; type: [exact|semver|regex]
If the image has been updated, change data is returned.
type ImageNodeHandlerFunc ¶
the image node handler func is responsible for handling the actual image nodes found be the resolver. It may mutate the image ref or do nothing
type NopRenderer ¶
type NopRenderer struct{}
type RendererOption ¶
type RendererOption func(r *renderer)
func WithDefaultRegistry ¶
func WithDefaultRegistry(registry string) RendererOption
the default registry will be used for any image that has no fully qualified domain name
func WithImagerefTemplate ¶
func WithImagerefTemplate(t string) RendererOption
the imageref template is used to format the new image ref when updating image nodes.
func WithScopes ¶
func WithScopes(scopes []string) RendererOption
scope this renderer to the list of glob pattern
func WithSelector ¶
func WithSelector(selector *ResolverSelector) RendererOption
the selector determines which resolver to use for a given file name
func WithWriter ¶
func WithWriter(w kio.Writer) RendererOption
type Resolver ¶
type Resolver func(node *yaml.RNode, source string, handleImage ImageNodeHandlerFunc) error
the resolver is responsible for finding one or more image node in a given yaml document
func NewCustomResolver ¶
type ResolverSelector ¶
type ResolverSelector struct {
// contains filtered or unexported fields
}
the resolver selector should return the correct resolver based on the file for example for a docker-compose.yaml, the compose resolver should be returned
func NewSelector ¶
func NewSelector(resolvers []config.ResolverSpec, associations []config.FileTypeSpec) *ResolverSelector