apiVersion: v1
data:
  nginx.conf: "daemon off;\nerror_log  /var/log/nginx/error.log;\nworker_processes
    5;\nevents { worker_connections  1024; }\n\nhttp {\n    log_format apm '\"$time_local\"
    client=$remote_addr '\n                   'remote_addr=$remote_addr'\n                   'remote_user=$remote_user'\n
    \                  'method=$request_method'\n                   'request=\"$request\"
    '\n                   'request_length=$request_length '\n                   'status=$status'\n
    \                  'bytes_sent=$bytes_sent '\n                   'body_bytes_sent=$body_bytes_sent
    '\n                   'referer=$http_referer '\n                   'user_agent=\"$http_user_agent\"
    '\n                   'upstream_addr=$upstream_addr '\n                   'upstream_status=$upstream_status
    '\n                   'request_time=$request_time '\n                   'upstream_response_time=$upstream_response_time
    '\n                   'upstream_connect_time=$upstream_connect_time '\n                   'upstream_header_time=$upstream_header_time';\n\n
    \   sendfile                on;\n    tcp_nopush              on;\n    tcp_nodelay
    \            on;\n    client_header_timeout   2m;\n    client_body_timeout     2m;\n
    \   proxy_connect_timeout   600;\n    proxy_send_timeout      600;\n    proxy_read_timeout
    \     600;\n    send_timeout            600;\n\n\n    server {\n      listen 9999;\n
    \     resolver NGINX_RESOLVER valid=1s;\n      proxy_intercept_errors
    on;\n      access_log /var/log/nginx/apm.log apm;\n      \n      location = /internal
    {\n      \tinternal;            \n      \tproxy_pass              https://spark-hb-control-plane:9443/access/v1/apikey/authorize_dataplane;\n
    \     \tproxy_set_header X-Forwarded-User $http_authorization;\n      \tproxy_set_header
    Authorization $http_authorization;\n      \tproxy_set_header        Content-Length
    \"\";\n      \tproxy_set_header X-Original-Request $request;\n      \tproxy_http_version
    1.1;\n      }\n      \t\n      location ~ /(.*)/jkg/(.*)$ {\n          #auth_request
    \    /internal;\n          #auth_request_set $auth_status $upstream_status;\n
    \         set $serv  http://jkg-headless-$1.OC_PROJECT_NAMESPACE.svc.cluster.local:8888/$2;\n          proxy_pass
    \ $serv;\n          proxy_set_header X-Real-IP $remote_addr;\n          proxy_set_header
    Host $host;\n          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n
    \         proxy_set_header X-NginX-Proxy true;\n\n          # WebSocket support\n
    \         proxy_http_version 1.1;\n          proxy_set_header Upgrade $http_upgrade;\n
    \         proxy_set_header Connection \"upgrade\";\n          proxy_read_timeout
    86400;\n      }\n      location ~ /(.*)/v1/jobs/(.*)$ {\n          #auth_request
    \    /internal;\n          #auth_request_set $auth_status $upstream_status;\n
    \         set $serv  http://spark-master-headless-$1.OC_PROJECT_NAMESPACE.svc.cluster.local:6066/v1/submissions/$2;\n
    \         proxy_pass  $serv;\n          proxy_set_header X-Real-IP $remote_addr;\n
    \         proxy_set_header Host $host;\n          proxy_set_header X-Forwarded-For
    $proxy_add_x_forwarded_for;\n          proxy_set_header X-NginX-Proxy true;\n\n
    \     }\n      \n      location ~ /(.*)/v2/jobs/(.*)$ {\n          #auth_request
    \    /internal;\n          #auth_request_set $auth_status $upstream_status;\n
    \         set $serv  http://spark-master-headless-$1.OC_PROJECT_NAMESPACE.svc.cluster.local:8080/$2/;\n
    \         proxy_pass  $serv;\n          proxy_set_header X-Real-IP $remote_addr;\n
    \         proxy_set_header Host $host;\n          proxy_set_header X-Forwarded-For
    $proxy_add_x_forwarded_for;\n          proxy_set_header X-NginX-Proxy true;\n\n
    \     }\n      location ~ /helmDeployer/(.*)$ {\n          #auth_request     /internal;\n
    \         #auth_request_set $auth_status $upstream_status;\n          set $serv
    \ https://spark-hb-control-plane:9443/helmDeployer/$1$is_args$args;\n          proxy_pass
    \ $serv;\n          proxy_set_header X-Real-IP $remote_addr;\n          proxy_set_header
    Host $host;\n          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n
    \         proxy_set_header X-NginX-Proxy true;\n      }\n\n      location ~ /(.*)/sparkui/(.*)$
    {\n          set $kernel_id $1;\n          set $serv http://spark-master-headless-$kernel_id.OC_PROJECT_NAMESPACE.svc.cluster.local:8080/$2$is_args$args;\n
    \         proxy_pass   $serv;\n          proxy_set_header Host $host;\n          proxy_set_header
    X-Real-IP $remote_addr;\n          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n
    \         proxy_set_header Accept-Encoding \"\";\n          sub_filter 'href=\"/\"'
    'href=\"/$kernel_id/sparkui/\"';\n          sub_filter 'Back to Master</a></p>'
    '</a><a href=\"/$kernel_id/sparkui/\">Back to Master</a></p>';\n          sub_filter
    \"/proxy/app\" \"/$kernel_id/sparkui/proxy/app\";\n          sub_filter '\"/static/'
    '\"/$kernel_id/sparkui/static/';\n          sub_filter \"/proxy/worker\" \"/$kernel_id/sparkui/proxy/worker\";\n
    \         sub_filter_once off;\n          error_page 301 302 303 = @sparkhandler;\n
    \     }\n      location @sparkhandler {\n          proxy_set_header Host $host;\n
    \         proxy_set_header X-Real-IP $remote_addr;\n          proxy_set_header
    X-Forwarded-For $proxy_add_x_forwarded_for;\n          proxy_set_header Accept-Encoding
    \"\";\n          set $original_uri $uri;\n          set $orig_loc $upstream_http_location;\n
    \         set $spark_master_url http://spark-master-headless-$kernel_id.OC_PROJECT_NAMESPACE.svc.cluster.local:8080;\n
    \         if ($orig_loc ~* \"(.*)/proxy/(.*)\"){\n            set $new_uri $spark_master_url/proxy/$2;\n
    \         }\n          if ($orig_loc ~* \"(.*)/app/(.*)\"){\n            set $new_uri
    $spark_master_url/app/$2;\n          }\n          proxy_pass $new_uri;\n          sub_filter
    'href=\"/\"' 'href=\"/$kernel_id/sparkui/\"';\n          sub_filter 'Back to Master</a></p>'
    '</a><a href=\"/$kernel_id/sparkui/\">Back to Master</a></p>';\n          sub_filter
    '\"/static/' '\"/$kernel_id/sparkui/static/';\n          sub_filter \"/proxy/app\"
    \"/$kernel_id/sparkui/proxy/app\";\n          sub_filter \"/proxy/worker\" \"/$kernel_id/sparkui/proxy/worker\";\n
    \         sub_filter_once off;\n      }\n      location @historyhandler {\n          proxy_set_header
    Host $host;\n          proxy_set_header X-Real-IP $remote_addr;\n          proxy_set_header
    X-Forwarded-For $proxy_add_x_forwarded_for;\n          proxy_set_header Accept-Encoding
    \"\";\n          set $original_uri $uri;\n          set $orig_loc $upstream_http_location/;\n
    \         #return 200 \"$original_uri $uri   loc $orig_loc $upstream_http_location
    \    $is_args    $args\";\n          proxy_pass $orig_loc$is_args$args;\n          sub_filter
    '\"/static/' '\"/$1/historyui/static/';\n          sub_filter \"/jobs/job/\" \"/jobs/job\";\n
    \         sub_filter \"/stages/stage/\" \"/stages/stage\";\n          sub_filter
    \"/history/\" \"/$1/historyui/history/\";\n          sub_filter \"/proxy/\" \"/$1/historyui/proxy/\";\n
    \         sub_filter 'href=\"/?showIncomplete' 'href=\"/$1/historyui/?showIncomplete';\n
    \         sub_filter 'href=\"/' 'href=\"/$1/historyui/';\n          sub_filter_types
    application/javascript;\n          sub_filter 'return \"/log\"' 'return \"/$1/historyui/log\"';\n
    \         proxy_redirect ~^(http://[^/]+)/history(/.+)$ /$instance_id/historyui/history$2;\n
    \         sub_filter_once off;\n\n      } \n      location ~ /(.*)/historyui(.*)$
    {\n          proxy_pass   http://spark-history-headless-$1.OC_PROJECT_NAMESPACE.svc.cluster.local:18080$2;\n
    \         set $instance_id  $1;\n          proxy_set_header Accept-Encoding \"\";\n
    \         sub_filter '\"/static/' '\"/$1/historyui/static/';\n          sub_filter
    \"/history/\" \"/$1/historyui/history/\";\n          sub_filter \"/proxy/\" \"/$1/historyui/proxy/\";\n
    \         sub_filter 'href=\"/?showIncomplete' 'href=\"/$1/historyui/?showIncomplete';\n
    \         sub_filter \"/stages/stage/\" \"/stages/stage\";\n          sub_filter
    \"/jobs/job/\" \"/jobs/job\";\n          sub_filter 'getJSON(uiRoot + \"/api'
    'getJSON(uiRoot + \"/$1/historyui/api';\n          sub_filter 'attempt[\"log\"]
    = uiRoot + \"/api' 'attempt[\"log\"] = uiRoot + \"/$1/historyui/api';\n          sub_filter
    'href=\"/' 'href=\"/$1/historyui/';\n          sub_filter_types application/javascript;\n
    \         sub_filter 'return \"/log\"' 'return \"/$1/historyui/log\"';\n          sub_filter_once
    off;\n          error_page 301 302 303 = @historyhandler;\n\n      }\n    }\n}"
kind: ConfigMap
metadata:
  labels:
    app: spark-hb-nginx-configmap
    app.kubernetes.io/instance: ibm-spark-prod
    app.kubernetes.io/managed-by: helm
    app.kubernetes.io/name: ibm-spark-prod
    chart: ibm-spark-prod
    helm.sh/chart: ibm-spark-prod
    heritage: Tiller
    icpdata_addon_version: 3.0.30
    name: spark-hb-nginx-configmap
    release: ibm-spark-prod
  name: spark-hb-nginx-configmap
  namespace: OC_PROJECT_NAMESPACE