bundler

package
v0.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package bundler provides orchestration for generating deployment bundles from recipes.

The bundler package generates deployment-ready artifacts (Helm per-component bundles or Argo CD applications) from recipe configurations. Component configuration is loaded from the declarative component registry (recipes/registry.yaml).

Architecture

  • DefaultBundler: Generates Helm per-component bundles or Argo CD applications
  • Component Registry: Declarative configuration in recipes/registry.yaml
  • Deployers: Helm (default) and Argo CD output formats
  • result.Output: Aggregated generation results

Quick Start

b, err := bundler.New()
output, err := b.Make(ctx, recipeResult, "./bundle")
fmt.Printf("Generated: %d files\n", output.TotalFiles)

With options:

cfg := config.NewConfig(
    config.WithDeployer(config.DeployerHelm),
    config.WithIncludeChecksums(true),
)
b, err := bundler.New(bundler.WithConfig(cfg))

Supported Components

Components are defined in recipes/registry.yaml:

  • gpu-operator: NVIDIA GPU Operator
  • network-operator: NVIDIA Network Operator
  • nvidia-dra-driver-gpu: NVIDIA DRA Driver
  • cert-manager: Certificate Manager
  • nvsentinel: NVSentinel
  • nodewright-operator: Nodewright node optimization

Output Formats

Helm (default):

  • README.md: Root deployment guide with ordered steps
  • deploy.sh: Automation script (0755)
  • undeploy.sh: Reverse-order uninstall script (0755)
  • recipe.yaml: Copy of the input recipe
  • NNN-<component>/install.sh: Per-folder install script
  • NNN-<component>/values.yaml: Static Helm values
  • NNN-<component>/cluster-values.yaml: Per-cluster dynamic values
  • NNN-<component>/upstream.env: CHART/REPO/VERSION (upstream-helm folders)
  • NNN-<component>/Chart.yaml + templates/: Local chart (local-helm folders)

Argo CD:

  • app-of-apps.yaml: Parent Argo CD Application
  • <component>/application.yaml: Argo CD Application per component
  • <component>/values.yaml: Values for each component

Configuration

cfg := config.NewConfig(
    config.WithDeployer(config.DeployerHelm),
    config.WithIncludeReadme(true),
    config.WithSystemNodeSelector(map[string]string{"node-role": "system"}),
)
b, err := bundler.New(bundler.WithConfig(cfg))

Adding New Components

To add a new component, add an entry to recipes/registry.yaml. No Go code is required.

Helm Component Example:

  • name: my-component displayName: My Component valueOverrideKeys: [mycomponent] helm: defaultRepository: https://charts.example.com defaultChart: example/my-component nodeScheduling: system: nodeSelectorPaths: [operator.nodeSelector]

Kustomize Component Example:

  • name: my-kustomize-app displayName: My Kustomize App valueOverrideKeys: [mykustomize] kustomize: defaultSource: https://github.com/example/my-app defaultPath: deploy/production defaultTag: v1.0.0

Note: A component must have either 'helm' OR 'kustomize' configuration, not both.

See https://github.com/NVIDIA/aicr for more information.

Index

Constants

View Source
const DefaultBundleTimeout = defaults.BundleHandlerTimeout

DefaultBundleTimeout is the timeout for bundle generation. Exported for backwards compatibility; prefer using defaults.BundleHandlerTimeout.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultBundler

type DefaultBundler struct {
	// Config provides bundler-specific configuration including value overrides.
	Config *config.Config

	// AllowLists defines which criteria values are permitted for bundle requests.
	// When set, the bundler validates that the recipe's criteria are within the allowed values.
	AllowLists *recipe.AllowLists

	// Attester signs bundle content. NoOpAttester is used when --attest is not set.
	Attester attestation.Attester
	// contains filtered or unexported fields
}

DefaultBundler generates Helm per-component bundles from recipes.

The per-component approach produces a directory per component, each with its own values.yaml, README, and optional manifests. A root deploy.sh orchestrates installation in order:

chmod +x deploy.sh
./deploy.sh

Thread-safety: DefaultBundler is safe for concurrent use.

func New

func New(opts ...Option) (*DefaultBundler, error)

New creates a new DefaultBundler with the given options.

Example:

b, err := bundler.New(
    bundler.WithConfig(config.NewConfig(
        config.WithValueOverrides(overrides),
    )),
)

func NewWithConfig

func NewWithConfig(cfg *config.Config) (*DefaultBundler, error)

NewWithConfig creates a new DefaultBundler with the given config. This is a convenience function equivalent to New(WithConfig(cfg)).

func (*DefaultBundler) HandleBundles

func (b *DefaultBundler) HandleBundles(w http.ResponseWriter, r *http.Request)

