chart

package
v1.147.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 20 Imported by: 93

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InjectImages

func InjectImages(values map[string]any, v imagevector.ImageVector, names []string, opts ...imagevector.FindOptionFunc) (map[string]any, error)

InjectImages finds the images with the given names and opts, makes a shallow copy of the given Values and injects a name to image string mapping at the `images` key of that map and returns it.

func RenderHelmValues

func RenderHelmValues(ctx context.Context, c client.Client, helmValues map[string]any, sourceNamespace string, refs []gardencorev1.NamedResourceReference) (map[string]any, error)

RenderHelmValues resolves the given resource references and substitutes them into the provided Helm values.

func ResourceNamesFromValues

func ResourceNamesFromValues(values *apiextensionsv1.JSON) (sets.Set[string], error)

ResourceNamesFromValues returns the names of all resources referenced in the given values via template expressions like `{{ .resources.<name>.data.<key> }}`. The values are walked structurally, so only references that appear as a complete template expression inside an individual string (map key or value) are recognized.

func SubstituteTemplateInValues

func SubstituteTemplateInValues(values map[string]any, resources Resources) (map[string]any, error)

SubstituteTemplateInValues walks the given values structure and renders any string (both map keys and values) as Go templates with the provided resource references as template data. Non-string scalars are left untouched. The resulting structure has the same shape as the input. Templates can reference resolved data via `{{ .resources.<name>.data.<key> }}`.

Types

type Chart

type Chart struct {
	Name       string
	Path       string
	EmbeddedFS embed.FS
	Images     []string
	Objects    []*Object
	SubCharts  []*Chart
}

Chart represents a Helm chart (and its sub-charts) that can be applied and deleted.

func (*Chart) Apply

func (c *Chart) Apply(
	ctx context.Context,
	chartApplier kubernetesclient.ChartApplier,
	namespace string,
	imageVector imagevector.ImageVector,
	runtimeVersion, targetVersion string,
	additionalValues map[string]any,
) error

Apply applies this chart in the given namespace using the given ChartApplier. Before applying the chart, it collects its values, injecting images and merging the given values as needed.

func (*Chart) Delete

func (c *Chart) Delete(ctx context.Context, client client.Client, namespace string) error

Delete deletes this chart's objects from the given namespace using the given client.

func (*Chart) Render

func (c *Chart) Render(
	chartRenderer chartrenderer.Interface,
	namespace string,
	imageVector imagevector.ImageVector,
	runtimeVersion, targetVersion string,
	additionalValues map[string]any,
) (
	string,
	[]byte,
	error,
)

Render renders this chart in the given namespace using the given chartRenderer. Before rendering the chart, it collects its values, injecting images and merging the given values as needed.

type Interface added in v1.8.0

type Interface interface {
	// Apply applies this chart in the given namespace using the given ChartApplier. Before applying the chart,
	// it collects its values, injecting images and merging the given values as needed.
	Apply(context.Context, kubernetesclient.ChartApplier, string, imagevector.ImageVector, string, string, map[string]any) error
	// Render renders this chart in the given namespace using the given chartRenderer. Before rendering the chart,
	// it collects its values, injecting images and merging the given values as needed.
	Render(chartrenderer.Interface, string, imagevector.ImageVector, string, string, map[string]any) (string, []byte, error)
	// Delete deletes this chart's objects from the given namespace.
	Delete(context.Context, client.Client, string) error
}

Interface represents a Helm chart that can be applied and deleted.

type Object

type Object struct {
	Type client.Object
	Name string
}

Object represents an object deployed by a Chart.

func (*Object) Delete

func (o *Object) Delete(ctx context.Context, c client.Client, namespace string) error

Delete deletes this object from the given namespace using the given client.

type ResourceData

type ResourceData struct {
	// Data contains the Data entries of the referenced resource as plain strings.
	Data map[string]string `json:"data,omitempty"`
}

ResourceData holds the resolved data of a single resource reference (a Secret or ConfigMap).

type Resources

type Resources map[string]ResourceData

Resources holds the resolved data for a list of NamedResourceReferences, keyed by reference name.

func ResolveResources

func ResolveResources(ctx context.Context, c client.Client, sourceNamespace string, refs []gardencorev1.NamedResourceReference) (Resources, error)

ResolveResources fetches the referenced Secrets and ConfigMaps from the source namespace. Only references to Secrets and ConfigMaps in the core/v1 API group are supported.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL