#!/bin/bash # shellcheck disable=SC2034,SC2153,SC2155,SC2164 # Copyright Istio Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #################################################################################################### # WARNING: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT. PLEASE MODIFY THE ORIGINAL MARKDOWN FILE: # docs/tasks/traffic-management/egress/wildcard-egress-hosts/index.md #################################################################################################### snip_before_you_begin_1() { istioctl install --set values.pilot.env.PILOT_ENABLE_CONFIG_DISTRIBUTION_TRACKING=true --set profile=demo --set meshConfig.outboundTrafficPolicy.mode=REGISTRY_ONLY } snip_before_you_begin_2() { kubectl apply -f samples/sleep/sleep.yaml } snip_before_you_begin_3() { kubectl apply -f <(istioctl kube-inject -f samples/sleep/sleep.yaml) } snip_before_you_begin_4() { export SOURCE_POD=$(kubectl get pod -l app=sleep -o jsonpath={.items..metadata.name}) } snip_configure_direct_traffic_to_a_wildcard_host_1() { kubectl apply -f - <.*"; curl -s https://de.wikipedia.org/wiki/Wikipedia:Hauptseite | grep -o ".*"' } ! read -r -d '' snip_configure_direct_traffic_to_a_wildcard_host_2_out <<\ENDSNIP Wikipedia, the free encyclopedia Wikipedia – Die freie Enzyklopädie ENDSNIP snip_cleanup_direct_traffic_to_a_wildcard_host_1() { kubectl delete serviceentry wikipedia } snip_configure_egress_gateway_traffic_to_a_wildcard_host_1() { kubectl apply -f - <.*"; curl -s https://de.wikipedia.org/wiki/Wikipedia:Hauptseite | grep -o ".*"' } ! read -r -d '' snip_configure_egress_gateway_traffic_to_a_wildcard_host_3_out <<\ENDSNIP Wikipedia, the free encyclopedia Wikipedia – Die freie Enzyklopädie ENDSNIP snip_configure_egress_gateway_traffic_to_a_wildcard_host_4() { kubectl exec "$(kubectl get pod -l istio=egressgateway -n istio-system -o jsonpath='{.items[0].metadata.name}')" -c istio-proxy -n istio-system -- pilot-agent request GET clusters | grep '^outbound|443||www.wikipedia.org.*cx_total:' } ! read -r -d '' snip_configure_egress_gateway_traffic_to_a_wildcard_host_4_out <<\ENDSNIP outbound|443||www.wikipedia.org::208.80.154.224:443::cx_total::2 ENDSNIP snip_cleanup_egress_gateway_traffic_to_a_wildcard_host_1() { kubectl delete serviceentry www-wikipedia kubectl delete gateway istio-egressgateway kubectl delete virtualservice direct-wikipedia-through-egress-gateway kubectl delete destinationrule egressgateway-for-wikipedia } snip_cleanup_1() { kubectl delete -f samples/sleep/sleep.yaml } snip_cleanup_2() { istioctl uninstall --purge -y }