def deploy_socket_server(name, namespace, log_file_folder_path, log_file_name, broker_address, broker_topic_prefix, broker_output_topic_prefix, num_of_cars, target_node_port, cpu_limit=2, memory_limit="10G"): if not kube_client.is_namespace_exist(namespace): kube_client.create_namespace(namespace) if kube_client.is_service_exist(name, namespace): kube_client.delete_service(name, namespace) if kube_client.is_deployment_exist(name, namespace): kube_client.delete_deployment(name, namespace) kube_client.create_deployment( __get_socket_server_pod_body(name, namespace, log_file_folder_path, log_file_name, broker_address, broker_topic_prefix, broker_output_topic_prefix, num_of_cars, cpu_limit, memory_limit), namespace) resp = kube_client.create_service( __get_socket_server_service_body(name, namespace, target_node_port), namespace) print('SocketServer %s has been deployed.' % name) print( "\tInside cluster use: %s.%s.svc.cluster.local:%s\n\tOutside the cluster use node-ip:%s" % (name, namespace, '5000', target_node_port))
def deploy_tf_serving(name, namespace, grpc_port, rest_port, models_dir, model_name): if not kube_client.is_namespace_exist(namespace): kube_client.create_namespace(namespace) if kube_client.is_service_exist(name, namespace): kube_client.delete_service(name, namespace) if kube_client.is_deployment_exist(name, namespace): kube_client.delete_deployment(name, namespace) kube_client.create_deployment( __get_tf_serving_deployment_body(name, namespace, grpc_port, rest_port, models_dir, model_name), namespace) resp = kube_client.create_service( __get_tf_serving_service_body(name, namespace, grpc_port, rest_port), namespace) print('TensorFlow Serving %s has been deployed.' % name) print( "\tUse: %s.%s.svc.cluster.local:%s for the grpc and %s fot the rest api." % (name, namespace, str(grpc_port), str(rest_port))) print( "\tNote that TFServing is not accessible from the outside with this configuration" )
def deploy_dashboard(name, namespace, socket_server_ip, socket_server_port): if not kube_client.is_namespace_exist(namespace): kube_client.create_namespace(namespace) if kube_client.is_service_exist(name, namespace): kube_client.delete_service(name, namespace) if kube_client.is_deployment_exist(name, namespace): kube_client.delete_deployment(name, namespace) kube_client.create_deployment( __get_dashboard_deployment_body(name, namespace, socket_server_ip, socket_server_port), namespace) resp = kube_client.create_service( __get_dashboard_service_body(name, namespace), namespace) for i in resp.spec.ports: if i.name == 'dashboard-port': node_port = i.node_port port = i.port break print( 'IndyCar Dashboard %s has been deployed. It might take several minutes to run' % name) print( "\tUse: %s.%s.svc.cluster.local:%s for internal access\n\tOutside the cluster use node-ip:%s" % (name, namespace, str(port), str(node_port)))
def delete_dashboard(name, namespace): if kube_client.is_service_exist(name, namespace): kube_client.delete_service(name, namespace) if kube_client.is_deployment_exist(name, namespace): kube_client.delete_deployment(name, namespace) print('Dashboard %s has been deleted.' % name)
def delete_socket_server(name, namespace): if kube_client.is_service_exist(name, namespace): kube_client.delete_service(name, namespace) if kube_client.is_deployment_exist(name, namespace): kube_client.delete_deployment(name, namespace) print('SocketServer %s has been deleted.' % name)