#!/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/ingress/ingress-sni-passthrough/index.md #################################################################################################### source "content/en/boilerplates/snips/gateway-api-gamma-experimental.sh" snip_generate_client_and_server_certificates_and_keys_1() { mkdir example_certs openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -subj '/O=example Inc./CN=example.com' -keyout example_certs/example.com.key -out example_certs/example.com.crt } snip_generate_client_and_server_certificates_and_keys_2() { openssl req -out example_certs/nginx.example.com.csr -newkey rsa:2048 -nodes -keyout example_certs/nginx.example.com.key -subj "/CN=nginx.example.com/O=some organization" openssl x509 -req -sha256 -days 365 -CA example_certs/example.com.crt -CAkey example_certs/example.com.key -set_serial 0 -in example_certs/nginx.example.com.csr -out example_certs/nginx.example.com.crt } snip_deploy_an_nginx_server_1() { kubectl create secret tls nginx-server-certs \ --key example_certs/nginx.example.com.key \ --cert example_certs/nginx.example.com.crt } snip_deploy_an_nginx_server_2() { cat <<\EOF > ./nginx.conf events { } http { log_format main '$remote_addr - $remote_user [$time_local] $status ' '"$request" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; error_log /var/log/nginx/error.log; server { listen 443 ssl; root /usr/share/nginx/html; index index.html; server_name nginx.example.com; ssl_certificate /etc/nginx-server-certs/tls.crt; ssl_certificate_key /etc/nginx-server-certs/tls.key; } } EOF } snip_deploy_an_nginx_server_3() { kubectl create configmap nginx-configmap --from-file=nginx.conf=./nginx.conf } snip_deploy_an_nginx_server_4() { cat < GET / HTTP/1.1 > User-Agent: curl/7.58.0 > Host: nginx.example.com ... < HTTP/1.1 200 OK < Server: nginx/1.17.10 ... Welcome to nginx! ... ENDSNIP snip_configure_an_ingress_gateway_1() { kubectl apply -f - < Welcome to nginx! ENDSNIP snip_cleanup_1() { kubectl delete gateway mygateway kubectl delete virtualservice nginx } snip_cleanup_2() { kubectl delete gtw mygateway kubectl delete tlsroute nginx } snip_cleanup_3() { kubectl delete secret nginx-server-certs kubectl delete configmap nginx-configmap kubectl delete service my-nginx kubectl delete deployment my-nginx rm ./nginx.conf } snip_cleanup_4() { rm -rf ./example_certs }