#!/bin/bash
SECRET_NAME=cloudnative-web-credentials
SSL_PATH=${1:-ssl}
[ ! -r "$SSL_PATH" ] && echo "SSL_PATH $SSLPATH not directory"  && exit 1

NAMESPACE=istio-system

echo "create $NAMESPACE secret $SECRET_NAME for tls ... "
kubectl delete -n $NAMESPACE secret $SECRET_NAME 2>/dev/null
kubectl create -n $NAMESPACE secret tls $SECRET_NAME \
  --key=$SSL_PATH/privkey.pem \
  --cert=$SSL_PATH/fullchain.pem 