HandleBundles processes bundle generation requests. It accepts a POST request with a JSON body containing the recipe (RecipeResult). Supports query parameters:

  • set: Value overrides in format "bundler:path.to.field=value" (can be repeated)
  • dynamic: Declare value paths as install-time parameters in format "component:path.to.field" (can be repeated)
  • system-node-selector: Node selectors for system components in format "key=value" (can be repeated)
  • system-node-toleration: Tolerations for system components in format "key=value:effect" (can be repeated)
  • accelerated-node-selector: Node selectors for GPU nodes in format "key=value" (can be repeated)
  • accelerated-node-toleration: Tolerations for GPU nodes in format "key=value:effect" (can be repeated)
  • deployer: Deployment method (helm, argocd, or argocd-helm; default helm)
  • repo: Git repository URL for GitOps deployments (used with deployer=argocd)
  • workload-gate: Taint for nodewright-operator runtime required in format "key=value:effect" or "key:effect"
  • workload-selector: Label selector for nodewright-customizations in format "key=value" (can be repeated)
  • nodes: Estimated number of GPU nodes (sets estimatedNodeCount in nodewright-operator; 0 = unset)

The response is a zip archive containing the Helm per-component bundle:

  • README.md: Root deployment guide
  • deploy.sh: Automation script
  • undeploy.sh: Reverse-order uninstall script
  • recipe.yaml: Copy of the input recipe
  • NNN-<component>/install.sh: Per-folder install script
  • NNN-<component>/values.yaml: Static Helm values
  • NNN-<component>/cluster-values.yaml: Per-cluster dynamic values
  • checksums.txt: SHA256 checksums of generated files

Example:

POST /v1/bundle?set=gpuoperator:gds.enabled=true
Content-Type: application/json
Body: { "apiVersion": "aicr.nvidia.com/v1alpha1", "kind": "Recipe", ... }

func (*DefaultBundler) Make

func (b *DefaultBundler) Make(ctx context.Context, recipeResult *recipe.RecipeResult, dir string) (*result.Output, error)

Make generates a deployment bundle from the given recipe. By default, generates a Helm per-component bundle. If deployer is set to "argocd", generates Argo CD Application manifests.

For Helm per-component output:

  • README.md: Root deployment guide with ordered steps
  • deploy.sh: Automation script (0755)
  • recipe.yaml: Copy of the input recipe
  • <component>/values.yaml: Helm values per component
  • <component>/README.md: Component install/upgrade/uninstall
  • <component>/manifests/: Optional manifest files
  • checksums.txt: SHA256 checksums of generated files

For Argo CD output:

  • app-of-apps.yaml: Parent Argo CD Application
  • <component>/application.yaml: Argo CD Application per component
  • <component>/values.yaml: Values for each component
  • README.md: Deployment instructions

Returns a result.Output summarizing the generation results.

type Option

type Option func(*DefaultBundler)

Option defines a functional option for configuring DefaultBundler.

func WithAllowLists

func WithAllowLists(al *recipe.AllowLists) Option

WithAllowLists sets the criteria allowlists for the bundler. When configured, the bundler validates that recipe criteria are within allowed values.

func WithAttester added in v0.8.0

func WithAttester(a attestation.Attester) Option

WithAttester sets the attestation provider for bundle signing.

func WithConfig

func WithConfig(cfg *config.Config) Option

WithConfig sets the bundler configuration. The config contains value overrides, node selectors, tolerations, etc.

Directories

Path Synopsis
Package attestation provides bundle attestation using Sigstore keyless signing.
Package attestation provides bundle attestation using Sigstore keyless signing.
Package checksum provides SHA256 checksum generation for bundle verification.
Package checksum provides SHA256 checksum generation for bundle verification.
Package config provides configuration options for bundler implementations.
Package config provides configuration options for bundler implementations.
Package deployer defines the shared interface and types for bundle deployers.
Package deployer defines the shared interface and types for bundle deployers.
argocd
Package argocd provides Argo CD Application generation for recipes.
Package argocd provides Argo CD Application generation for recipes.
argocdhelm
Package argocdhelm generates a Helm chart app-of-apps for Argo CD with dynamic install-time values.
Package argocdhelm generates a Helm chart app-of-apps for Argo CD with dynamic install-time values.
helm
Package helm generates per-component Helm bundles from recipe results.
Package helm generates per-component Helm bundles from recipe results.
localformat
Package localformat writes the uniform numbered local-chart bundle layout.
Package localformat writes the uniform numbered local-chart bundle layout.
Package registry provides thread-safe registration and retrieval of bundler implementations.
Package registry provides thread-safe registration and retrieval of bundler implementations.
Package result provides types for tracking bundle generation results.
Package result provides types for tracking bundle generation results.
Package types defines the type system for bundler implementations.
Package types defines the type system for bundler implementations.
Package verifier implements offline bundle verification with a four-level trust model.
Package verifier implements offline bundle verification with a four-level trust model.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL