#!/bin/bash
# Info: Script to install/create/delete/update istio from file settings 
# Author: JesusPerezLorenzo  
# Release: 1.0 
# Date: 12-11-2024

USAGE="install.sh install | update | remvoe"
[ "$1" == "-h"  ] && echo "$USAGE"  && exit 1

INSTALL_LOG=${INSTALL_LOG:-"/tmp/k8s.log"}
kubectl get crd gateways.gateway.networking.k8s.io &> /dev/null || \
  { kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd?ref=v1.0.0" | kubectl apply -f -; }

curl -sL https://istio.io/downloadIstio | sh - 
cd istio-1.*  || exit
./bin/istioctl install --set profile=demo -y
sudo cp ./bin/istioctl /usr/local/bin
cd .. || exit
sudo rm -rf istio-1.*
