Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions demo/scripts/getting_started_guide/04-publish-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
http:
- name: bookinfo
port: 80
hostname: bookinfo.tse.tetratelabs.io
hostname: bookinfo.tetrate.io
routing:
rules:
- route:
Expand All @@ -67,6 +67,6 @@ echo "Accessing the Service..."

export GATEWAY_IP=$(kubectl -n bookinfo get service bookinfo-ingress-gw -o jsonpath="{.status.loadBalancer.ingress[0]['hostname','ip']}")

curl -s --connect-to bookinfo.tse.tetratelabs.io:80:$GATEWAY_IP \
"http://bookinfo.tse.tetratelabs.io/productpage" | \
curl -s --connect-to bookinfo.tetrate.io:80:$GATEWAY_IP \
"http://bookinfo.tetrate.io/productpage" | \
grep "<title>" || true; echo "Deny All policy is in effect..."
79 changes: 79 additions & 0 deletions demo/scripts/getting_started_guide/04-r53-publish-service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
set -x

echo "Publishing a Service... as per https://docs.tetrate.io/service-express/getting-started/publish-service"

echo "Deploy an Ingress Gateway..."

cluster_name="$1"
external_dns_zone="$2"

echo "Cluster Name: $cluster_name"
echo "External DNS Zone: $external_dns_zone"


cat <<EOF > ingress-gw-install.yaml
apiVersion: install.tetrate.io/v1alpha1
kind: IngressGateway
metadata:
name: bookinfo-ingress-gw
namespace: bookinfo
spec:
kubeSpec:
service:
type: LoadBalancer
EOF

kubectl apply -f ingress-gw-install.yaml
sleep 10

echo "Expose the Bookinfo productpage service..."

cat <<EOF > bookinfo-group-ingress.yaml
apiVersion: gateway.tsb.tetrate.io/v2
kind: Group
metadata:
displayName: bookinfo
name: bookinfo-gwgroup
organization: tse
tenant: tse
workspace: bookinfo-ws
spec:
displayName: bookinfo
namespaceSelector:
names:
- "*/bookinfo"
---
apiVersion: gateway.tsb.tetrate.io/v2
kind: IngressGateway
metadata:
organization: tse
tenant: tse
group: bookinfo-gwgroup
workspace: bookinfo-ws
name: bookinfo-gw
spec:
workloadSelector:
namespace: bookinfo
labels:
app: bookinfo-ingress-gw
http:
- name: bookinfo
port: 80
hostname: bookinfo.$cluster_name.$external_dns_zone
routing:
rules:
- route:
host: bookinfo/productpage.bookinfo.svc.cluster.local
port: 9080
EOF

tctl apply -f bookinfo-group-ingress.yaml
sleep 10

echo "Accessing the Service..."

export GATEWAY_IP=$(kubectl -n bookinfo get service bookinfo-ingress-gw -o jsonpath="{.status.loadBalancer.ingress[0]['hostname','ip']}")

curl -s --connect-to bookinfo.$cluster_name.$external_dns_zone:80:$GATEWAY_IP \
"http://bookinfo.$cluster_name.$external_dns_zone/productpage" | \
grep "<title>" || true; echo "Deny All policy is in effect..."
10 changes: 8 additions & 2 deletions make/demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ deploy_action() {
local action_name="${1}"
local url_suffix="${2}"
local script_name="${3}"
local cluster_name="${4}"
local external_dns_zone="${5}"
print_info "${action_name}... as per https://docs.tetrate.io/service-express/getting-started/${url_suffix}"
export index=0
export AWS_K8S_CLUSTERS=$(echo ${TFVARS} | jq -c ".k8s_clusters.aws")
Expand All @@ -37,7 +39,7 @@ deploy_action() {
fi
init_kubeconfig $index $cluster_name $region
run_command_at_jumpbox "$index" "if [ ! -d demo ]; then git clone ${GIT_REPO}; cp -r tetrate-service-express-sandbox/demo . ;fi"
run_command_at_jumpbox "$index" "./demo/scripts/getting_started_guide/${script_name}"
run_command_at_jumpbox "$index" "./demo/scripts/getting_started_guide/${script_name}" "$cluster_name" "$external_dns_zone"
}

case "${ACTION}" in
Expand All @@ -52,7 +54,11 @@ case "${ACTION}" in
deploy_action "Enforce A Zero-Trust Security Policy" "zero-trust" "03-zero-trust.sh"
;;
publish-service | 04-publish-service | 04)
deploy_action "Publishing a Service" "publish-service" "04-publish-service.sh"
if [[ "$external_dns_zone" = "null" ]]; then
deploy_action "Publishing a Service" "publish-service" "04-publish-service.sh"
else
deploy_action "Publishing a Service via AWS Route53" "publish-service" "04-r53-publish-service.sh" "$cluster_name" "$external_dns_zone"
fi
;;
publish-api | 05-publish-api | 05)
deploy_action "Publishing an API from the OAS definition" "publish-api" "05-publish-api.sh"
Expand Down