Skip to content

Instantly share code, notes, and snippets.

@dudash
Last active July 13, 2020 18:29
Show Gist options
  • Save dudash/2e756363fcf649c332702d0bb1f75857 to your computer and use it in GitHub Desktop.
Save dudash/2e756363fcf649c332702d0bb1f75857 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Loops to create an igress for each in the list
declare -a servicenames=(
# ===== Put all the services you want exposed here =====
"confluence"
"gitlab"
"jira"
"keycloak"
"mattermost"
"nexus"
"sonarqube"
"vault"
)
# set the namespace you installed istio into here
NAMESPACE=istio-system
GATEWAY=$(oc get route istio-ingressgateway -n $NAMESPACE --template='{{.spec.host}}')
echo "Creating a bunch of ingress objects"
echo "-------"
for i in "${servicenames[@]}"
do
SERVICENAME=$i.$GATEWAY
echo "creating $i-ingress for $SERVICENAME in $NAMESPACE"
cat <<EOF | kubectl -n $NAMESPACE create -f -
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: $i-ingress
namespace: $NAMESPACE
spec:
rules:
- host: $SERVICENAME
http:
paths:
- path: /
backend:
serviceName: istio-ingressgateway
servicePort: 80
EOF
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment