JCC-CSScheduler/deploy/x86/yaml/start.sh

33 lines
562 B
Bash

#!/bin/bash
# 获取当前路径
current_path=$(pwd)
# 拉起configmap
cd $current_path/config
config_files=$(ls *.json 2>/dev/null)
if [ -z "$config_files" ]; then
echo "当前路径下没有.config.json文件。"
exit 1
fi
for file in $config_files; do
if [[ -f "$file" ]]; then
name=$(echo "$file" | cut -d '.' -f1)
kubectl create cm sch$name-config --from-file=./$file
fi
done
# 拉起pod
cd $current_path
yaml_files=$(ls *.yaml 2>/dev/null)
for yaml_file in $yaml_files; do
echo "Applying $yaml_file ..."
kubectl apply -f $yaml_file
done