Documentation ¶
Index ¶
Constants ¶
const ( // This is preserved from setters2 K8sCliExtensionKey = "x-k8s-cli" // SetterShortHand is a shorthand that can be used to mark // setters; instead of // # { "$ref": "#/definitions/ SetterShortHand = "$imagepolicy" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶ added in v0.38.0
Change contains the setter that resulted in a Change, the old and the new value after the Change.
type FileResult ¶ added in v0.7.0
type FileResult struct {
Objects map[ObjectIdentifier][]ImageRef
}
FileResult gives the updates in a particular file.
type ImageRef ¶ added in v0.7.0
type ImageRef interface { // String returns a string representation of the image ref as it // is used in the update; e.g., "helloworld:v1.0.1" String() string // Identifier returns the tag or digest; e.g., "v1.0.1" Identifier() string // Repository returns the repository component of the ImageRef, // with an implied defaults, e.g., "library/helloworld" Repository() string // Registry returns the registry component of the ImageRef, e.g., // "index.docker.io" Registry() string // Name gives the fully-qualified reference name, e.g., // "index.docker.io/library/helloworld:v1.0.1" Name() string // Policy gives the namespaced name of the image policy that led // to the update. Policy() types.NamespacedName }
ImageRef represents the image reference used to replace a field value in an update.
type ObjectChanges ¶ added in v0.38.0
type ObjectChanges map[ObjectIdentifier][]Change
ObjectChanges contains all the changes made to objects.
type ObjectIdentifier ¶ added in v0.7.0
type ObjectIdentifier struct {
yaml.ResourceIdentifier
}
ObjectIdentifier holds the identifying data for a particular object. This won't always have a name (e.g., a kustomization.yaml).
type Result ¶ added in v0.7.0
type Result struct {
Files map[string]FileResult
}
Result reports the outcome of an automated update. It has a nested structure file->objects->images. Different projections (e.g., all the images, regardless of object) are available via methods.
func UpdateWithSetters ¶
func UpdateWithSetters(tracelog logr.Logger, inpath, outpath string, policies []imagev1_reflect.ImagePolicy) (Result, error)
UpdateWithSetters takes all YAML files from `inpath`, updates any that contain an "in scope" image policy marker, and writes files it updated (and only those files) back to `outpath`.
func (Result) Images ¶ added in v0.7.0
Images returns all the images that were involved in at least one update.
func (Result) Objects ¶ added in v0.7.0
func (r Result) Objects() map[ObjectIdentifier][]ImageRef
Objects returns a map of all the objects against the images updated within, regardless of which file they appear in.
type ResultV2 ¶ added in v0.38.0
type ResultV2 struct { ImageResult Result FileChanges map[string]ObjectChanges }
ResultV2 contains Result of update and also the file changes made during the update. This extends the Result to include details about the exact changes made to the files and the objects in them. It has a nested structure file->objects->changes.
func UpdateV2WithSetters ¶ added in v0.38.0
func UpdateV2WithSetters(tracelog logr.Logger, inpath, outpath string, policies []imagev1_reflect.ImagePolicy) (ResultV2, error)
UpdateV2WithSetters takes all YAML files from `inpath`, updates any that contain an "in scope" image policy marker, and writes files it updated (and only those files) back to `outpath`. It also returns the result of the changes it made as ResultV2.
func (*ResultV2) AddChange ¶ added in v0.38.0
func (r *ResultV2) AddChange(file string, objectID ObjectIdentifier, changes ...Change)
AddChange adds changes to Resultv2 for a given file, object and changes associated with it.
func (ResultV2) Changes ¶ added in v0.38.0
Changes returns all the changes that were made in at least one update.
func (ResultV2) Objects ¶ added in v0.38.0
func (r ResultV2) Objects() ObjectChanges
Objects returns ObjectChanges, regardless of which file they appear in.
type ScreeningLocalReader ¶ added in v0.2.0
type ScreeningLocalReader struct { Token string Path string Trace logr.Logger // This records the relative path of each file that passed // screening (i.e., contained the token), but couldn't be parsed. ProblemFiles []string }
ScreeningReader is a kio.Reader that includes only files that are pertinent to automation. In practice this means looking for a particular token in each file, and ignoring those files without the token. This avoids most problematic cases -- e.g., templates in a Helm chart, which won't parse as YAML -- and cheaply filters for only those files that need processing.
func (*ScreeningLocalReader) Read ¶ added in v0.2.0
func (r *ScreeningLocalReader) Read() ([]*yaml.RNode, error)
Read scans the .Path recursively for files that contain .Token, and parses any that do. It applies the filename annotation used by [`kio.LocalPackageWriter`](https://godoc.org/sigs.k8s.io/kustomize/kyaml/kio#LocalPackageWriter) so that the same will write files back to their original location. The implementation follows that of [LocalPackageReader.Read](https://godoc.org/sigs.k8s.io/kustomize/kyaml/kio#LocalPackageReader.Read), adapting lightly (mainly to leave features out).
type SetAllCallback ¶ added in v0.8.0
type SetAllCallback struct { SettersSchema *spec.Schema Callback func(setter, oldValue, newValue string) Trace logr.Logger }
func (*SetAllCallback) TraceOrDiscard ¶ added in v0.14.0
func (s *SetAllCallback) TraceOrDiscard() logr.Logger