Documentation
¶
Overview ¶
Package helm provides functionality for interacting with Helm charts.
This package implements operations such as chart templating, chart pulling, and dependency resolution. It abstracts away the complexities of working with Helm charts and provides a simplified interface for consumers to template, extract, and process charts.
Index ¶
- Variables
- func NewNopCloser() io.Closer
- type CRDGenerator
- type Chart
- type ChartClient
- type ChartFiles
- func (c *ChartFiles) Dispose()
- func (c *ChartFiles) GetCRDFiles(gen CRDGenerator, match func(string) bool) ([]*unstructured.Unstructured, error)
- func (c *ChartFiles) GetCRDOutput() ([]*unstructured.Unstructured, error)
- func (c *ChartFiles) GetValuesJSONSchema(gen JSONSchemaGenerator, match func(string) bool) ([]byte, error)
- type Client
- type InlineCloser
- type JSONSchemaGenerator
- type KeyLocker
- type LimitReaderUnexpectedEOFError
- type NopCloser
- type PathCacher
- type PulledChart
- type TemplateOpts
Constants ¶
This section is empty.
Variables ¶
var ( ErrChartPull = errors.New("error pulling chart") ErrChartTemplate = errors.New("error templating chart") ErrChartLoad = errors.New("error loading chart") ErrChartTemplateParse = errors.New("error parsing chart template output") )
var ( ErrNoMatcher = errors.New("no matcher provided") ErrChartExtract = errors.New("error extracting chart") )
var ( ErrFailedFileRead = errors.New("failed to read file") ErrFailedFileWrite = errors.New("failed to write file") ErrFailedFileClose = errors.New("failed to close file") ErrIteratingTar = errors.New("error iterating on tar reader") )
var ( ErrChartDependency = errors.New("error in chart dependency") ErrChartWorkerFailed = errors.New("chart worker failed") )
var ( DefaultClient = MustNewClient( paths.NewStaticTempPaths(filepath.Join(os.TempDir(), "charts"), paths.NewBase64PathEncoder()), os.Getenv("ARGOCD_APP_PROJECT_NAME"), ) )
Functions ¶
func NewNopCloser ¶
Types ¶
type CRDGenerator ¶
type CRDGenerator interface {
FromPaths(paths ...string) ([]*unstructured.Unstructured, error)
}
type Chart ¶
type Chart struct {
Client ChartClient
Repos helmrepo.Getter
TemplateOpts *TemplateOpts
}
func NewChart ¶
func NewChart(client ChartClient, repos helmrepo.Getter, opts *TemplateOpts) (*Chart, error)
NewChart creates a new Chart.
func (*Chart) Template ¶
func (c *Chart) Template(ctx context.Context) ([]*unstructured.Unstructured, error)
Template templates the Helm Chart. The chart.Chart and its dependencies are pulled as needed. The rendered output is then split into individual Kubernetes objects and returned as a slice of unstructured.Unstructured.
type ChartClient ¶
type ChartFiles ¶
type ChartFiles struct {
Client ChartClient
TemplateOpts *TemplateOpts
// contains filtered or unexported fields
}
func NewChartFiles ¶
func NewChartFiles( client ChartClient, repos helmrepo.Getter, maxSize *resource.Quantity, opts *TemplateOpts, ) (*ChartFiles, error)
func (*ChartFiles) Dispose ¶
func (c *ChartFiles) Dispose()
func (*ChartFiles) GetCRDFiles ¶
func (c *ChartFiles) GetCRDFiles(gen CRDGenerator, match func(string) bool) ([]*unstructured.Unstructured, error)
func (*ChartFiles) GetCRDOutput ¶
func (c *ChartFiles) GetCRDOutput() ([]*unstructured.Unstructured, error)
func (*ChartFiles) GetValuesJSONSchema ¶
func (c *ChartFiles) GetValuesJSONSchema(gen JSONSchemaGenerator, match func(string) bool) ([]byte, error)
GetValuesJSONSchema pulls a Helm chart using the provided TemplateOpts, and then uses the JSONSchemaGenerator to generate a JSON Schema using one or more files from the chart. The [match] function can be used to match a subset of the pulled files in the chart directory for JSON Schema generation.
type Client ¶
type Client struct {
Paths PathCacher
RepoLock KeyLocker
MaxExtractSize resource.Quantity
Project string
Proxy string
NoProxy string
// contains filtered or unexported fields
}
func MustNewClient ¶
func MustNewClient(pc PathCacher, project string) *Client
MustNewClient runs NewClient and panics on any errors.
func (*Client) CleanChartCache ¶
func (*Client) Pull ¶
func (c *Client) Pull(ctx context.Context, chart, repo, version string, repos helmrepo.Getter) (*PulledChart, error)
Pull pulls the Helm chart and returns the path to the chart directory or .tar.gz file. Pulled charts will be stored in the injected PathCacher, and subsequent requests will try to use PathCacher rather than re-pulling the chart.
type InlineCloser ¶
type InlineCloser struct {
// contains filtered or unexported fields
}
func (*InlineCloser) Close ¶
func (c *InlineCloser) Close() error
type JSONSchemaGenerator ¶
type LimitReaderUnexpectedEOFError ¶
type LimitReaderUnexpectedEOFError struct {
MaxSize int64
}
func (LimitReaderUnexpectedEOFError) Error ¶
func (l LimitReaderUnexpectedEOFError) Error() string
type PathCacher ¶
type PulledChart ¶
type PulledChart struct {
// contains filtered or unexported fields
}
PulledChart represents a Helm chart.tar.gz, or the root directory of a Helm chart. It is typically created via Client.Pull.
func (*PulledChart) Extract ¶
Extract will extract the chart (if it is a .tar.gz file), and return the path to the extracted chart. An io.Closer is also returned, calling Close() will clean up the extracted chart. If PulledChart references a directory, the the path to the directory and a NopCloser is returned.
func (*PulledChart) Load ¶
Load will load the Helm chart into a chart.Chart. If PulledChart references a .tar.gz, it will be loaded directly into memory without extracting the files to disk. If PulledChart references a directory, the contents of the chart will be loaded from the filesystem. No closer is returned by this method, since no temporary files are created.
type TemplateOpts ¶
type TemplateOpts struct {
ValuesObject map[string]any
Proxy string
TargetRevision string
RepoURL string
ReleaseName string
Namespace string
ChartName string
KubeVersion string
NoProxy string
APIVersions []string
Timeout time.Duration
SkipCRDs bool
PassCredentials bool
SkipSchemaValidation bool
SkipHooks bool
}