refactor start

This commit is contained in:
Ariel Sosnovsky committed 2023-04-13 20:41:56 +00:00
1 parent c812acf459
commit d1894535bb
102 files changed
+387 -43

No files matched your search

+22 -9
View File
@@ -6,11 +6,8 @@ deployment=${2:-dev}
app=$(basename $full_path)
location=$(dirname $full_path)
tmp_path=".tmp/$location/$deployment-$app.yaml"
argocd_values_path=$(realpath k8s/argocd/values.yaml)
argocd_values_deployment_path=$(realpath k8s/argocd/values-$deployment.yaml)
echo "> writing $location/$app to $tmp_path"
echo "> using argo values of $argocd_values_path"
cat $argocd_values_path | yq
mkdir -p $(dirname $tmp_path)
pushd $full_path &> /dev/null
@@ -23,12 +20,28 @@ if [ -f "$tmp_path" ]; then
mv $tmp_path $tmp_path".old"
fi
extraArgs=""
for f in k8s/argocd/values/shared/*.yaml; do
full_file_path=$(realpath $f)
extraArgs=$extraArgs" --values ${full_file_path}"
done
for f in k8s/argocd/values/$deployment/*.yaml; do
full_file_path=$(realpath $f)
extraArgs=$extraArgs" --values ${full_file_path}"
done
echo $extraArgs
helm template $app $full_path --namespace $app \
--debug \
--values $argocd_values_path \
--values $argocd_values_deployment_path \
--values $full_path/values.yaml \
--values $full_path/values-$deployment.yaml \
$extraArgs \
> $tmp_path
echo $tmp_path
echo "Wrote Template! --> $tmp_path"
echo "==============="
if [ -f "$tmp_path.old" ]; then
echo " -> creating diff -- $tmp_path.diff"
diff -u $tmp_path".old" $tmp_path > "$tmp_path.diff"
fi
+29 -5
View File
@@ -1,12 +1,36 @@
#!/bin/bash
mkdir -p .tmp
helm template argocd k8s/argocd \
--namespace argocd \
deployment=${1:-dev}
app=argocd
location=k8s/$app
full_path=$(realpath $location)
tmp_path=".tmp/$location/$deployment-$app.yaml"
mkdir -p $(dirname $tmp_path)
pushd $full_path &> /dev/null
helm dependency update &> /dev/null
popd &> /dev/null
if [ -f "$tmp_path" ]; then
echo "Found existing file"
echo " -> Renaming old file to "$tmp_path".old"
mv $tmp_path $tmp_path".old"
fi
helm template $app $full_path --namespace $app \
--debug \
--create-namespace \
--values k8s/argocd/values.yaml \
--values k8s/argocd/values-dev.yaml \
--set selfapp.deployment="${deployment}" \
--set selfapp.enabled="true" \
--set selfapp.sshkey="$(cat ~/.ssh/id_rsa)" \
> .tmp/argocd.yaml
> $tmp_path
echo "Wrote Template! --> $tmp_path"
echo "==============="
if [ -f "$tmp_path.old" ]; then
echo " -> creating diff -- $tmp_path.diff"
diff -u $tmp_path".old" $tmp_path > "$tmp_path.diff"
fi
-2
View File
@@ -13,7 +13,6 @@ helm install argocd k8s/argocd \
--namespace argocd \
--create-namespace \
--values k8s/argocd/values.yaml \
--values k8s/argocd/values-$DEPLOYMENT.yaml \
--set selfapp.sshkey="$(cat ~/.ssh/id_rsa)"
watch -n1 "kubectl -n argocd get all"
@@ -26,7 +25,6 @@ helm upgrade argocd k8s/argocd \
--namespace argocd \
--create-namespace \
--values k8s/argocd/values.yaml \
--values k8s/argocd/values-$DEPLOYMENT.yaml \
--set selfapp.enabled="true" \
--set selfapp.sshkey="$(cat ~/.ssh/id_rsa)"
-1
View File
@@ -8,7 +8,6 @@ typeofapp=$(basename $location)
mkdir -p $full_path/templates
touch $full_path/values.yaml
touch $full_path/values-{dev,prod}.yaml
cat <<EOT >> $full_path/Chart.yaml
apiVersion: v2
name: $app
-5
View File
@@ -1,5 +0,0 @@
#!/bin/bash
set -e
minikube start
-24
View File
@@ -1,24 +0,0 @@
#!/bin/bash
set -e
full_path=${1}
deployment=${2:-dev}
app=$(basename $full_path)
location=$(dirname $full_path)
tmp_path=".tmp/$location/$deployment-$app.yaml"
argocd_values_path=$(realpath k8s/argocd/values-$deployment.yaml)
echo "> writing $location/$app to $tmp_path"
echo "> using argo values of $argocd_values_path"
cat $argocd_values_path | yq
mkdir -p $(dirname $tmp_path)
pushd $full_path &> /dev/null
helm dependency update &> /dev/null
popd &> /dev/null
helm upgrade $app $full_path --namespace $app \
--debug \
--values $argocd_values_path \
--values $full_path/values.yaml \
--values $full_path/values-$deployment.yaml \
> $tmp_path
-12
View File
@@ -1,12 +0,0 @@
#!/bin/bash
DEPLOYMENT=dev
helm upgrade argocd k8s/argocd \
--debug \
--namespace argocd \
--create-namespace \
--values k8s/argocd/values.yaml \
--values k8s/argocd/values-$DEPLOYMENT.yaml \
--set selfapp.enabled="true" \
--set selfapp.sshkey="$(cat ~/.ssh/id_rsa)"