Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
7964ada7
Commit
7964ada7
authored
Nov 18, 2022
by
Brad Davidson
Committed by
Brad Davidson
Nov 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pull modified traefik charts from k3s-charts repo
Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
a5fe5e37
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
141 deletions
+8
-141
traefik.yaml
manifests/traefik.yaml
+2
-2
Chart.yaml
scripts/chart-templates/crd-base/Chart.yaml
+0
-7
README.md
scripts/chart-templates/crd-base/README.md
+0
-2
_registry.tpl
...mplates/crd-base/overlay-upstream/templates/_registry.tpl
+0
-8
validate-install-crd.yaml
...base/overlay-upstream/templates/validate-install-crd.yaml
+0
-14
download
scripts/download
+6
-108
No files found.
manifests/traefik.yaml
View file @
7964ada7
...
...
@@ -5,7 +5,7 @@ metadata:
name
:
traefik-crd
namespace
:
kube-system
spec
:
chart
:
https://%{KUBERNETES_API}%/static/charts/traefik-crd-
19.0.40
0.tgz
chart
:
https://%{KUBERNETES_API}%/static/charts/traefik-crd-
20.3.1+up20.3.
0.tgz
---
apiVersion
:
helm.cattle.io/v1
kind
:
HelmChart
...
...
@@ -13,7 +13,7 @@ metadata:
name
:
traefik
namespace
:
kube-system
spec
:
chart
:
https://%{KUBERNETES_API}%/static/charts/traefik-
19.0.40
0.tgz
chart
:
https://%{KUBERNETES_API}%/static/charts/traefik-
20.3.1+up20.3.
0.tgz
set
:
global.systemDefaultRegistry
:
"
%{SYSTEM_DEFAULT_REGISTRY_RAW}%"
valuesContent
:
|-
...
...
scripts/chart-templates/crd-base/Chart.yaml
deleted
100644 → 0
View file @
a5fe5e37
apiVersion
:
${api_version}
version
:
${chart_version}${package_version}
description
:
Installs the CRDs for ${name}.
name
:
${name}-crd
type
:
application
annotations
:
fleet.cattle.io/bundle-id
:
k3s
scripts/chart-templates/crd-base/README.md
deleted
100644 → 0
View file @
a5fe5e37
# ${name}-crd
A Rancher chart that installs the CRDs used by
[
${name}
](
https://github.com/rancher/dev-charts/tree/master/packages/${name}
)
.
scripts/chart-templates/crd-base/overlay-upstream/templates/_registry.tpl
deleted
100644 → 0
View file @
a5fe5e37
{{
/*
vim
:
set
filetype
=
mustache
:
*/
}}
{{- define "system_default_registry" -}}
{{- if .Values.global.systemDefaultRegistry -}}
{{- printf "%s/" .Values.global.systemDefaultRegistry -}}
{{- else -}}
{{- "" -}}
{{- end -}}
{{- end -}}
scripts/chart-templates/crd-base/overlay-upstream/templates/validate-install-crd.yaml
deleted
100644 → 0
View file @
a5fe5e37
#{{- if gt (len (lookup "rbac.authorization.k8s.io/v1" "ClusterRole" "" "")) 0 -}}
# {{- \$found := dict -}}
${set_found_crd}
# {{- range .Capabilities.APIVersions -}}
# {{- if hasKey \$found (toString .) -}}
# {{- set \$found (toString .) true -}}
# {{- end -}}
# {{- end -}}
# {{- range \$_, \$exists := \$found -}}
# {{- if (eq \$exists false) -}}
# {{- required "Required CRDs are missing. Please install the ${name}-crd chart before installing this chart." "" -}}
# {{- end -}}
# {{- end -}}
#{{- end -}}
scripts/download
View file @
7964ada7
#!/bin/bash
set
-e
set
-e
x
cd
$(
dirname
$0
)
/..
.
./scripts/version.sh
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://traefik.github.io/charts/traefik/traefik-
${
TRAEFIK_CHART_VERSION
}
.tgz
CHARTS_URL
=
https://k3s.io/k3s-charts/assets
CHARTS_DIR
=
build/static/charts
RUNC_DIR
=
build/src/github.com/opencontainers/runc
CONTAINERD_DIR
=
build/src/github.com/containerd/containerd
...
...
@@ -30,107 +26,9 @@ git clone --single-branch --branch=${VERSION_RUNC} --depth=1 https://github.com/
git clone
--single-branch
--branch
=
${
VERSION_CONTAINERD
}
--depth
=
1 https://github.com/k3s-io/containerd
${
CONTAINERD_DIR
}
setup_tmp
()
{
TMP_DIR
=
$(
mktemp
-d
--tmpdir
=
${
CHARTS_DIR
})
cleanup
()
{
code
=
$?
set
+e
trap
- EXIT
rm
-rf
${
TMP_DIR
}
exit
$code
}
trap
cleanup INT EXIT
}
download_and_package_traefik
()
{
echo
"Downloading Traefik Helm chart from
${
TRAEFIK_URL
}
"
curl
-sfL
${
TRAEFIK_URL
}
-o
${
TMP_DIR
}
/
${
TRAEFIK_FILE
}
code
=
$?
if
[
$code
-ne
0
]
;
then
echo
"Error: Failed to download Traefik Helm chart!"
exit
$code
fi
echo
"Uncompress
${
TMP_DIR
}
/
${
TRAEFIK_FILE
}
"
tar
xf
${
TMP_DIR
}
/
${
TRAEFIK_FILE
}
-C
${
TMP_DIR
}
echo
"Prepare traefik CRD"
TRAEFIK_TMP_CHART
=
${
TMP_DIR
}
/traefik
TRAEFIK_TMP_CRD
=
${
TRAEFIK_TMP_CHART
}
-crd
# 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
=
${
TRAEFIK_CHART_VERSION
}
package_version
=
${
TRAEFIK_PACKAGE_VERSION
}
# Collect information on CRDs
crd_apis
=()
for
crd_yaml
in
$(
find
${
TRAEFIK_TMP_CHART
}
/crds
-type
f |
sort
)
;
do
echo
"Processing CRD at
${
crd_yaml
}
"
crd_group
=
$(
yq e
'.spec.group'
${
crd_yaml
})
crd_kind
=
$(
yq e
'.spec.names.kind'
${
crd_yaml
})
crd_version
=
$(
yq e
'.spec.version'
${
crd_yaml
})
if
[[
-z
"
$crd_version
"
]]
||
[[
"
$crd_version
"
==
"null"
]]
;
then
crd_version
=
$(
yq e
'.spec.versions[0].name'
${
crd_yaml
})
fi
echo
"Found CRD with GVK
${
crd_group
}
/
${
crd_version
}
/
${
crd_kind
}
"
crd_apis+
=(
"
${
crd_group
}
/
${
crd_version
}
/
${
crd_kind
}
"
)
done
set_found_crd
=
$(
for
crd
in
${
crd_apis
[@]
}
;
do
echo
"# {{- set
\$
found
\"
${
crd
}
\"
false -}}"
done
)
# Copy base template and apply variables to the template
mkdir
-p
${
TRAEFIK_TMP_CRD
}
cp
-R
./scripts/chart-templates/crd-base/
*
${
TRAEFIK_TMP_CRD
}
for
template_file
in
$(
find
${
TRAEFIK_TMP_CRD
}
-type
f |
sort
)
;
do
# Applies any environment variables currently set onto your template file
echo
"Templating
${
template_file
}
"
eval
"echo
\"
$(
sed
's/"/\\"/g'
${
template_file
})
\"
"
>
${
template_file
}
done
# Move anything from ${f}/charts-crd/overlay-upstream to the main chart
cp
-R
${
TRAEFIK_TMP_CRD
}
/overlay-upstream/
*
${
TRAEFIK_TMP_CHART
}
rm
-rf
${
TRAEFIK_TMP_CRD
}
/overlay-upstream
# Modify charts to support system-default-registry
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:
fleet.cattle.io/bundle-id: k3s
EOF
# Move CRDs from main chart to CRD chart
mkdir
-p
${
TRAEFIK_TMP_CRD
}
/templates
mv
${
TRAEFIK_TMP_CHART
}
/crds/
*
${
TRAEFIK_TMP_CRD
}
/templates
rm
-rf
${
TRAEFIK_TMP_CHART
}
/crds
# Package charts
OPTS
=
"--format=gnu --sort=name --owner=0 --group=0 --mode=gou-s --numeric-owner --no-acls --no-selinux --no-xattrs"
tar
${
OPTS
}
--mtime
=
'2021-01-01 00:00:00Z'
-cf
-
-C
${
TMP_DIR
}
$(
basename
${
TRAEFIK_TMP_CHART
})
|
gzip
-n
>
${
CHARTS_DIR
}
/
${
TRAEFIK_FILE
}
tar
${
OPTS
}
--mtime
=
'2021-01-01 00:00:00Z'
-cf
-
-C
${
TMP_DIR
}
$(
basename
${
TRAEFIK_TMP_CRD
})
|
gzip
-n
>
${
CHARTS_DIR
}
/
${
TRAEFIK_CRD_FILE
}
for
TAR
in
${
CHARTS_DIR
}
/
${
TRAEFIK_FILE
}
${
CHARTS_DIR
}
/
${
TRAEFIK_CRD_FILE
}
;
do
sha256sum
${
TAR
}
stat
${
TAR
}
tar
-vtf
${
TAR
}
done
}
setup_tmp
download_and_package_traefik
for
CHART_FILE
in
$(
grep
-rlF
HelmChart manifests/ | xargs yq
eval
--no-doc
.spec.chart | xargs
-n1
basename
)
;
do
CHART_NAME
=
$(
echo
$CHART_FILE
|
grep
-oE
'^(-*[a-z])+'
)
curl
-sfL
${
CHARTS_URL
}
/
${
CHART_NAME
}
/
${
CHART_FILE
}
-o
${
CHARTS_DIR
}
/
${
CHART_FILE
}
done
cp
scripts/wg-add.sh bin/aux/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment