Skip to content

Commit ad2f8e8

Browse files
author
Jake Hill
authored
Add debian docker image, drop helm2, upgrade packages. (roboll#1956)
- Add debian image based on `stable-slim`, desire for this is largely around my use case using Azure DevOps which makes it challenging to use images which are not glibc based. - Drop support for helm2 in the docker images. This is a tricky one but given that I was having errors during the docker build for helm2 and the fact that it has been EoL for a long time now made me think that this was the correct move. - As a "while I'm in here" I've upgraded kubectl and helm. I've popped on the most current patch of the last release (v1.20.3) to give a slightly broader support for different Kubernetes versions. - Reworked CI to support pushing a debian and alpine base, and dropped support for the helm2 versions.
1 parent ccd81de commit ad2f8e8

File tree

5 files changed

+100
-32
lines changed

5 files changed

+100
-32
lines changed

.circleci/Makefile

-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
HELM_VERSION ?= v3.5.3
2-
HELM2_VERSION ?= v2.17.0
32
KUSTOMIZE_VERSION ?= v3.8.8
43
K8S_VERSION ?= v1.13.12
54
MINIKUBE_VERSION ?= v0.30.0
@@ -15,7 +14,6 @@ VAULT_TOKEN := toor
1514

1615
tmp := $(shell mktemp -d)
1716
HELM_FILENAME := helm-${HELM_VERSION}-linux-amd64.tar.gz
18-
HELM2_FILENAME := helm-${HELM2_VERSION}-linux-amd64.tar.gz
1917
KUSTOMIZE_FILENAME := kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz
2018

2119

@@ -28,13 +26,6 @@ helm:
2826
sudo mv ${tmp}/linux-amd64/helm /usr/local/bin/
2927
.PHONY: helm
3028

31-
helm2:
32-
curl -sSLo $(tmp)/${HELM2_FILENAME} "https://kubernetes-helm.storage.googleapis.com/${HELM2_FILENAME}"
33-
tar zxf $(tmp)/${HELM2_FILENAME} --directory ${tmp} linux-amd64/helm
34-
chmod +x ${tmp}/linux-amd64/helm
35-
sudo mv ${tmp}/linux-amd64/helm /usr/local/bin/
36-
.PHONY: helm2
37-
3829
kustomize:
3930
curl -sSLo $(tmp)/${KUSTOMIZE_FILENAME} "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F${KUSTOMIZE_VERSION}/${KUSTOMIZE_FILENAME}"
4031
tar zxf $(tmp)/${KUSTOMIZE_FILENAME} --directory ${tmp} kustomize

.circleci/config.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
go mod vendor
4343
ORG=roboll BUILD_URL="$CIRCLE_BUILD_URL" make image
4444
45-
image_helm3:
45+
image_debian:
4646
docker:
4747
- image: circleci/golang:1.16.3
4848
working_directory: /home/circleci/workspace/helmfile
@@ -57,7 +57,7 @@ jobs:
5757
command: |
5858
make tools
5959
go mod vendor
60-
ORG=roboll BUILD_URL="$CIRCLE_BUILD_URL" make image/helm3
60+
ORG=roboll BUILD_URL="$CIRCLE_BUILD_URL" make image/debian
6161
6262
test:
6363
environment:
@@ -135,22 +135,22 @@ jobs:
135135
docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" quay.io
136136
make tools
137137
go mod vendor
138-
ORG=roboll BUILD_URL="$CIRCLE_BUILD_URL" make push push/helm3 release
138+
ORG=roboll BUILD_URL="$CIRCLE_BUILD_URL" make push push/debian release
139139
140140
workflows:
141141
version: 2
142142
build_and_test:
143143
jobs:
144144
- build
145145
- image
146-
- image_helm3
146+
- image_debian
147147
- test
148148
- integration_tests:
149149
requires:
150150
- build
151151
matrix:
152152
parameters:
153-
helm-version: ["v2.17.0", "v3.4.2", "v3.5.4"]
153+
helm-version: ["v2.17.0", "v3.4.2", "v3.5.4", "v3.6.3"]
154154
- release:
155155
filters:
156156
branches:

Dockerfile

+21-14
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,46 @@ FROM alpine:3.11
1111

1212
RUN apk add --no-cache ca-certificates git bash curl jq
1313

14-
ARG HELM_VERSION="v2.17.0"
15-
ARG HELM_LOCATION="https://kubernetes-helm.storage.googleapis.com"
14+
ARG HELM_VERSION="v3.6.3"
15+
ARG HELM_SHA256="07c100849925623dc1913209cd1a30f0a9b80a5b4d6ff2153c609d11b043e262"
16+
ARG HELM_LOCATION="https://get.helm.sh"
1617
ARG HELM_FILENAME="helm-${HELM_VERSION}-linux-amd64.tar.gz"
17-
ARG HELM_SHA256="f3bec3c7c55f6a9eb9e6586b8c503f370af92fe987fcbf741f37707606d70296"
18+
1819
RUN set -x && \
1920
wget ${HELM_LOCATION}/${HELM_FILENAME} && \
2021
echo Verifying ${HELM_FILENAME}... && \
2122
sha256sum ${HELM_FILENAME} | grep -q "${HELM_SHA256}" && \
2223
echo Extracting ${HELM_FILENAME}... && \
2324
tar zxvf ${HELM_FILENAME} && mv /linux-amd64/helm /usr/local/bin/ && \
24-
mv /linux-amd64/tiller /usr/local/bin/ && \
2525
rm ${HELM_FILENAME} && rm -r /linux-amd64
2626

2727
# using the install documentation found at https://kubernetes.io/docs/tasks/tools/install-kubectl/
2828
# for now but in a future version of alpine (in the testing version at the time of writing)
2929
# we should be able to install using apk add.
3030
# the sha256 sum can be found at https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256
3131
# maybe a good idea to automate in the future?
32-
ENV KUBECTL_VERSION="v1.18.9"
33-
ENV KUBECTL_SHA256="6a68756a2d3d04b4d0f52b00de6493ba2c1fcb28b32f3e4a0e99b3d9f6c4e8ed"
34-
RUN set -x & \
32+
ENV KUBECTL_VERSION="v1.21.4"
33+
ENV KUBECTL_SHA256="9410572396fb31e49d088f9816beaebad7420c7686697578691be1651d3bf85a"
34+
RUN set -x && \
3535
curl --retry 5 --retry-connrefused -LO "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" && \
3636
sha256sum kubectl | grep ${KUBECTL_SHA256} && \
3737
chmod +x kubectl && \
3838
mv kubectl /usr/local/bin/kubectl
3939

40-
RUN ["helm", "init", "--client-only", "--stable-repo-url", "https://charts.helm.sh/stable"]
41-
RUN helm plugin install https://github.com/databus23/helm-diff && \
42-
helm plugin install https://github.com/futuresimple/helm-secrets && \
43-
helm plugin install https://github.com/hypnoglow/helm-s3.git && \
44-
helm plugin install https://github.com/aslafy-z/helm-git.git && \
45-
helm plugin install https://github.com/rimusz/helm-tiller
40+
ENV KUSTOMIZE_VERSION="v3.8.8"
41+
ENV KUSTOMIZE_SHA256="175938206f23956ec18dac3da0816ea5b5b485a8493a839da278faac82e3c303"
42+
RUN set -x && \
43+
curl --retry 5 --retry-connrefused -LO https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \
44+
sha256sum kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz | grep ${KUSTOMIZE_SHA256} && \
45+
tar zxf kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \
46+
rm kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \
47+
mv kustomize /usr/local/bin/kustomize
48+
49+
RUN helm plugin install https://github.com/databus23/helm-diff --version v3.1.3 && \
50+
helm plugin install https://github.com/jkroepke/helm-secrets --version v3.5.0 && \
51+
helm plugin install https://github.com/hypnoglow/helm-s3.git --version v0.10.0 && \
52+
helm plugin install https://github.com/aslafy-z/helm-git.git --version v0.10.0
4653

4754
COPY --from=builder /workspace/helmfile/dist/helmfile_linux_amd64 /usr/local/bin/helmfile
4855

49-
CMD ["/usr/local/bin/helmfile", "--help"]
56+
CMD ["/usr/local/bin/helmfile"]

Dockerfile.debian

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
FROM golang:1.16.7 as builder
2+
3+
RUN apt-get update \
4+
&& apt-get install --no-install-recommends -y \
5+
build-essential \
6+
git \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
WORKDIR /workspace/helmfile
10+
COPY . /workspace/helmfile
11+
12+
RUN make static-linux
13+
14+
# -----------------------------------------------------------------------------
15+
16+
FROM debian:stable-slim
17+
18+
RUN apt-get update \
19+
&& apt-get install -y --no-install-recommends \
20+
ca-certificates \
21+
git \
22+
bash \
23+
curl \
24+
jq \
25+
wget \
26+
&& rm -rf /var/lib/apt/lists/*
27+
28+
ARG HELM_VERSION="v3.6.3"
29+
ARG HELM_SHA256="07c100849925623dc1913209cd1a30f0a9b80a5b4d6ff2153c609d11b043e262"
30+
ARG HELM_LOCATION="https://get.helm.sh"
31+
ARG HELM_FILENAME="helm-${HELM_VERSION}-linux-amd64.tar.gz"
32+
33+
RUN set -x && \
34+
wget "${HELM_LOCATION}/${HELM_FILENAME}" && \
35+
echo "Verifying ${HELM_FILENAME}..." && \
36+
sha256sum "${HELM_FILENAME}" | grep -q "${HELM_SHA256}" && \
37+
echo "Extracting ${HELM_FILENAME}..." && \
38+
tar zxvf "${HELM_FILENAME}" && mv /linux-amd64/helm /usr/local/bin/ && \
39+
rm ${HELM_FILENAME} && rm -r /linux-amd64
40+
41+
# using the install documentation found at https://kubernetes.io/docs/tasks/tools/install-kubectl/
42+
# for now but in a future version of alpine (in the testing version at the time of writing)
43+
# we should be able to install using apk add.
44+
# the sha256 sum can be found at https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256
45+
# maybe a good idea to automate in the future?
46+
ENV KUBECTL_VERSION="v1.21.4"
47+
ENV KUBECTL_SHA256="9410572396fb31e49d088f9816beaebad7420c7686697578691be1651d3bf85a"
48+
RUN set -x && \
49+
wget "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" && \
50+
sha256sum kubectl | grep ${KUBECTL_SHA256} && \
51+
chmod +x kubectl && \
52+
mv kubectl /usr/local/bin/kubectl
53+
54+
ENV KUSTOMIZE_VERSION="v3.8.8"
55+
ENV KUSTOMIZE_SHA256="175938206f23956ec18dac3da0816ea5b5b485a8493a839da278faac82e3c303"
56+
RUN set -x && \
57+
curl --retry 5 --retry-connrefused -LO https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \
58+
sha256sum kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz | grep ${KUSTOMIZE_SHA256} && \
59+
tar zxf kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \
60+
rm kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \
61+
mv kustomize /usr/local/bin/kustomize
62+
63+
RUN helm plugin install https://github.com/databus23/helm-diff --version v3.1.3 && \
64+
helm plugin install https://github.com/jkroepke/helm-secrets --version v3.5.0 && \
65+
helm plugin install https://github.com/hypnoglow/helm-s3.git --version v0.10.0 && \
66+
helm plugin install https://github.com/aslafy-z/helm-git.git --version v0.10.0
67+
68+
COPY --from=builder /workspace/helmfile/dist/helmfile_linux_amd64 /usr/local/bin/helmfile
69+
70+
CMD ["/usr/local/bin/helmfile"]

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ run: image
7171
push: image
7272
docker push quay.io/${ORG}/helmfile:${TAG}
7373

74-
image/helm3:
75-
docker build -f Dockerfile.helm3 -t quay.io/${ORG}/helmfile:helm3-${TAG} .
74+
image/debian:
75+
docker build -f Dockerfile.debian -t quay.io/${ORG}/helmfile:${TAG}-stable-slim .
7676

77-
push/helm3: image/helm3
78-
docker push quay.io/${ORG}/helmfile:helm3-${TAG}
77+
push/debian: image/debian
78+
docker push quay.io/${ORG}/helmfile:${TAG}-stable-slim
7979

8080
tools:
8181
go get -u github.com/tcnksm/ghr github.com/mitchellh/gox

0 commit comments

Comments
 (0)