def deploy_api_routes()

in nuvolaris/endpoint.py [0:0]


def deploy_api_routes(apihost,namespace,should_create_www=False):
    logging.info(f"**** configuring openshift route based endpoint for apihost {apihost}")

    api = RouteData(apihost)
    api.with_route_name(api_route_name(namespace,"apihost"))
    api.with_service_name("controller-ip")
    api.with_service_kind("Service")
    api.with_service_port("8080")
    api.with_context_path("/api/v1")
    api.with_rewrite_target("/api/v1")

    my = RouteData(apihost)
    my.with_route_name(api_route_name(namespace,"apihost-my"))
    my.with_service_name("controller-ip")
    my.with_service_kind("Service")
    my.with_service_port("8080")
    my.with_context_path("/api/my")
    my.with_rewrite_target(f"/api/v1/web/namespace/{namespace}")  

    logging.info(f"*** configuring route for apihost")
    path_to_template_yaml =  api.render_template(namespace)
    res = kube.kubectl("apply", "-f",path_to_template_yaml)
    os.remove(path_to_template_yaml)

    logging.info(f"*** configuring route for apihost-my")
    path_to_template_yaml =  my.render_template(namespace)
    res += kube.kubectl("apply", "-f",path_to_template_yaml)
    os.remove(path_to_template_yaml) 

    if should_create_www:
            www_my = RouteData(apihost_util.append_prefix_to_url(apihost,"www"))
            www_my.with_route_name(api_route_name(namespace,"apihost-www-my"))
            www_my.with_service_name("controller-ip")
            www_my.with_service_kind("Service")
            www_my.with_service_port("8080")
            www_my.with_context_path("/api/my")
            www_my.with_rewrite_target(f"/api/v1/web/namespace/{namespace}") 

            logging.info(f"*** configuring route for apihost-www-my")
            path_to_template_yaml =  www_my.render_template(namespace)
            res += kube.kubectl("apply", "-f",path_to_template_yaml)
            os.remove(path_to_template_yaml) 
        
    return res