-
Too many times, I've ended up with vector pods in CrashLoopBackoff when I make a mistake in my helm values file. I'm trying to use
I would have assumed that this scenario is what the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Here's the workaround I came up with: # locally render the template to the temp directory
dump_template() {
helm template \
--output-dir $tmpdir \
$component $chart \
--create-namespace \
--namespace $namespace \
$sets \
$values \
> /dev/null
}
# extract the specified key from the configmap in the temp directory
extract_configmap() {
local key=$1
cat $tmpdir/$component/templates/configmap.yaml |
grep -v '^---$' |
yq -r ".data.\"$key\"" > "/$tmpdir/$key"
}
# convert all vector sinks to blackholes
blackhole_sinks() {
local blackhole='"type": "blackhole", "inputs":'
local sinks=$(yq -r ".sinks | keys | .[]" $tmpdir/vector.yaml)
for sink in $sinks; do
local inputs=$(yq -c ".sinks.$sink.inputs" $tmpdir/vector.yaml)
yq -y ".sinks.$sink = {$blackhole $inputs}" $tmpdir/vector.yaml > $tmpdir/temp.yaml
mv $tmpdir/temp.yaml $tmpdir/vector.yaml
done
}
# validate the vector configuration
validate_vector() {
if ! which vector yq > /dev/null; then
echo "WARNING: vector or yq executable is not in your path. Unable to validate config."
else
dump_template
extract_configmap vector.yaml
blackhole_sinks
vector validate $tmpdir/vector.yaml
fi
} As a side note, using yq to manipulate the @jszwedko It would really help out if Vector offered some direct support for validating |
Beta Was this translation helpful? Give feedback.
Here's the workaround I came up with: