mirror of
https://github.com/truecharts/charts.git
synced 2026-07-10 01:44:02 -03:00
feat(treafik): add RealIP and addPrefix middleware (#3884)
* fix typo * feat(treafik): add RealIP middleware * move middlewares to includes * bump minor * remove pilot reference * lint * lint * fix typo in workflow * add script to update traefikMiddlewares * add empty space * realIP empty array * add addprefix middleware
This commit is contained in:
55
.github/scripts/build-catalog.sh
vendored
55
.github/scripts/build-catalog.sh
vendored
@@ -296,6 +296,61 @@ include_questions(){
|
||||
/# Include{proxyProtocol}/ { for (i=0;i<n;++i) print a[i]; next }
|
||||
1' templates/questions/traefik/proxyProtocol.yaml ${target}/questions.yaml > "tmp${chartname}" && mv "tmp${chartname}" ${target}/questions.yaml
|
||||
|
||||
# Replace # Include{basicAuth} with the standard basicAuth codesnippet
|
||||
awk 'NR==FNR { a[n++]=$0; next }
|
||||
/# Include{basicAuth}/ { for (i=0;i<n;++i) print a[i]; next }
|
||||
1' templates/questions/traefik/middlewares/basicAuth.yaml ${target}/questions.yaml > "tmp${chartname}" && mv "tmp${chartname}" ${target}/questions.yaml
|
||||
|
||||
# Replace # Include{forwardAuth} with the standard forwardAuth codesnippet
|
||||
awk 'NR==FNR { a[n++]=$0; next }
|
||||
/# Include{forwardAuth}/ { for (i=0;i<n;++i) print a[i]; next }
|
||||
1' templates/questions/traefik/middlewares/forwardAuth.yaml ${target}/questions.yaml > "tmp${chartname}" && mv "tmp${chartname}" ${target}/questions.yaml
|
||||
|
||||
# Replace # Include{chain} with the standard chain codesnippet
|
||||
awk 'NR==FNR { a[n++]=$0; next }
|
||||
/# Include{chain}/ { for (i=0;i<n;++i) print a[i]; next }
|
||||
1' templates/questions/traefik/middlewares/chain.yaml ${target}/questions.yaml > "tmp${chartname}" && mv "tmp${chartname}" ${target}/questions.yaml
|
||||
|
||||
# Replace # Include{redirectScheme} with the standard redirectScheme codesnippet
|
||||
awk 'NR==FNR { a[n++]=$0; next }
|
||||
/# Include{redirectScheme}/ { for (i=0;i<n;++i) print a[i]; next }
|
||||
1' templates/questions/traefik/middlewares/redirectScheme.yaml ${target}/questions.yaml > "tmp${chartname}" && mv "tmp${chartname}" ${target}/questions.yaml
|
||||
|
||||
# Replace # Include{rateLimit} with the standard rateLimit codesnippet
|
||||
awk 'NR==FNR { a[n++]=$0; next }
|
||||
/# Include{rateLimit}/ { for (i=0;i<n;++i) print a[i]; next }
|
||||
1' templates/questions/traefik/middlewares/rateLimit.yaml ${target}/questions.yaml > "tmp${chartname}" && mv "tmp${chartname}" ${target}/questions.yaml
|
||||
|
||||
# Replace # Include{redirectRegex} with the standard redirectRegex codesnippet
|
||||
awk 'NR==FNR { a[n++]=$0; next }
|
||||
/# Include{redirectRegex}/ { for (i=0;i<n;++i) print a[i]; next }
|
||||
1' templates/questions/traefik/middlewares/redirectRegex.yaml ${target}/questions.yaml > "tmp${chartname}" && mv "tmp${chartname}" ${target}/questions.yaml
|
||||
|
||||
# Replace # Include{stripPrefixRegex} with the standard stripPrefixRegex codesnippet
|
||||
awk 'NR==FNR { a[n++]=$0; next }
|
||||
/# Include{stripPrefixRegex}/ { for (i=0;i<n;++i) print a[i]; next }
|
||||
1' templates/questions/traefik/middlewares/stripPrefixRegex.yaml ${target}/questions.yaml > "tmp${chartname}" && mv "tmp${chartname}" ${target}/questions.yaml
|
||||
|
||||
# Replace # Include{ipWhitelist} with the standard ipWhitelist codesnippet
|
||||
awk 'NR==FNR { a[n++]=$0; next }
|
||||
/# Include{ipWhitelist}/ { for (i=0;i<n;++i) print a[i]; next }
|
||||
1' templates/questions/traefik/middlewares/ipWhitelist.yaml ${target}/questions.yaml > "tmp${chartname}" && mv "tmp${chartname}" ${target}/questions.yaml
|
||||
|
||||
# Replace # Include{themePark} with the standard themePark codesnippet
|
||||
awk 'NR==FNR { a[n++]=$0; next }
|
||||
/# Include{themePark}/ { for (i=0;i<n;++i) print a[i]; next }
|
||||
1' templates/questions/traefik/middlewares/themePark.yaml ${target}/questions.yaml > "tmp${chartname}" && mv "tmp${chartname}" ${target}/questions.yaml
|
||||
|
||||
# Replace # Include{realIP} with the standard realIP codesnippet
|
||||
awk 'NR==FNR { a[n++]=$0; next }
|
||||
/# Include{realIP}/ { for (i=0;i<n;++i) print a[i]; next }
|
||||
1' templates/questions/traefik/middlewares/realIP.yaml ${target}/questions.yaml > "tmp${chartname}" && mv "tmp${chartname}" ${target}/questions.yaml
|
||||
|
||||
# Replace # Include{addPrefix} with the standard addPrefix codesnippet
|
||||
awk 'NR==FNR { a[n++]=$0; next }
|
||||
/# Include{addPrefix}/ { for (i=0;i<n;++i) print a[i]; next }
|
||||
1' templates/questions/traefik/middlewares/addPrefix.yaml ${target}/questions.yaml > "tmp${chartname}" && mv "tmp${chartname}" ${target}/questions.yaml
|
||||
|
||||
}
|
||||
export -f include_questions
|
||||
|
||||
|
||||
49
.github/scripts/updateTraefikMiddlewareVersions.sh
vendored
Executable file
49
.github/scripts/updateTraefikMiddlewareVersions.sh
vendored
Executable file
@@ -0,0 +1,49 @@
|
||||
#! /bin/bash
|
||||
|
||||
trainsPath="./charts"
|
||||
traefikTrain="stable"
|
||||
|
||||
get_latest_release() {
|
||||
# Get latest release from GitHub api
|
||||
curl --silent \
|
||||
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
|
||||
--url "https://api.github.com/repos/$1/releases/latest" |
|
||||
# Get tag line
|
||||
grep '"tag_name":' |
|
||||
# Pluck JSON value
|
||||
sed -E 's/.*"([^"]+)".*/\1/'
|
||||
}
|
||||
|
||||
set_key_to_version() {
|
||||
key="$1"
|
||||
version="$2"
|
||||
traefikValuesFile="$trainsPath/$traefikTrain/traefik/values.yaml"
|
||||
echo "Setting $key to $version..."
|
||||
sed -i "s/${key}: .*/${key}: ${version}/" $traefikValuesFile
|
||||
|
||||
content=$(grep "$key:" "$traefikValuesFile" | sed "s/\s*${key}:\s*//" )
|
||||
echo "New content of $key in values.yaml: $content"
|
||||
echo ""
|
||||
}
|
||||
|
||||
update_plugin() {
|
||||
repo="$1"
|
||||
key="$2"
|
||||
pluginName="$3"
|
||||
|
||||
version=$(get_latest_release "$repo")
|
||||
if [ -z "$version" ]
|
||||
then
|
||||
echo "Got empty version, skipping..."
|
||||
else
|
||||
echo "Fetched $pluginName plugin version: $version"
|
||||
set_key_to_version "$key" "$version"
|
||||
fi;
|
||||
}
|
||||
# Example
|
||||
# update_plugin "repo" "key_holding_version_in_values.yaml" "plugin_name_used_for_verbose_printing_only"
|
||||
# Real IP
|
||||
update_plugin "soulbalz/traefik-real-ip" "realIPVersion" "RealIP"
|
||||
|
||||
# Theme Park
|
||||
update_plugin "packruler/traefik-themepark" "themeParkVersion" "ThemePark"
|
||||
Reference in New Issue
Block a user