diff --git a/pkg/apparchive/helm-v1beta2.go b/pkg/apparchive/helm-v1beta2.go index 60ef747efe..47f43e45f4 100644 --- a/pkg/apparchive/helm-v1beta2.go +++ b/pkg/apparchive/helm-v1beta2.go @@ -146,14 +146,6 @@ func WriteV1Beta2HelmCharts(opts WriteV1Beta2HelmChartsOptions) error { return errors.Wrap(err, "failed to write values file") } - if !opts.ProcessImageOptions.RewriteImages || opts.ProcessImageOptions.IsAirgap { - // if an on-prem registry is not configured (which means it's an online installation) - // there's no need to process/copy the images as they will be pulled from their original registries or through the replicated proxy. - // if an on-prem registry is configured, but it's an airgap installation, we also don't need to process/copy the images - // as they will be pushed from the airgap bundle. - continue - } - if err := processOnlineV1Beta2HelmChartImages(opts, &helmChart, chartDir); err != nil { return errors.Wrap(err, "failed to process online images") } @@ -317,6 +309,14 @@ func processOnlineV1Beta2HelmChartImages(opts WriteV1Beta2HelmChartsOptions, hel return errors.Wrap(err, "failed to update installation images") } + if !opts.ProcessImageOptions.RewriteImages || opts.ProcessImageOptions.IsAirgap { + // if an on-prem registry is not configured (which means it's an online installation) + // there's no need to process/copy the images as they will be pulled from their original registries or through the replicated proxy. + // if an on-prem registry is configured, but it's an airgap installation, we also don't need to process/copy the images + // as they will be pushed from the airgap bundle. + return nil + } + if err := image.CopyOnlineImages(opts.ProcessImageOptions, chartImages, opts.KotsKinds, opts.KotsKinds.License, dockerHubRegistryCreds, opts.RenderOptions.Log); err != nil { return errors.Wrap(err, "failed to rewrite base images") } diff --git a/pkg/tests/pull/cases/v1beta2-charts/testcase.yaml b/pkg/tests/pull/cases/v1beta2-charts/testcase.yaml index d0bc3fb357..6caf793c02 100644 --- a/pkg/tests/pull/cases/v1beta2-charts/testcase.yaml +++ b/pkg/tests/pull/cases/v1beta2-charts/testcase.yaml @@ -2,6 +2,7 @@ Name: test v1beta2 charts PullOptions: Namespace: app-namespace ExcludeAdminConsole: true + IsAirgap: true Silent: true LocalPath: cases/v1beta2-charts/upstream RootDir: cases/v1beta2-charts/results diff --git a/pkg/tests/pull/cases/v1beta2-charts/wantResults/kotsKinds/userdata/installation.yaml b/pkg/tests/pull/cases/v1beta2-charts/wantResults/kotsKinds/userdata/installation.yaml index b5e760e508..b0141e14d8 100644 --- a/pkg/tests/pull/cases/v1beta2-charts/wantResults/kotsKinds/userdata/installation.yaml +++ b/pkg/tests/pull/cases/v1beta2-charts/wantResults/kotsKinds/userdata/installation.yaml @@ -8,5 +8,7 @@ spec: channelName: My Channel knownImages: - image: nginx:1.23 + isPrivate: true - image: nginx:1.24 + isPrivate: true status: {} diff --git a/pkg/tests/pull/cases/v1beta2-charts/wantResults/upstream/userdata/installation.yaml b/pkg/tests/pull/cases/v1beta2-charts/wantResults/upstream/userdata/installation.yaml index b5e760e508..b0141e14d8 100644 --- a/pkg/tests/pull/cases/v1beta2-charts/wantResults/upstream/userdata/installation.yaml +++ b/pkg/tests/pull/cases/v1beta2-charts/wantResults/upstream/userdata/installation.yaml @@ -8,5 +8,7 @@ spec: channelName: My Channel knownImages: - image: nginx:1.23 + isPrivate: true - image: nginx:1.24 + isPrivate: true status: {}