Documentation
¶
Index ¶
- Constants
- func FindTagsToPatch(spec *ImageSpec) ([]string, error)
- func PatchChart(ctx context.Context, opts *types.Options) error
- func PatchFromConfig(ctx context.Context, configPath string, opts *types.Options) error
- type ChartImageMapping
- type ChartSpec
- type ChartTargetSpec
- type ImageSpec
- type OverrideSpec
- type PatchConfig
- type TagStrategy
- type TargetSpec
Constants ¶
const ( ExpectedAPIVersion = "copa.sh/v1alpha1" ExpectedKind = "PatchConfig" )
const ( StrategyList = "list" StrategyPattern = "pattern" StrategyLatest = "latest" )
Variables ¶
This section is empty.
Functions ¶
func FindTagsToPatch ¶
FindTagsToPatch discovers image tags based on the specified strategy in the ImageSpec.
func PatchChart ¶ added in v0.15.0
PatchChart orchestrates patching all images discovered from a single Helm chart and generating a patched wrapper chart pushed to an OCI registry.
Flow:
- Download and render the chart to discover container images
- Patch each discovered image using the existing single-image patching flow
- Build a wrapper chart with patched image overrides
- Push the wrapper chart to the configured OCI registry
Types ¶
type ChartImageMapping ¶ added in v0.15.0
type ChartImageMapping struct {
ChartName string
OriginalRepo string
OriginalTag string
PatchedRepo string
PatchedTag string
}
ChartImageMapping tracks the original→patched image mapping for chart-based patching.
type ChartSpec ¶ added in v0.15.0
type ChartSpec struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Repository string `yaml:"repository"` // "oci://..." or "https://..."
}
ChartSpec defines a Helm chart from which images should be discovered.
type ChartTargetSpec ¶ added in v0.15.0
type ChartTargetSpec struct {
Registry string `yaml:"registry"` // OCI registry for patched charts (e.g. "oci://ghcr.io/myorg/charts")
}
ChartTargetSpec defines where to push patched wrapper charts.
type ImageSpec ¶
type ImageSpec struct {
Name string `yaml:"name"`
Image string `yaml:"image"`
ChiselRelease string `yaml:"chiselRelease,omitempty"`
Tags TagStrategy `yaml:"tags"`
Target TargetSpec `yaml:"target,omitempty"`
Platforms []string `yaml:"platforms,omitempty"`
}
ImageSpec defines the configuration for patching a single image.
type OverrideSpec ¶ added in v0.15.0
type OverrideSpec struct {
From string `yaml:"from"`
To string `yaml:"to"`
ValuePath string `yaml:"valuePath,omitempty"` // Explicit values.yaml path for image override (e.g. "controller.image")
}
OverrideSpec defines a tag variant substitution for chart-discovered images. From and To are substrings of the image tag (e.g., From: "distroless-libc", To: "debian").
type PatchConfig ¶
type PatchConfig struct {
APIVersion string `yaml:"apiVersion"`
Kind string `yaml:"kind"`
ChiselRelease string `yaml:"chiselRelease,omitempty"`
Target TargetSpec `yaml:"target,omitempty"` // Default target for all images
Charts []ChartSpec `yaml:"charts,omitempty"` // Helm charts to discover images from
ChartTarget *ChartTargetSpec `yaml:"chartTarget,omitempty"` // Where to push patched wrapper charts
Overrides map[string]OverrideSpec `yaml:"overrides,omitempty"` // Tag variant overrides for chart images
Images []ImageSpec `yaml:"images,omitempty"` // Explicitly listed images
}
PatchConfig represents the top-level structure for the bulk patching configuration.
type TagStrategy ¶
type TagStrategy struct {
Strategy string `yaml:"strategy"`
Pattern string `yaml:"pattern,omitempty"`
MaxTags int `yaml:"maxTags,omitempty"`
List []string `yaml:"list,omitempty"`
Exclude []string `yaml:"exclude,omitempty"`
// contains filtered or unexported fields
}
TagStrategy defines the method for discovering image tags to be patched.
func (*TagStrategy) UnmarshalYAML ¶
func (t *TagStrategy) UnmarshalYAML(unmarshal func(interface{}) error) error
type TargetSpec ¶
type TargetSpec struct {
Registry string `yaml:"registry,omitempty"` // Target registry/namespace prefix (e.g., "ghcr.io/myorg")
Tag string `yaml:"tag,omitempty"` // Tag template (defaults to "{{ .SourceTag }}-patched")
}
TargetSpec defines how the patched image should be tagged and where it should be pushed.