Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow migrate from HelmChart v1beta1 to v1beta2 if Helm --take-ownership is set #5046

Merged
merged 14 commits into from
Jan 22, 2025
Merged
4 changes: 2 additions & 2 deletions dev/dockerfiles/kotsadm/Dockerfile.local
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ RUN curl -fsSL -o kustomize.tar.gz "${KUSTOMIZE5_URL}" \
&& mv kustomize /usr/local/bin/kustomize

# Install helm v3
ENV HELM3_VERSION=3.16.2
ENV HELM3_VERSION=3.17.0
ENV HELM3_URL=https://get.helm.sh/helm-v${HELM3_VERSION}-linux-arm64.tar.gz
ENV HELM3_SHA256SUM=1888301aeb7d08a03b6d9f4d2b73dcd09b89c41577e80e3455c113629fc657a4
ENV HELM3_SHA256SUM=c4d4be8e80082b7eaa411e3e231d62cf05d01cddfef59b0d01006a7901e11ee4
RUN cd /tmp && curl -fsSL -o helm.tar.gz "${HELM3_URL}" \
&& echo "${HELM3_SHA256SUM} helm.tar.gz" | sha256sum -c - \
&& tar -xzvf helm.tar.gz \
Expand Down
5 changes: 3 additions & 2 deletions pkg/pull/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/url"
"os"
"path/filepath"
"slices"

"github.com/pkg/errors"
reportingtypes "github.com/replicatedhq/kots/pkg/api/reporting/types"
Expand Down Expand Up @@ -416,8 +417,8 @@ func Pull(upstreamURI string, pullOptions PullOptions) (string, error) {
if prevChart.GetReleaseName() != newChart.GetReleaseName() {
continue
}
if !prevChart.Spec.UseHelmInstall {
return "", errors.Errorf("cannot upgrade chart release %s to v1beta2 because useHelmInstall is false", newChart.GetReleaseName())
if !prevChart.Spec.UseHelmInstall && !slices.Contains(newChart.GetUpgradeFlags(), "--take-ownership") {
return "", errors.Errorf("cannot upgrade chart release %s to v1beta2 because useHelmInstall is false and Helm --take-ownership is not set", newChart.GetReleaseName())
}
}
}
Expand Down
Loading