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 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 highest available tag matching version v in repository r. Returns an error if the remote repository itself returns an error, for instance if the OCI repository is not found. If no error is returned, it is the caller's responsibility to check that the returned tag is non-empty.
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 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