Skip to content

Commit

Permalink
Merge pull request replicatedhq#2266 from replicatedhq/emosbaugh/sc-3…
Browse files Browse the repository at this point in the history
…8490/kotsadm-kotsadmhelm-binaries

Upgrade helm binary in kotsadm container image
  • Loading branch information
emosbaugh authored Oct 21, 2021
2 parents 33dacb2 + 0b8702f commit cdcfd85
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 15 deletions.
24 changes: 18 additions & 6 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,24 @@ RUN curl -fsSLO "${KUBECTL_1_21_URL}" \
&& mv kubectl "${KOTS_KUBECTL_BIN_DIR}/kubectl-v1.21" \
&& ln -s "${KOTS_KUBECTL_BIN_DIR}/kubectl-v1.21" "${KOTS_KUBECTL_BIN_DIR}/kubectl"

# Install helm v3.4.2
RUN curl -L "https://get.helm.sh/helm-v3.4.2-linux-amd64.tar.gz" -o /tmp/helm.tar.gz && \
tar -xzvf /tmp/helm.tar.gz && \
rm /tmp/helm.tar.gz && \
chmod a+x linux-amd64/helm && \
mv linux-amd64/helm "/usr/local/bin/helm3.4.2"
# KOTS can be configured to use a specific version of helm by setting helmVersion in the
# kots.io/v1beta1.HelmChart spec. The github.com/replicatedhq/kots/pkg/binaries package will
# discover all helm binaries in the KOTS_HELM_BIN_DIR directory for use by KOTS.

ENV KOTS_HELM_BIN_DIR=/usr/local/bin

# Install helm v3
ENV HELM3_VERSION=3.7.1
ENV HELM3_URL=https://get.helm.sh/helm-v${HELM3_VERSION}-linux-amd64.tar.gz
ENV HELM3_SHA256SUM=6cd6cad4b97e10c33c978ff3ac97bb42b68f79766f1d2284cfd62ec04cd177f4
RUN cd /tmp && curl -fsSL -o helm.tar.gz "${HELM3_URL}" \
&& echo "${HELM3_SHA256SUM} helm.tar.gz" | sha256sum -c - \
&& tar -xzvf helm.tar.gz \
&& chmod a+x linux-amd64/helm \
&& mv linux-amd64/helm "${KOTS_HELM_BIN_DIR}/helm${HELM3_VERSION}" \
&& ln -s "${KOTS_HELM_BIN_DIR}/helm${HELM3_VERSION}" "${KOTS_HELM_BIN_DIR}/helm3" \
&& ln -s "${KOTS_HELM_BIN_DIR}/helm3" "${KOTS_HELM_BIN_DIR}/helm" \
&& rm -rf helm.tar.gz linux-amd64

# Install s3cmd
ENV S3CMD_VERSION=2.1.0
Expand Down
26 changes: 19 additions & 7 deletions hack/dev/Dockerfile.skaffold
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,25 @@ RUN curl -fsSLO "${KUBECTL_1_21_URL}" \
&& mv kubectl "${KOTS_KUBECTL_BIN_DIR}/kubectl-v1.21" \
&& ln -s "${KOTS_KUBECTL_BIN_DIR}/kubectl-v1.21" "${KOTS_KUBECTL_BIN_DIR}/kubectl"

# KOTS can be configured to use a specific version of helm by setting helmVersion in the
# kots.io/v1beta1.HelmChart spec. The github.com/replicatedhq/kots/pkg/binaries package will
# discover all helm binaries in the KOTS_HELM_BIN_DIR directory for use by KOTS.

ENV KOTS_HELM_BIN_DIR=/usr/local/bin

# Install helm v3
ENV HELM3_VERSION=3.7.1
ENV HELM3_URL=https://get.helm.sh/helm-v${HELM3_VERSION}-linux-amd64.tar.gz
ENV HELM3_SHA256SUM=6cd6cad4b97e10c33c978ff3ac97bb42b68f79766f1d2284cfd62ec04cd177f4
RUN cd /tmp && curl -fsSL -o helm.tar.gz "${HELM3_URL}" \
&& echo "${HELM3_SHA256SUM} helm.tar.gz" | sha256sum -c - \
&& tar -xzvf helm.tar.gz \
&& chmod a+x linux-amd64/helm \
&& mv linux-amd64/helm "${KOTS_HELM_BIN_DIR}/helm${HELM3_VERSION}" \
&& ln -s "${KOTS_HELM_BIN_DIR}/helm${HELM3_VERSION}" "${KOTS_HELM_BIN_DIR}/helm3" \
&& ln -s "${KOTS_HELM_BIN_DIR}/helm3" "${KOTS_HELM_BIN_DIR}/helm" \
&& rm -rf helm.tar.gz linux-amd64

# KOTS can be configured to use a specific version of kustomize by setting kustomizeVersion in the
# kots.io/v1beta1.Application spec. The github.com/replicatedhq/kots/pkg/binaries package will
# discover all kustomize binaries in the KOTS_KUSTOMIZE_BIN_DIR directory for use by KOTS.
Expand All @@ -116,13 +135,6 @@ RUN curl -fsSL -o kustomize.tar.gz "${KUSTOMIZE3_URL}" \
&& ln -s "${KOTS_KUSTOMIZE_BIN_DIR}/kustomize${KUSTOMIZE3_VERSION}" "${KOTS_KUSTOMIZE_BIN_DIR}/kustomize3" \
&& ln -s "${KOTS_KUSTOMIZE_BIN_DIR}/kustomize3" "${KOTS_KUSTOMIZE_BIN_DIR}/kustomize"

# Install helm v3.4.2
RUN curl -L "https://get.helm.sh/helm-v3.4.2-linux-amd64.tar.gz" -o /tmp/helm.tar.gz && \
tar -xzvf /tmp/helm.tar.gz && \
rm /tmp/helm.tar.gz && \
chmod a+x linux-amd64/helm && \
mv linux-amd64/helm "/usr/local/bin/helm3.4.2"

COPY --from=builder /go/src/github.com/replicatedhq/kots/bin/kotsadm .

ENTRYPOINT ["/kotsadm", "api"]
4 changes: 2 additions & 2 deletions pkg/operator/client/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ func (c *Client) clearNamespace(slug string, namespace string, isRestore bool, r
}

func (c *Client) installWithHelm(helmDir string, targetNamespace string) (*commandResult, error) {
version := "3.4.2"
version := "3"
chartsDir := filepath.Join(helmDir, "charts")
dirs, err := ioutil.ReadDir(chartsDir)
if err != nil {
Expand Down Expand Up @@ -530,7 +530,7 @@ func (c *Client) installWithHelm(helmDir string, targetNamespace string) (*comma
}

func (c *Client) uninstallWithHelm(helmDir string, targetNamespace string, charts []string) error {
version := "3.4.2"
version := "3"

for _, chart := range charts {
args := []string{"uninstall", chart}
Expand Down

0 comments on commit cdcfd85

Please sign in to comment.