From 2e5e5aca6dadce74b5566ac5e3154cb5886a0c5f Mon Sep 17 00:00:00 2001 From: Eddie Arrage Date: Tue, 3 Apr 2018 02:50:36 +0000 Subject: Fix Nginx lb in k8s/istio - Provide workaround to make nginx lb work properly - nginx_client sample can modify default load balancing from three to two servers at runtime - Ensure port 9180 is used for default deploy for lb and servers - Modify render_yaml to specify deploy_name so that clover-server1, 2, 3 can be used for default lb config - Ensure proxy template is aligned to lb to allow the source IP from originating host to be propagated to final destination - Fix default nginx proxy server_name to 'proxy-access-control' and change default proxy destination to 'http-lb' - Split lb service_type to 'lbv1' and 'lbv2' to provide an example of how to modify the run-time configuration of the load balancer after deployment - modify http-lb-v2 to use clover-server4/5 instead of the defualt clover-server1/2/3 - modify http-lb-v1 to use clover-server1/2 instead of 1/2/3 - Aligned pod IP retrival method with nginx_client.py Change-Id: I73fa60a69c93ae1e82a477ef6283c00f67a21360 Signed-off-by: Eddie Arrage (cherry picked from commit 5e213108dfade163a85cff9b9156de9bd2c18887) --- samples/services/nginx/yaml/render_yaml.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'samples/services/nginx/yaml/render_yaml.py') diff --git a/samples/services/nginx/yaml/render_yaml.py b/samples/services/nginx/yaml/render_yaml.py index 527ba8d..850f715 100644 --- a/samples/services/nginx/yaml/render_yaml.py +++ b/samples/services/nginx/yaml/render_yaml.py @@ -16,13 +16,16 @@ def render_yaml(args): grpc_port = '50054' if args['service_type'] == 'lb': out_file = 'lb.yaml' - deploy_name = 'http-lb' + if args['deploy_name'] == 'default': + args['deploy_name'] = 'http-lb' elif args['service_type'] == 'proxy': out_file = 'proxy.yaml' - deploy_name = 'proxy-access-control' + if args['deploy_name'] == 'default': + args['deploy_name'] = 'proxy-access-control' elif args['service_type'] == 'server': out_file = 'server.yaml' - deploy_name = 'clover-server' + if args['deploy_name'] == 'default': + args['deploy_name'] = 'clover-server' else: return "Invalid service type: {}".format(args['service_type']) @@ -33,7 +36,7 @@ def render_yaml(args): image_path=args['image_path'], image_name=args['image_name'], image_tag=args['image_tag'], - deploy_name=deploy_name, + deploy_name=args['deploy_name'], server_port=server_port, grpc_port=grpc_port ) @@ -60,5 +63,8 @@ if __name__ == '__main__': parser.add_argument( '--image_tag', default='latest', help='The image tag to use') + parser.add_argument( + '--deploy_name', default='default', + help='The deployment name to use') args = parser.parse_args() print(render_yaml(vars(args))) -- cgit 1.2.3-korg