Documentation
¶
Index ¶
- Constants
- Variables
- func IsHelmOciRepo(repoURL string) bool
- func IsMissingDependencyErr(err error) bool
- func ValidateReleaseName(name string) error
- func Version() (string, error)
- type AzureWorkloadIdentityCreds
- func (creds AzureWorkloadIdentityCreds) GetAccessToken() (string, error)
- func (creds AzureWorkloadIdentityCreds) GetCAPath() string
- func (creds AzureWorkloadIdentityCreds) GetCertData() []byte
- func (creds AzureWorkloadIdentityCreds) GetInsecureSkipVerify() bool
- func (creds AzureWorkloadIdentityCreds) GetKeyData() []byte
- func (creds AzureWorkloadIdentityCreds) GetPassword() (string, error)
- func (creds AzureWorkloadIdentityCreds) GetUsername() string
- type Client
- type ClientOpts
- type Cmd
- func (c *Cmd) Close()
- func (c *Cmd) Fetch(repo, chartName, version, destination string, creds Creds, ...) (string, error)
- func (c *Cmd) Freestyle(args ...string) (string, error)
- func (c *Cmd) InspectChart() (string, error)
- func (c *Cmd) PullOCI(repo string, chart string, version string, destination string, creds Creds, ...) (string, error)
- func (c *Cmd) RegistryLogin(ctx context.Context, repo string, creds Creds, plainHTTP bool) (string, error)
- func (c *Cmd) RegistryLogout(repo string, _ Creds) (string, error)
- func (c *Cmd) RepoAdd(name string, url string, opts Creds, passCredentials bool) (string, error)
- type Creds
- type Entries
- type Entry
- type Helm
- type HelmCreds
- type HelmRepository
- type Index
- type TemplateOpts
Constants ¶
const ( ResourcePolicyAnnotation = "helm.sh/resource-policy" ResourcePolicyKeep = "keep" )
Variables ¶
var (
ErrOCINotEnabled = errors.New("could not perform the action when oci is not enabled")
)
Functions ¶
func IsHelmOciRepo ¶
Ensures that given OCI registries URL does not have protocol
func IsMissingDependencyErr ¶
IsMissingDependencyErr tests if the error is related to a missing chart dependency
func ValidateReleaseName ¶ added in v3.4.15
ValidateReleaseName ensures a Helm release name is well-formed before it is handed to the helm binary.
This is a security control, not merely input hygiene. The release name is attacker-controlled via spec.source.helm.releaseName (and via a repository's .argocd-source.yaml). It must never be able to reach a Helm flag that is evaluated as a Go template, because Helm's template engine exposes the sprig function library, including env() and getHostByName(), which would disclose the repo-server's process environment and permit DNS egress.
This is enforced at the point of use in template(), so that every caller is covered. It is exported so callers can additionally validate earlier and report which field was at fault.
Types ¶
type AzureWorkloadIdentityCreds ¶
type AzureWorkloadIdentityCreds struct {
CAPath string
CertData []byte
KeyData []byte
InsecureSkipVerify bool
// contains filtered or unexported fields
}
func NewAzureWorkloadIdentityCreds ¶
func NewAzureWorkloadIdentityCreds(repoURL string, caPath string, certData []byte, keyData []byte, insecureSkipVerify bool, tokenProvider workloadidentity.TokenProvider) AzureWorkloadIdentityCreds
func (AzureWorkloadIdentityCreds) GetAccessToken ¶
func (creds AzureWorkloadIdentityCreds) GetAccessToken() (string, error)
func (AzureWorkloadIdentityCreds) GetCAPath ¶
func (creds AzureWorkloadIdentityCreds) GetCAPath() string
func (AzureWorkloadIdentityCreds) GetCertData ¶
func (creds AzureWorkloadIdentityCreds) GetCertData() []byte
func (AzureWorkloadIdentityCreds) GetInsecureSkipVerify ¶
func (creds AzureWorkloadIdentityCreds) GetInsecureSkipVerify() bool
func (AzureWorkloadIdentityCreds) GetKeyData ¶
func (creds AzureWorkloadIdentityCreds) GetKeyData() []byte
func (AzureWorkloadIdentityCreds) GetPassword ¶
func (creds AzureWorkloadIdentityCreds) GetPassword() (string, error)
func (AzureWorkloadIdentityCreds) GetUsername ¶
func (creds AzureWorkloadIdentityCreds) GetUsername() string
type Client ¶
type Client interface {
CleanChartCache(chart string, version string) error
ExtractChart(ctx context.Context, chart string, version string, passCredentials bool, manifestMaxExtractedSize int64, disableManifestMaxExtractedSize bool) (string, utilio.Closer, error)
GetIndex(ctx context.Context, noCache bool, maxIndexSize int64) (*Index, error)
GetTags(ctx context.Context, chart string, noCache bool) ([]string, error)
TestHelmOCI(ctx context.Context) (bool, error)
}
type ClientOpts ¶
type ClientOpts func(c *nativeHelmChart)
func WithChartPaths ¶
func WithChartPaths(chartPaths utilio.TempPaths) ClientOpts
func WithHelmChartCacheExpiration ¶ added in v3.6.0
func WithHelmChartCacheExpiration(helmChartCacheExpiration time.Duration) ClientOpts
WithHelmChartCacheExpiration sets the cache expiration duration for chart cache.
func WithIndexCache ¶
func WithIndexCache(indexCache indexCache) ClientOpts
func WithPlainHTTP ¶ added in v3.5.0
func WithPlainHTTP() ClientOpts
WithPlainHTTP configures the client to use plain HTTP instead of HTTPS for OCI registry operations.
func WithUserAgent ¶ added in v3.4.0
func WithUserAgent(userAgent string) ClientOpts
WithUserAgent sets a custom User-Agent string for HTTP requests. If not set, a default User-Agent will be generated automatically.
type Cmd ¶
type Cmd struct {
WorkDir string
IsLocal bool
IsHelmOci bool
// contains filtered or unexported fields
}
A thin wrapper around the "helm" command, adding logging and error translation.
func NewCmdWithVersion ¶
func (*Cmd) InspectChart ¶
func (*Cmd) RegistryLogin ¶
type Helm ¶
type Helm interface {
// Template returns a list of unstructured objects from a `helm template` command
Template(opts *TemplateOpts) (string, string, error)
// GetParameters returns a list of chart parameters taking into account values in provided YAML files.
GetParameters(valuesFiles []pathutil.ResolvedFilePath, appPath, repoRoot string) (map[string]string, error)
// DependencyBuild runs `helm dependency build` to download a chart's dependencies
DependencyBuild(ctx context.Context) error
// Dispose deletes temp resources
Dispose()
}
Helm provides wrapper functionality around the `helm` command.
type HelmCreds ¶
type HelmCreds struct {
Username string
Password string
CAPath string
CertData []byte
KeyData []byte
InsecureSkipVerify bool
}
func (HelmCreds) GetCertData ¶
func (HelmCreds) GetInsecureSkipVerify ¶
func (HelmCreds) GetKeyData ¶
func (HelmCreds) GetPassword ¶
func (HelmCreds) GetUsername ¶
type HelmRepository ¶
type TemplateOpts ¶
type TemplateOpts struct {
Name string
Namespace string
KubeVersion string
APIVersions []string
Set map[string]string
SetString map[string]string
SetFile map[string]pathutil.ResolvedFilePath
Values []pathutil.ResolvedFilePath
// ExtraValues is the randomly-generated path to the temporary values file holding the contents of
// spec.source.helm.values/valuesObject.
ExtraValues pathutil.ResolvedFilePath
SkipCrds bool
SkipSchemaValidation bool
SkipTests bool
}