mirror of
https://github.com/kubevela/kubevela.git
synced 2026-04-20 01:27:13 +00:00
* Feat(script): Update installation definition script for improved error handling and namespace management Signed-off-by: Reetika Malhotra <malhotra.reetika25@gmail.com> * added line to rerun the github action Signed-off-by: vishal210893 <vishal210893@gmail.com> * minor change to rerun the github action Signed-off-by: vishal210893 <vishal210893@gmail.com> * Fix(script): Enhance installation script to restore original files on failure Signed-off-by: vishal210893 <vishal210893@gmail.com> --------- Signed-off-by: Reetika Malhotra <malhotra.reetika25@gmail.com> Signed-off-by: vishal210893 <vishal210893@gmail.com>
37 lines
990 B
Bash
Executable File
37 lines
990 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
function install_defs() {
|
|
local def_path="$1"
|
|
if [[ ! -d "$def_path" ]]; then
|
|
echo "Skip: path '$def_path' not found"
|
|
return 0
|
|
fi
|
|
|
|
echo "Applying definitions in '$def_path' ..."
|
|
cd "$def_path"
|
|
|
|
shopt -s nullglob
|
|
for file in *.yaml; do
|
|
echo "Info: processing $def_path/$file"
|
|
sed -i.bak 's#namespace: {{ include "systemDefinitionNamespace" . }}#namespace: vela-system#g' "$file"
|
|
kubectl apply -f "$file" || { mv "$file.bak" "$file"; return 1; }
|
|
mv "$file.bak" "$file" # restore original
|
|
done
|
|
shopt -u nullglob
|
|
|
|
cd - >/dev/null
|
|
}
|
|
|
|
# Ensure vela-system namespace
|
|
if kubectl get namespace vela-system >/dev/null 2>&1; then
|
|
echo "Namespace vela-system exists"
|
|
else
|
|
echo "Creating namespace vela-system"
|
|
kubectl create namespace vela-system
|
|
fi
|
|
|
|
install_defs "charts/vela-core/templates/defwithtemplate"
|
|
install_defs "charts/vela-core/templates/definitions"
|
|
install_defs "charts/vela-core/templates/velaql"
|