Documentation ¶
Overview ¶
Package chartutils implements helper functions to manipulate helm Charts
Index ¶
- Variables
- func AnnotateChart(chartPath string, opts ...Option) error
- func GetChartRoot(chartPath string) (string, error)
- func GetImageLockFilePath(chartPath string) (string, error)
- func IsRemoteChart(path string) bool
- func PullImages(lock *imagelock.ImagesLock, imagesDir string, opts ...Option) error
- func PushImages(lock *imagelock.ImagesLock, imagesDir string, opts ...Option) error
- func ReadLockFromChart(chartPath string) (*imagelock.ImagesLock, error)
- func WithAnnotationsKey(str string) func(cfg *Configuration)
- func WithArtifactsDir(dir string) func(cfg *Configuration)
- func WithAuth(username, password string) func(cfg *Configuration)
- func WithContext(ctx context.Context) func(cfg *Configuration)
- func WithFetchArtifacts(fetch bool) func(cfg *Configuration)
- func WithInsecureMode(insecure bool) func(cfg *Configuration)
- func WithLog(l log.Logger) func(cfg *Configuration)
- func WithMaxRetries(retries int) func(cfg *Configuration)
- func WithProgressBar(pb log.ProgressBar) func(cfg *Configuration)
- func WithValuesFiles(files ...string) func(cfg *Configuration)
- type Auth
- type Chart
- func (c *Chart) AbsFilePath(name string) string
- func (c *Chart) Chart() *Chart
- func (c *Chart) ChartDir() string
- func (c *Chart) ChartFullPath() string
- func (c *Chart) Dependencies() []*Chart
- func (c *Chart) File(name string) *chart.File
- func (c *Chart) GetAnnotatedImages() (imagelock.ImageList, error)
- func (c *Chart) GetImagesLock() (*imagelock.ImagesLock, error)
- func (c *Chart) ImageArtifactsDir() string
- func (c *Chart) ImagesDir() string
- func (c *Chart) LockFilePath() string
- func (c *Chart) Metadata() *chart.Metadata
- func (c *Chart) Name() string
- func (c *Chart) RootDir() string
- func (c *Chart) ValuesFiles() []*chart.File
- func (c *Chart) VerifyLock(opts ...imagelock.Option) error
- func (c *Chart) Version() string
- type Configuration
- type Option
- type ValuesImageElement
- func (v *ValuesImageElement) Name() string
- func (v *ValuesImageElement) Relocate(prefix string) error
- func (v *ValuesImageElement) ToMap() map[string]string
- func (v *ValuesImageElement) URL() string
- func (v *ValuesImageElement) YamlLocationPath() string
- func (v *ValuesImageElement) YamlReplaceMap() map[string]string
- type ValuesImageElementList
Constants ¶
This section is empty.
Variables ¶
var ErrNoImagesToAnnotate = errors.New("no container images to annotate found")
ErrNoImagesToAnnotate is returned when the chart can't be annotated because there are no container images
Functions ¶
func AnnotateChart ¶
AnnotateChart parses the values.yaml file in the chart specified by chartPath and annotates the Chart with the list of found images
func GetChartRoot ¶
GetChartRoot returns the chart root directory to the chart provided (which may point to its Chart.yaml file)
func GetImageLockFilePath ¶ added in v0.4.0
GetImageLockFilePath returns the path to the Images.lock file for the chart
func IsRemoteChart ¶ added in v0.4.0
IsRemoteChart returns true if the chart is a remote chart
func PullImages ¶
func PullImages(lock *imagelock.ImagesLock, imagesDir string, opts ...Option) error
PullImages downloads the list of images specified in the provided ImagesLock
func PushImages ¶
func PushImages(lock *imagelock.ImagesLock, imagesDir string, opts ...Option) error
PushImages push the list of images in imagesDir to the destination specified in the ImagesLock
func ReadLockFromChart ¶ added in v0.4.0
func ReadLockFromChart(chartPath string) (*imagelock.ImagesLock, error)
ReadLockFromChart reads the Images.lock file from the chart
func WithAnnotationsKey ¶
func WithAnnotationsKey(str string) func(cfg *Configuration)
WithAnnotationsKey customizes the annotations key to use when reading/writing images to the Chart.yaml
func WithArtifactsDir ¶
func WithArtifactsDir(dir string) func(cfg *Configuration)
WithArtifactsDir configures the ArtifactsDir
func WithAuth ¶ added in v0.4.0
func WithAuth(username, password string) func(cfg *Configuration)
WithAuth configures the Auth
func WithContext ¶
func WithContext(ctx context.Context) func(cfg *Configuration)
WithContext provides an execution context
func WithFetchArtifacts ¶
func WithFetchArtifacts(fetch bool) func(cfg *Configuration)
WithFetchArtifacts configures the FetchArtifacts setting
func WithInsecureMode ¶ added in v0.3.1
func WithInsecureMode(insecure bool) func(cfg *Configuration)
WithInsecureMode configures Insecure transport
func WithMaxRetries ¶
func WithMaxRetries(retries int) func(cfg *Configuration)
WithMaxRetries configures the number of retries on error
func WithProgressBar ¶
func WithProgressBar(pb log.ProgressBar) func(cfg *Configuration)
WithProgressBar provides a ProgressBar for long running operations
func WithValuesFiles ¶ added in v0.4.0
func WithValuesFiles(files ...string) func(cfg *Configuration)
WithValuesFiles customizes the values files in the chart
Types ¶
type Chart ¶
type Chart struct {
// contains filtered or unexported fields
}
Chart defines a helm Chart with extra functionalities
func (*Chart) AbsFilePath ¶
AbsFilePath returns the absolute path to the Chart relative file name
func (*Chart) ChartDir ¶
ChartDir returns the Chart root directory (required to implement wrapping.Unwrapable)
func (*Chart) ChartFullPath ¶
ChartFullPath returns the wrapped chart ChartFullPath
func (*Chart) Dependencies ¶
Dependencies returns the chart dependencies
func (*Chart) GetAnnotatedImages ¶
GetAnnotatedImages returns the chart images specified in the annotations
func (*Chart) GetImagesLock ¶ added in v0.4.0
func (c *Chart) GetImagesLock() (*imagelock.ImagesLock, error)
GetImagesLock returns the chart's ImagesLock object
func (*Chart) ImageArtifactsDir ¶
ImageArtifactsDir returns the imags artifacts directory
func (*Chart) LockFilePath ¶
LockFilePath returns the absolute path to the chart Images.lock
func (*Chart) ValuesFiles ¶ added in v0.4.0
ValuesFiles returns all the values chart.File
func (*Chart) VerifyLock ¶ added in v0.4.0
VerifyLock verifies the Images.lock file for the chart
type Configuration ¶
type Configuration struct { AnnotationsKey string Log log.Logger Context context.Context ProgressBar log.ProgressBar ArtifactsDir string FetchArtifacts bool MaxRetries int InsecureMode bool Auth Auth ValuesFiles []string }
Configuration defines configuration settings used in chartutils functions
func NewConfiguration ¶
func NewConfiguration(opts ...Option) *Configuration
NewConfiguration returns a new Configuration
type ValuesImageElement ¶
type ValuesImageElement struct { Registry string Repository string Digest string Tag string // contains filtered or unexported fields }
ValuesImageElement defines a docker image element definition found when parsing values.yaml
func (*ValuesImageElement) Name ¶
func (v *ValuesImageElement) Name() string
Name returns the image name
func (*ValuesImageElement) Relocate ¶
func (v *ValuesImageElement) Relocate(prefix string) error
Relocate modifies the ValuesImageElement Registry and Repository based on the provided prefix
func (*ValuesImageElement) ToMap ¶
func (v *ValuesImageElement) ToMap() map[string]string
ToMap returns the map[string]string representation of the ValuesImageElement
func (*ValuesImageElement) URL ¶
func (v *ValuesImageElement) URL() string
URL returns the full URL to the image
func (*ValuesImageElement) YamlLocationPath ¶
func (v *ValuesImageElement) YamlLocationPath() string
YamlLocationPath returns the jsonpath-like location of the element in values.yaml
func (*ValuesImageElement) YamlReplaceMap ¶
func (v *ValuesImageElement) YamlReplaceMap() map[string]string
YamlReplaceMap returns the yaml paths to the different image definition elements and the current value
type ValuesImageElementList ¶
type ValuesImageElementList []*ValuesImageElement
ValuesImageElementList defines a list of ValuesImageElement
func FindImageElementsInValuesFile ¶
func FindImageElementsInValuesFile(chartPath string) (ValuesImageElementList, error)
FindImageElementsInValuesFile looks for a list of ValuesImageElement in the values.yaml for the specified chartPath
func FindImageElementsInValuesMap ¶
func FindImageElementsInValuesMap(data map[string]interface{}) (ValuesImageElementList, error)
FindImageElementsInValuesMap parses the provided data looking for ValuesImageElement and returns the list
func (ValuesImageElementList) Len ¶
func (imgs ValuesImageElementList) Len() int
func (ValuesImageElementList) Less ¶
func (imgs ValuesImageElementList) Less(i, j int) bool
func (ValuesImageElementList) Swap ¶
func (imgs ValuesImageElementList) Swap(i, j int)
func (ValuesImageElementList) ToAnnotation ¶
func (imgs ValuesImageElementList) ToAnnotation() ([]byte, error)
ToAnnotation returns the annotation text representation of the ValuesImageElementList