Skip to content

Commit

Permalink
Add package version to traefik helm chart
Browse files Browse the repository at this point in the history
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
  • Loading branch information
brandond committed Nov 24, 2021
1 parent d09821c commit 3f40742
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ENV no_proxy=$no_proxy
RUN apk -U --no-cache add bash git gcc musl-dev docker vim less file curl wget ca-certificates jq linux-headers \
zlib-dev tar zip squashfs-tools npm coreutils python3 openssl-dev libffi-dev libseccomp libseccomp-dev \
libseccomp-static make libuv-static sqlite-dev sqlite-static libselinux libselinux-dev zlib-dev zlib-static \
zstd gzip alpine-sdk binutils-gold
zstd gzip alpine-sdk binutils-gold gawk
RUN if [ "$(go env GOARCH)" = "arm64" ]; then \
wget https://github.com/aquasecurity/trivy/releases/download/v0.16.0/trivy_0.16.0_Linux-ARM64.tar.gz && \
tar -zxvf trivy_0.16.0_Linux-ARM64.tar.gz && \
Expand Down
4 changes: 2 additions & 2 deletions manifests/traefik.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ metadata:
name: traefik-crd
namespace: kube-system
spec:
chart: https://%{KUBERNETES_API}%/static/charts/traefik-crd-9.18.2.tgz
chart: https://%{KUBERNETES_API}%/static/charts/traefik-crd-9.18.201.tgz
---
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
name: traefik
namespace: kube-system
spec:
chart: https://%{KUBERNETES_API}%/static/charts/traefik-9.18.2.tgz
chart: https://%{KUBERNETES_API}%/static/charts/traefik-9.18.201.tgz
set:
global.systemDefaultRegistry: "%{SYSTEM_DEFAULT_REGISTRY_RAW}%"
valuesContent: |-
Expand Down
2 changes: 1 addition & 1 deletion scripts/chart-templates/crd-base/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: ${api_version}
version: ${chart_version}
version: ${chart_version}${package_version}
description: Installs the CRDs for ${name}.
name: ${name}-crd
type: application
Expand Down
21 changes: 15 additions & 6 deletions scripts/download
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/bin/bash

set -e

cd $(dirname $0)/..

. ./scripts/version.sh

RUNC_VERSION=v1.0.2
ROOT_VERSION=v0.9.1
TRAEFIK_VERSION=9.18.2 # appVersion: 2.4.8
TRAEFIK_CHART_VERSION=$(yq e '.spec.chart' manifests/traefik.yaml | awk 'match($0, /([0-9.]+)([0-9]{2})/, m) { print m[1]; exit; }')
TRAEFIK_PACKAGE_VERSION=$(yq e '.spec.chart' manifests/traefik.yaml | awk 'match($0, /([0-9.]+)([0-9]{2})/, m) { print m[2]; exit; }')
TRAEFIK_FILE=traefik-${TRAEFIK_CHART_VERSION}${TRAEFIK_PACKAGE_VERSION}.tgz
TRAEFIK_CRD_FILE=traefik-crd-${TRAEFIK_CHART_VERSION}${TRAEFIK_PACKAGE_VERSION}.tgz
TRAEFIK_URL=https://helm.traefik.io/traefik/traefik-${TRAEFIK_CHART_VERSION}.tgz
CHARTS_DIR=build/static/charts
RUNC_DIR=build/src/github.com/opencontainers/runc
DATA_DIR=build/data
Expand Down Expand Up @@ -58,7 +64,8 @@ download_and_package_traefik () {
# Collect information on chart
name=$(yq e '.name' ${TRAEFIK_TMP_CHART}/Chart.yaml)
api_version=$(yq e '.apiVersion' ${TRAEFIK_TMP_CHART}/Chart.yaml)
chart_version=$(yq e '.version' ${TRAEFIK_TMP_CHART}/Chart.yaml)
chart_version=${TRAEFIK_CHART_VERSION}
package_version=${TRAEFIK_PACKAGE_VERSION}

# Collect information on CRDs
crd_apis=()
Expand Down Expand Up @@ -96,6 +103,12 @@ download_and_package_traefik () {
echo -e 'global:\n systemDefaultRegistry: ""' >> ${TRAEFIK_TMP_CHART}/values.yaml
find ${TRAEFIK_TMP_CHART} -type f | xargs sed -i 's/{{ .Values.image.name }}/{{ template "system_default_registry" .}}&/g'

# Modify chart version to append package version
# If we alter our repackaging of the helm chart without also bumping the version of the
# chart, the package version portion (final two digits) of the version string in the
# traefik HelmChart manifest should be bumped accordingly.
sed -i "s/version: .*/&${TRAEFIK_PACKAGE_VERSION}/" ${TRAEFIK_TMP_CHART}/Chart.yaml

# Add dashboard annotations to main chart
cat <<EOF >>${TRAEFIK_TMP_CHART}/Chart.yaml
annotations:
Expand All @@ -118,10 +131,6 @@ EOF
done
}

TRAEFIK_FILE=traefik-${TRAEFIK_VERSION}.tgz
TRAEFIK_CRD_FILE=traefik-crd-${TRAEFIK_VERSION}.tgz
TRAEFIK_URL=https://helm.traefik.io/traefik/${TRAEFIK_FILE}

setup_tmp
download_and_package_traefik

Expand Down

0 comments on commit 3f40742

Please sign in to comment.