Reputation: 67
This script below is working, I want to read a value from files svc1.data and used it in syntax.
administrator@dev-91:~$ while read -r name port ignored; do echo $name $port ; done <svc1.data
bendita-nussa 4003
But this script below doesn't work, it keeps saying : -bash: syntax error near unexpected token `;'
administrator@dev-91:~$ while read -r name port ignored; do
kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: $name
namespace: nussa
spec:
hosts:
- $name.nussa.svc.cluster.local
http:
- route:
- destination:
host: $name
port:
number: $port
subset: v1
; done <svc1.data
Please help, whats wrong with the 2nd script..
Upvotes: 0
Views: 856
Reputation: 195
Just close the HEREDOC, like this:
while read -r name port ignored; do
kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: $name
namespace: nussa
spec:
hosts:
- $name.nussa.svc.cluster.local
http:
- route:
- destination:
host: $name
port:
number: $port
subset: v1
EOF
done <svc1.data
Upvotes: 2