Link Search Menu Expand Document


Source code

// Artifact represents the artifact that can be passed between transformers
type Artifact struct {
	Name        string               `yaml:"name,omitempty" json:"name,omitempty"`
	Type        ArtifactType         `yaml:"type,omitempty" json:"type,omitempty"`
	ProcessWith metav1.LabelSelector `yaml:"processWith,omitempty" json:"processWith,omitempty"` // Selector for choosing transformers that should process this artifact, empty is everything

	Paths   map[PathType][]string      `yaml:"paths,omitempty" json:"paths,omitempty" m2kpath:"normal"`
	Configs map[ConfigType]interface{} `yaml:"configs,omitempty" json:"config,omitempty"` // Could be IR or template config or any custom configuration

Transformers take as input arrays of artifacts and return an array of artifacts. Each artifact is an object. In order to write transformers effectively we need to understand the fields of this object.

  • name : string - This field contains the name of the artifact.
  • type : string - This field contains the type of the artifact. We can put any artifact type we want. Transformers consume artifacts based on their type, so custom artifact types can only be consumed by custom transformers which understand them. Example built-in artifact types: IR, KubernetesYamls, Dockerfile, etc.
  • processWith : object - This field is same as the Kubernetes label selector field. See
  • paths : object ([string]: []string) - This field contains a mapping from file type to a list of directories containing files of that type.
    • The key is a string containing the file type.
    • The value is a list of strings/paths to directories containing files of that type.
  • configs : object ([string]: any) - This field contains a mapping between different types of configuration and the configuration data.