-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.sh
executable file
·109 lines (100 loc) · 2.55 KB
/
edit.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
#
COMMAND=$(fd -tf ingress.yaml .)
#UPDATE=$(fd -tf ingress.yaml . -x xargs $(cat $SCRIPT >>))
#SCRIPT='~/helper.sh'
#pushd /home/n0ko/capacity/repos/dev/ops/helm-deployments
#
##1. UPDATE NETWORKING LINE
#fd -tf ingress.yaml . -x sed -i 's/apiVer.*/apiVersion: networking.k8s.io\/v1/'
#if [ $? -ne 0 ]; then
# echo "apiVersion success"
#else
# echo "apiVersion failed"
#fi
#
##2. UPDATE PATHTYPE
#fd -tf ingress.yaml . -x sed -i '/\$ingressPath/,$d'
#if [ $? -ne 0 ]; then
# echo "ingressPath success"
#else
# echo "ingressPath failed"
#fi
#
##3. UPDATE FROM BACKEND DOWN TO EOF
##remove from under -path: {{ $ingressPath}} to EOF
#echo " - path: {{ $ingressPath }}
# pathType: ImplementationSpecific
# backend:
# service:
# name: {{ $serviceName }}
# port:
# number: {{ $servicePort }}
# {{- end -}}
#{{- if .Values.ingress.tls }}
# tls:
#{{ toYaml .Values.ingress.tls | indent 4 }}
# {{- end -}}" >> $SCRIPT
#if [ $? -ne 0 ]; then
# echo "append success"
#else
# echo "append failed"
#fi
#
#$UPDATE
#
#rm $SCRIPT
#
#
#exceptions:
#rabbitmq
#1. UPDATE NETWORKING LINE
fd -tf ingress.yaml . -x sed -i 's/apiVer.*/apiVersion: networking.k8s.io\/v1/'
if [ $? -ne 0 ]; then
echo "apiVersion success"
else
echo "apiVersion failed"
fi
#2. UPDATE PATHTYPE
fd -tf ingress.yaml . -x sed -i '/\paths:/,$d'
if [ $? -ne 0 ]; then
echo "ingressPath success"
else
echo "ingressPath failed"
fi
#3. UPDATE FROM BACKEND DOWN TO EOF
#remove from under -path: {{ $ingressPath}} to EOF
echo " paths:
- path: {{ \$ingressPath }}
pathType: ImplementationSpecific
backend:
service:
name: {{ \$serviceName }}
port:
number: {{ \$servicePort }}
{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
" > ~/helper.sh
if [ $? -ne 0 ]; then
echo "echo success"
else
echo "echo failed"
fi
echo "#!/bin/bash
cat ~/helper.sh >> \$(fd -tf ingress.yaml /home/n0ko/capacity/repos/dev/ops/helm-deployments)" > ~/anotherHelper.sh
chmod +x ~/anotherHelper.sh
~/anotherHelper.sh
$COMMAND -x sed -i 's/^$/d'
#rm ~/helper.sh
#rm ~/anotherHelper.sh
#fd -tf ingress.yaml /home/n0ko/capacity/repos/dev/ops/helm-deployments > ~/list.md
#LIST='~/list.md'
#while $LIST= read -r line; do
# cat ~/helper.sh $line >>
#done
#xargs -l cat ~/helper.sh << $(fd -tf ingress.yaml /home/n0ko/capacity/repos/dev/ops/helm-deployments)
#rm $SCRIPT
#rm $FILES