Documentation
¶
Overview ¶
Package bundlereader creates a bundle from a source and adds all the referenced resources, as well as image scans.
Index ¶
- Variables
- func ChartURL(ctx context.Context, location fleet.HelmOptions, auth Auth) (string, error)
- func ChartVersion(ctx context.Context, location fleet.HelmOptions, a Auth) (string, error)
- func GetContent(ctx context.Context, base, source, version string, auth Auth, ...) (map[string][]byte, error)
- func GetManifestFromHelmChart(ctx context.Context, c client.Reader, bd *fleet.BundleDeployment) (*manifest.Manifest, error)
- func GetOCITag(ctx context.Context, r *remote.Repository, v string) (string, error)
- func NewBundle(ctx context.Context, name, baseDir, file string, opts *Options) (*fleet.Bundle, []*fleet.ImageScan, error)
- type Auth
- type NoMatchingTagError
- type Options
- type Style
Constants ¶
This section is empty.
Variables ¶
var ( // MaxDecompressedBytes caps the total uncompressed bytes accepted from a // single archive. This prevents a compressed archive ("zip bomb") from // exhausting disk space. 2 GB is generous for the chart/bundle use case. MaxDecompressedBytes int64 = 2 * 1024 * 1024 * 1024 // MaxArchiveFiles caps the number of entries extracted from a single archive. MaxArchiveFiles = 100_000 )
var MaxCompressedBytes int64 = 2 * 1024 * 1024 * 1024
MaxCompressedBytes caps the total number of compressed bytes accepted from a single download. It applies uniformly to all archive formats and prevents an arbitrarily large server response from consuming CPU and disk I/O before the total per-archive decompressed limit (MaxDecompressedBytes) enforced during extraction has a chance to fire.
Functions ¶
func ChartURL ¶ added in v0.14.4
ChartURL returns the URL to the helm chart from a helm repo server, by inspecting the repo's index.yaml
func ChartVersion ¶ added in v0.12.0
ChartVersion returns the version of the helm chart from a helm repo server, by inspecting the repo's index.yaml
func GetContent ¶
func GetContent(ctx context.Context, base, source, version string, auth Auth, disableDepsUpdate bool, ignoreApplyConfigs []string) (map[string][]byte, error)
GetContent uses fetchToDir (and Helm for OCI) to read the files from directories and servers.
func GetManifestFromHelmChart ¶ added in v0.12.0
func GetManifestFromHelmChart(ctx context.Context, c client.Reader, bd *fleet.BundleDeployment) (*manifest.Manifest, error)
GetManifestFromHelmChart downloads the given helm chart and creates a manifest with its contents. This is used by the agent to deploy HelmOps.
func GetOCITag ¶ added in v0.13.1
GetOCITag fetches the tag matching version v in repository r, and returns it spelled as semver, so that Helm can pull it.
A fully specified version only matches tags holding that version. Spelling out build metadata pins a single build, so that only the tag publishing it matches; leaving the metadata out matches every build of the version, and the highest one wins, as a registry following the convention publishes the chart under its build rather than under the bare version. If v is a constraint, the highest matching tag is returned, build metadata breaking ties between tags semver considers equal. An empty v means any version, as it does for Helm.
Returns an error if no tag matches, or if the remote repository itself returns one, for instance if the OCI repository is not found.
func NewBundle ¶ added in v0.13.0
func NewBundle(ctx context.Context, name, baseDir, file string, opts *Options) (*fleet.Bundle, []*fleet.ImageScan, error)
NewBundle reads the fleet.yaml, from stdin, or basedir, or a file in basedir. Then it reads/downloads all referenced resources. It returns the populated bundle and any existing imagescans.
Types ¶
type Auth ¶
type Auth struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
CABundle []byte `json:"caBundle,omitempty"`
SSHPrivateKey []byte `json:"sshPrivateKey,omitempty"`
SSHKnownHosts []byte `json:"sshKnownHosts,omitempty"`
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
BasicHTTP bool `json:"basicHTTP,omitempty"`
}
func ReadHelmAuthFromSecret ¶ added in v0.12.0
type NoMatchingTagError ¶
type NoMatchingTagError struct {
Version string
}
NoMatchingTagError reports that a registry listed the tags of a repository and none of them holds the version asked for. It tells that apart from the tags being out of reach, which leaves the matching tag unknown rather than absent.
func (*NoMatchingTagError) Error ¶
func (e *NoMatchingTagError) Error() string
type Options ¶
type Options struct {
BundleFile string
Compress bool
Labels map[string]string
ServiceAccount string
TargetsFile string
TargetNamespace string
Paused bool
SyncGeneration int64
Auth Auth
HelmRepoURLRegex string
KeepResources bool
DeleteNamespace bool
CorrectDrift *fleet.CorrectDrift
ImagescanEnabled bool
}
Options include the GitRepo overrides, which are passed via command line args
type Style ¶
type Style struct {
ChartPath string
KustomizePath string
HasChartYAML bool
Options fleet.BundleDeploymentOptions
}
func DetermineStyle ¶
func DetermineStyle(m *manifest.Manifest, options fleet.BundleDeploymentOptions) Style