Documentation ¶
Index ¶
- func Instantiate(rules *InstantiationRules, cv ocm.ComponentVersionAccess, ...) error
- func Set(content *ast.File, path string, value *ast.File) error
- func Substitute(subs Substitutions, fs vfs.FileSystem) error
- type Configuration
- type ImageMapping
- type InstantiationRules
- type Localization
- type Substitution
- type Substitutions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Instantiate ¶
func Instantiate(rules *InstantiationRules, cv ocm.ComponentVersionAccess, resolver ocm.ComponentVersionResolver, config []byte, fs vfs.FileSystem) error
func Substitute ¶
func Substitute(subs Substitutions, fs vfs.FileSystem) error
Types ¶
type Configuration ¶
type Configuration Substitution
Configuration is a request to substitute a configuration value. The specification describes substitution targets given by the file path and the YAML/JSON value paths of the elements in this file. The substitution value is calculated by the value expression (spiff) based on given config data. It has the same structure as Substitution, but is a request based on external configuration data, while a Substitution describes a fixed target value.
type ImageMapping ¶
type ImageMapping struct { // The resource reference used to resolve the substitution v1.ResourceReference `json:",inline"` // Path in target to substitute by the image tag/digest Tag string `json:"tag,omitempty"` // Path in target to substitute the image repository Repository string `json:"repository,omitempty"` // Path in target to substitute the complete image Image string `json:"image,omitempty"` }
ImageMapping describes a dedicated substitution of parts of container image names based on a relative OCM resource reference.
type InstantiationRules ¶
type InstantiationRules struct { Template v1.ResourceReference `json:"templateResource,omitempty"` LocalizationRules []Localization `json:"localizationRules,omitempty"` ConfigRules []Configuration `json:"configRules,omitempty"` ConfigScheme json.RawMessage `json:"configScheme,omitempty"` ConfigTemplate json.RawMessage `json:"configTemplate,omitempty"` ConfigLibraries []v1.ResourceReference `json:"configLibraries,omitempty"` }
InstantiationRules bundle the localization of a filesystem resource covering image localization and applying instance configuration.
type Localization ¶
type Localization struct { // The optional but unique(!) name of the mapping to support referencing mapping entries Name string `json:"name,omitempty"` // The path of the file for the substitution FilePath string `json:"file"` // The image mapping request ImageMapping `json:",inline"` }
Localization is a request to substitute an image location. The specification describes substitution targets given by the file path and the YAML/JSON value paths of the elements in this file. The substitution value is calculated from the access specification of the given resource provided by the actual component version.
type Substitution ¶
type Substitution struct { // The optional but unique(!) name of the mapping to support referencing mapping entries Name string `json:"name,omitempty"` // The path of the file for the substitution FilePath string `json:"file"` // The target path for the value substitution ValuePath string `json:"path"` // The value to set Value json.RawMessage `json:"value"` }
Substitution is a request to substitute the YAML/JSON element given by the value path in the given file path by the given direct value.
func (*Substitution) GetValue ¶
func (s *Substitution) GetValue() (interface{}, error)
type Substitutions ¶
type Substitutions []Substitution
func Configure ¶
func Configure( mappings []Configuration, cursubst []Substitution, cv ocm.ComponentVersionAccess, resolver ocm.ComponentVersionResolver, template []byte, config []byte, libraries []metav1.ResourceReference, schemedata []byte, ) (Substitutions, error)
func Localize ¶
func Localize(mappings []Localization, cv ocm.ComponentVersionAccess, resolver ocm.ComponentVersionResolver) (Substitutions, error)
func (*Substitutions) Add ¶
func (s *Substitutions) Add(name, file, path string, value interface{}) error