Checking what images will be in airgap bundles from helm charts in a KOTS release

Evans_Mungai
Mon, 12 Feb 2024 17:36:51 +0000
Uncategorized

When packaging a helm-based application targeting airgap environments, the resulting airgap bundle that Vendor Portal builds includes the images that the helm charts require to launch pods. To discover what images need to be downloaded, the airgap builder renders the helm templates using helm template.

In some cases, charts may require mandatory values which would need to be provided to successfully render. Other times users would need to override specific defaults. This is where
the builder field comes in. Values defined in this field would be passed in as custom values to the helm template command.

If a user would like to check what images will be included in the built airgap bundle, they can run helm template <chart> --values <builder-values> and grep their images.

Below is my example release which contains a chart with two subcharts (replicated & cockroachdb). By default, my chart has the cockroachdb chart dependency excluded using cockroachdb.enable conditional.

dependencies:
  - name: replicated
    repository: oci://registry.replicated.com/library
    version: 1.0.0-beta.14
  - name: cockroachdb
    condition: cockroachdb.enabled
    version: 12.0.0
    repository: "https://charts.cockroachdb.com/"

To allow the image builder to include images from cockroachdb, I would need to add the builder values below in my kind: HelmChart release manifest

  builder:
    cockroachdb:
      enabled: true

Now lets run helm template using my added value overrides. We’ll grep for image: to extract image uris from the output. I’m using yq in this example to extract the values of builder field. umbrella-chart is the chart that contains my dependency subcharts.

$ yq .spec.builder my-chart.yaml | helm template umbrella-chart-0.0.1.tgz --values - | grep image:
        image: replicated/replicated-sdk:v1.0.0-beta.14
          image: "busybox"
          image: "cockroachdb/cockroach:v23.2.0"
            image: "gcr.io/cockroachlabs-helm-charts/cockroach-self-signer-cert:1.5"
            image: "gcr.io/cockroachlabs-helm-charts/cockroach-self-signer-cert:1.5"
      image: "cockroachdb/cockroach:v23.2.0"
          image: "gcr.io/cockroachlabs-helm-charts/cockroach-self-signer-cert:1.5"
          image: "gcr.io/cockroachlabs-helm-charts/cockroach-self-signer-cert:1.5"
          image: "busybox"
          image: "cockroachdb/cockroach:v23.2.0"

Without the value overrides the same command will not find my cockroachdb helm chart images

$ helm template umbrella-chart-0.0.1.tgz | grep image:
        image: replicated/replicated-sdk:v1.0.0-beta.14

Errors such as indentation of keys or spelling of keys/values cannot be detected by the builder, and as such, it’s left to the user to verify that their release has is correct and will not lead to missing images. This simple test can be used as a quick test for your airgap bundle.

1 post - 1 participant