timeZone: America/Chicago
customer: tapestry-prod
portal: https://tapestry-prod.digitalwavetechnology.com
local_user_id: 1000
local_user_name: ubuntu
pim_api_url: "https://api-plumslice.tapestry.com"
cookie_session_name: _hyd
cookie_session_no_expires: "0"
cookie_session_max_age: 604800
cookie_session_http_only: true
cookie_session_secure: true
cookie_session_domain: ""
persistent_volume_claim: ""
azure: false
rabbitmq:
  enabled: true
  fullnameOverride: rabbitmq
  auth:
    username: admin
    password: admin
    erlangCookie: erlangCookiesecretcookie
  service:
    type: NodePort
    port: 33333
pre_install_hook:
  enabled: true
  image: docker.io/goalprofit/env:1.2
argocd:
  enabled: false
  sync_window_start: "* * * * *"
  sync_window_duration: 1h
api_router:
  enabled: false
  version: "1.0"
  proxy_upstreams: |
    upstream api_router {
      server api-router:8080;
    }
    upstream api_router_auth {
      server server:8080;
    }
  proxy_locations: |
    location /api {
        auth_request /api_auth;
        proxy_pass http://api_router/;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_read_timeout 600;
    }
    location /api_auth {
      internal;
      proxy_method POST;
      proxy_set_header content-type \"application/json\";
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_pass http://api_router_auth/graphql;
    }
api_router_schema_updater:
  enabled: false
  version: "1.0"
  proxy_upstreams: |
    upstream api_router_schema_updater {
      server api-router-schema-updater:8080;
    }
    upstream api_router_schema_updater_auth {
      server server:8080;
    }
  proxy_locations: |
    location /api-router-schema-updater {
        auth_request /api_router_schema_updater_auth;
        proxy_pass http://api_router_schema_updater/;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_read_timeout 600;
    }
    location /api_router_schema_updater_auth {
      internal;
      proxy_method POST;
      proxy_set_header content-type \"application/json\";
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_pass http://api_router_schema_updater_auth/graphql;
    }
assets_inlet:
  enabled: false
  version: "1.0"
  proxy_upstreams: |
    upstream assets_inlet {
      server assets-inlet:8080;
    }
    upstream assets_inlet_auth {
      server server:8080;
    }
  proxy_locations: |
    location /assets-inlet {
        auth_request /assets_inlet_auth;
        rewrite ^/assets-inlet(.*)$ $1 break;
        proxy_pass http://assets_inlet;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_read_timeout 600;
    }
    location /assets_inlet_auth {
      internal;
      proxy_method POST;
      proxy_set_header content-type \"application/json\";
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_pass http://assets_inlet_auth/graphql;
    }
attr_modeling:
  enabled: true
  version: "1.0"
  proxy_upstreams: |
    upstream attr_modeling {
      server attr-modeling:8080;
    }
    upstream attr_modeling_auth {
      server server:8080;
    }
  proxy_locations: |
    location /attr-modeling {
      auth_request /attr_modeling_auth;
      proxy_pass http://attr_modeling;
      proxy_redirect   off;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host:$server_port;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
    }
    location /attr_modeling_auth {
      internal;
      proxy_method POST;
      proxy_set_header content-type \"application/json\";
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_pass http://attr_modeling_auth/graphql;
    }
auth:
  enabled: false
auth_proxy:
  enabled: false
  nginx_conf: ""
  proxy_upstreams: |
    upstream auth-proxy {
      server auth-proxy;
    }
  proxy_locations: |
    location /engine-rest {
      proxy_pass http://auth-proxy;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
    location /camunda {
      proxy_pass http://auth-proxy;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
backup:
  version: "1.0"
  enabled: false
  suspend: false
  schedule: "0 0 * * 0"
  server: backup
camunda:
  enabled: false
  mailer:
    args: []
    auth: ""
  graphql:
    args: []
    auth: ""
camunda2:
  enabled: false
  camunda_version: "7.20.0" # camunda/camunda-bpm-platform tag
  api_version: "0.0.1" # camunda-api tag
  camunda_db: "postgres" # postgres | mysql
  proxy_upstreams: |
    upstream camunda {
      server camunda:8080;
    }
    upstream camunda_auth {
      server server:8080;
    }
  proxy_locations: |
    location /camunda {
      auth_request /camunda_auth;
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_pass http://camunda;
      proxy_hide_header Content-Security-Policy;
      add_header Content-Security-Policy \"base-uri script-src 'self' 'unsafe-inline' ajax.cloudflare.com;\";
    }
    location /engine-rest {
      auth_request /camunda_auth;
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_pass http://camunda;
    }
    location /camunda_auth {
      internal;
      proxy_method POST;
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_set_header content-type \"application/json\";
      proxy_pass http://camunda_auth/graphql;
    }
  router_config: |
    camunda2: { routing_url: http://camunda-api:4002/, schema: { subgraph_url: http://camunda-api:4002/ } }
classifier:
  enabled: false
  proxy_upstreams: |
    upstream classifier {
      server classifier:5000;
    }
  proxy_locations: |
    location /classify {
      proxy_pass http://classifier;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
    location /generate {
      proxy_pass http://classifier;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
      rewrite  ^/grafana/(.*) /$1 break;
    }
postgresql:
  enabled: false
coder:
  enabled: false
  #      auth_request /coder_auth;
  proxy_upstreams: |
    upstream coder_auth {
      server server:8080;
    }
  proxy_locations: |
    location /coder {
      try_files /nonexistent @coder_$http_upgrade;
    }
    location @coder_ {
      proxy_pass http://coder:80;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
    }
    location @coder_websocket {
      proxy_pass http://coder:80;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection \"Upgrade\";
      proxy_set_header Host $host;
      proxy_read_timeout 600;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      rewrite ^/coder(/.*)$ $1 break;
    }
    location /coder_auth {
      internal;
      proxy_method POST;
      proxy_set_header content-type \"application/json\";
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_pass http://coder_auth/graphql;
    }
ai:
  enabled: true
  version: "2.0"
  proxy_upstreams: |
    upstream ai {
      server ai:8080;
    }
  proxy_locations: |
    location /generate {
      proxy_pass http://ai;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
    location /ai {
      proxy_pass http://ai;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
    location ~* ^/socket.io/ {
      proxy_pass http://ai;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection \"upgrade\";
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_buffering off;
    }
assistant:
  enabled: false
  version: "1.0"
  proxy_upstreams: |
    upstream assistant {
      server assistant:8080;
    }
    upstream assistant_auth {
      server server:8080;
    }
  proxy_locations: |
    location /assistant {
        auth_request /assistant_auth;
        proxy_pass http://assistant;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_read_timeout 600;
    }
    location /assistant_auth {
      internal;
      proxy_method POST;
      proxy_set_header content-type \"application/json\";
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_pass http://assistant_auth/graphql;
    }
comp:
  enabled: false
cron:
  enabled: false
cronjobs:
  enabled: false
debug:
  version: "1.0"
  enabled: false
download:
  enabled: false
  schedule: "0 * * * *"
  suspend: false
  image: download:latest
  env: ""
front:
  version: "2.1.34"
  enabled: true
image_converter:
  version: latest
  enabled: false
export_mail:
  version: latest
  enabled: false
lftp_mirror:
  enabled: false
  version: "1.0"
  schedule: "0 * * * *"
  suspend: false
  ftp_url: ""
  local_url: /in
  ftp_folder: ""
mail:
  enabled: false
  ssmtp_config_path: /data/ssmtp.conf
mdc_converter:
  enabled: false
  version: "1.0"
  proxy_upstreams: |
    upstream mdc_converter {
      server mdc-converter:5000;
    }
  proxy_locations: |
    location /mdc {
      proxy_pass http://mdc_converter;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
modeling:
  enabled: false
  image: goalprofit/modeling
  suspend: false
  cluster: modeling
  region: europe-west1
  s3_storage_endpoint: https://storage.googleapis.com
miracl:
  enabled: true
  version: "1.0"
  client_id: xxx
  client_secret: xxx
  proxy_upstreams: |
    upstream miracl {
      server miracl:8000;
    }
  proxy_locations: |
    location /miracl {
      proxy_pass http://miracl;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
mysql:
  enabled: true
  url: tapestrytoro-psl-com.c36yn6p12e8l.us-east-1.rds.amazonaws.com
  host: tapestry-prod
opportunity_cost:
  enabled: false
  schedule: "0 3 * * 6"
  strategy: system_cost_opportunity
  instant_lag: 0
  delayed_lag: 7
  date: ""
optimization:
  enabled: false
  version: "2.1"
  num_cpus: 64
optimizationmd:
  enabled: false
packman:
  version: "2.0"
  enabled: true
  proxy_upstreams: |
    upstream packman {
      server packman:9091;
    }
  proxy_locations: |
    location /packman {
      proxy_pass http://packman;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
pimml:
  enabled: false
  url: https://pimml.goalprofit.com
pim_attr_link_generator:
  version: "1.0"
  enabled: false
  schedule: "0 * * * *"
pim_token_update:
  version: "1.0"
  enabled: true
  schedule: "0 0 * * *"
pimsync:
  version: "1.0"
  enabled: true
  proxy_upstreams: |
    upstream pimsync {
      server pimsync:8080;
    }
  proxy_locations: |
    location /pimsync {
      proxy_pass http://pimsync;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
proxy:
  version: "1.0"
  enabled: true
  port: 30045
retail:
  image: docker.io/goalprofit/retail
  version: "1.4"
  enabled: true
  optimization_url: http://optimization:5000
  optimizationmd_url: https://62lrdxjimdkwo5mbliuppiaequ0gdzin.lambda-url.eu-west-3.on.aws
  optimizationmeta_url: http://optimization:5000
retail_restart:
  enabled: false
  schedule: "0 10 * * *"
save:
  enabled: true
scrapper:
  enabled: false
  proxy_upstreams: |
    upstream scrapper {
      server scrapper:3000;
    }
  proxy_locations: |
    location /scrap {
      proxy_pass http://scrapper;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
server:
  image: docker.io/goalprofit/core
  version: "1.5.4"
  enabled: true
  port: 30000
  ram_limit: 10Ti
  proxy_upstreams: |
    upstream server {
      server server:8080;
    }
  proxy_locations: |
    location / {
      proxy_pass http://server;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
    location /ws {
        proxy_pass http://server;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection \"Upgrade\";
        proxy_read_timeout 600;
    }
  mysql_slave_index: 1
server_api:
  enabled: false
  version: "1.0"
  proxy_upstreams: |
    upstream server_api {
      server server-api:8080;
    }
    upstream server_api_auth {
      server server:8080;
    }
  proxy_locations: |
    location /server-api {
        auth_request /server_api_auth;
        proxy_pass http://server_api;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_read_timeout 600;
    }
    location /server_api_auth {
      internal;
      proxy_method POST;
      proxy_set_header content-type \"application/json\";
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_pass http://server_api_auth/graphql;
    }
  router_config: |
    server-api: { routing_url: http://server-api:8080/, schema: { subgraph_url: http://server-api:8080/ } }
pages_server:
  enabled: false
  version: "0.2"
  proxy_upstreams: |
    upstream dev {
      server pages-server:8080;
    }
    upstream dev_auth {
      server server:8080;
    }
  proxy_locations: |
    location /pages {
        auth_request /dev_auth;
        proxy_pass http://dev;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_read_timeout 600;
    }
    location /dev_auth {
      internal;
      proxy_method POST;
      proxy_set_header content-type \"application/json\";
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_pass http://dev_auth/graphql;
    }
temperature_forecast:
  version: latest
  enabled: false
  suspend: false
  schedule: "0 0 * * 0"
jupyter:
  version: "0.1"
  enabled: true
  port: 30100
  ram_limit: 10Ti
  proxy_upstreams: |
    upstream jupyter {
      server jupyter:8888;
    }
    upstream jupyter_auth {
      server server:8080;
    }
  proxy_locations: |
    location /jupyter {
      try_files /nonexistent @jupyter_$http_upgrade;
    }
    location @jupyter_websocket {
      proxy_pass http://jupyter;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection \"Upgrade\";
      proxy_set_header Host $host;
      proxy_read_timeout 600;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    location @jupyter_ {
      auth_request /jupyter_auth;
      proxy_pass http://jupyter;
      proxy_redirect   off;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host:$server_port;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_hide_header Content-Security-Policy;
      add_header Content-Security-Policy \"frame-ancestors 'self' https://*.digitalwavetechnology.com https://*.goalprofit.com\";
    }
    location /jupyter_auth {
      internal;
      proxy_method POST;
      proxy_set_header content-type \"application/json\";
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_pass http://jupyter_auth/graphql;
    }
voila:
  enabled: false
  version: "1.0"
  ram_limit: 10Ti
  proxy_upstreams: |
    upstream voila {
      server voila:8866;
    }
    upstream voila_auth {
      server server:8080;
    }
  proxy_locations: |
    location /voila {
      try_files /nonexistent @voila_$http_upgrade;
    }
    location @voila_websocket {
      proxy_pass http://voila;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection \"Upgrade\";
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
    location @voila_ {
      auth_request /voila_auth;
      proxy_pass http://voila;
      proxy_redirect   off;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host:$server_port;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_hide_header Content-Security-Policy;
      add_header Content-Security-Policy \"frame-ancestors 'self' https://*.digitalwavetechnology.com https://*.goalprofit.com\";
    }
    location /voila_auth {
      internal;
      proxy_method POST;
      proxy_set_header content-type \"application/json\";
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_pass http://voila_auth/graphql;
    }
solara:
  enabled: false
  version: "1.1"
  proxy_upstreams: |
    upstream solara {
      server solara:8765;
    }
    upstream solara_auth {
      server server:8080;
    }
  proxy_locations: |
    location /solara {
      try_files /nonexistent @solara_$http_upgrade;
    }
    location @solara_websocket {
      proxy_pass http://solara;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection \"Upgrade\";
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
    location @solara_ {
      proxy_redirect   off;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-Proto $scheme;
      auth_request /solara_auth;
      proxy_pass http://solara;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Script-Name /solara;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection \"upgrade\";
      proxy_hide_header Content-Security-Policy;
      add_header Content-Security-Policy \"frame-ancestors 'self' https://*.digitalwavetechnology.com https://*.goalprofit.com\";
    }
    location /solara_auth {
      internal;
      proxy_method POST;
      proxy_set_header content-type \"application/json\";
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_pass http://solara_auth/graphql;
    }
streamlit:
  version: dev
  enabled: false
  proxy_upstreams: |
    upstream streamlit {
      server streamlit:8501;
    }
  proxy_locations: |
    location /streamlit {
      proxy_pass http://streamlit;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection \"Upgrade\";
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
sync:
  enabled: false
webjobs:
  enabled: false
  proxy_upstreams: |
    upstream webjobs {
      server webjobs:8082;
    }
  proxy_locations: |
    location /webjobs {
      proxy_pass http://webjobs;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
    }
  config: {}
work:
  enabled: false
loki_stack:
  enabled: true
  fullnameOverride: loki-stack
  loki:
    enabled: true
    isDefault: false
    fullnameOverride: loki
    rbac:
      create: false
      pspEnabled: false
  promtail:
    enabled: true
    config:
      clients:
        - url: http://loki:3100/loki/api/v1/push
      snippets:
        extraRelabelConfigs:
          - source_labels: [__meta_kubernetes_namespace]
            regex: "{{.Values.customer}}"
            action: keep
  prometheus:
    enabled: true
    isDefault: true
    namespaces: ["{{.Values.customer}}"]
    alertmanager:
      useClusterRole: false
    nodeExporter:
      enabled: false
      fullname: "{{.Release.Namespace}}-node-exporter"
      service:
        hostPort: 9091
    server:
      # fullnameOverride: prometheus-server
      fullname: "{{.Release.Namespace}}-prometheus-server"
    kubeStateMetrics:
      enabled: false
    kube-state-metrics:
      fullnameOverride: kube-state-metrics
    extraScrapeConfigs: |
      - job_name: server
        metrics_path: /metrics
        static_configs:
          - targets:
            - server:8080
  grafana:
    enabled: true
    fullnameOverride: grafana
    image:
      tag: 10.0.3
    rbac:
      create: false
      pspEnabled: false
      namespaced: true
    adminUser: admin
    adminPassword: admin
    grafana.ini:
      users:
        viewers_can_edit: false
      auth.anonymous:
        enabled: true
        org_role: Admin
      database:
        wal: false
      server:
        root_url: "%(protocol)s://%(domain)s/grafana"
        serve_from_sub_path: true
  proxy_upstreams: |
    upstream grafana {
      server grafana;
    }
    upstream grafana_auth {
      server server:8080;
    }
  proxy_locations: |
    location /grafana {
        auth_request /grafana_auth;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://grafana;
    }
    location @noaccess {
      return 302 /pages;
    }
    location /grafana_auth {
      internal;
      proxy_method POST;
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_set_header content-type \"application/json\";
      proxy_pass http://grafana_auth/graphql;
    }
pypi_server:
  enabled: false
  version: "1.0"
  proxy_upstreams: |
    upstream pypi-server {
      server pypi-server:8080;
    }
  proxy_locations: |
    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://pypi-server;
    }
downloads:
  enabled: false
  version: "1.0"
  proxy_upstreams: |
    upstream downloads {
      server downloads:8080;
    }
    upstream downloads_auth {
      server server:8080;
    }
  proxy_locations: |
    location /downloads {
        auth_request /downloads_auth;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        rewrite ^/downloads/(.*)$ /$1 break;
        proxy_pass http://downloads;
    }
    location /downloads_auth {
      internal;
      proxy_method POST;
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_set_header content-type \"application/json\";
      proxy_pass http://downloads_auth/graphql;
    }
jupyterhub_internal:
  fullnameOverride: jupyterhub
  proxy:
    service:
      type: ClusterIP
  singleuser:
    image:
      #      name: quay.io/jupyter/datascience-notebook
      #      tag: "2023-11-06"
      name: goalprofit/jupyterhub
      tag: "{{.Values.jupyterhub.version}}"
      pullSecrets:
        - name: regcred
      pullPolicy: Always
    cmd: jupyterhub-singleuser --help
    networkPolicy:
      enabled: false
    extraEnv:
      CUSTOMER: "{{.Values.customer}}"
      SERVICE_LOGIN:
        valueFrom:
          secretKeyRef:
            name: secret-service
            key: username
      SERVICE_PASSWORD:
        valueFrom:
          secretKeyRef:
            name: secret-service
            key: password
      OPENAI_API_KEY:
        valueFrom:
          secretKeyRef:
            name: secret-openai
            key: key
  #    storage:
  #      extraVolumes:
  #        - name: jupyterhub-storage
  #          hostPath:
  #            path: /data/tapestry-dev/data/jupyterhub
  #            type: Directory
  #      extraVolumeMounts:
  #        - name: jupyterhub-storage
  #          mountPath: /data
  hub:
    baseUrl: /jupyterhub
    config:
      Authenticator:
        #        admin_users:
        #          - adminuser1
        #          - adminuser2
        auto_login: true
    extraEnv:
      CUSTOMER: "{{.Values.customer}}"
      SERVICE_LOGIN:
        valueFrom:
          secretKeyRef:
            name: secret-service
            key: username
      SERVICE_PASSWORD:
        valueFrom:
          secretKeyRef:
            name: secret-service
            key: password
    extraVolumes:
      - name: my-host-volume
        hostPath:
          path: "/data/{{.Values.customer}}/data/jupyter/hub"
          type: Directory
    extraVolumeMounts:
      - name: my-host-volume
        mountPath: /data
    extraConfig:
      names_servers: |
        c.JupyterHub.allow_named_servers = True
      myExtraConfig: |
        # stub written from memory, beware of errors
        from jupyterhub.auth import Authenticator
        from http.cookies import SimpleCookie
        import base64
        import json
        print("!!!!!!!!!!!!!!!!!!!!!!")
        class MyCustomAuth(Authenticator):
          async def authenticate(self, handler, data):
            cookies = handler.request.cookies
            print("AAAAAAAAAAAAAAAAAAAAAAAAA", handler.request)
            print(f"data={data}")
            print(f"cookies={cookies}")
            print(f"cookies_items={cookies.items()}")
            print(f"_hyd={cookies['_hyd'].items()}")

            def decode_base64url(data):
              rem = len(data) % 4
              if rem > 0:
                  data += '=' * (4 - rem)
              return base64.urlsafe_b64decode(data)

            cookie = cookies['_hyd']

            print(f"Name: {key}, Value: {cookie.value}")
            morsel_value = cookie.value
            header_b64, payload_b64, signature_b64 = morsel_value.split(".")
            payload = json.loads(decode_base64url(payload_b64))

            print(payload)

            return {"name": payload['sub']}

        from kubespawner import KubeSpawner
        import os
        class MyCustomSpawner(KubeSpawner):
            def start(self):
                username = self.user.name
                customer = os.getenv('CUSTOMER')
                os.makedirs(os.path.join("/data", username, ".ssh"), exist_ok=True)
                self.volumes = [{
                    'name': 'data-volume',
                    'hostPath': {
                        'path': f'/data/{customer}/data/jupyter/hub/{username}',
                        'type': 'DirectoryOrCreate'
                    }
                }, {
                    'name': 'ssh',
                    'hostPath': {
                        'path': f'/data/{customer}/data/jupyter/hub/{username}/.ssh',
                        'type': 'DirectoryOrCreate'
                    }
                }, {
                    'name': 'downloads-volume',
                    'hostPath': {
                        'path': f'/data/{customer}/data/downloads',
                        'type': 'DirectoryOrCreate'
                    }
                }]
                self.volume_mounts = [{
                    'name': 'data-volume',
                    'mountPath': '/home/jovyan/src'
                }, {
                    'name': 'ssh',
                    'mountPath': '/home/jovyan/.ssh'
                }, {
                    'name': 'downloads-volume',
                    'mountPath': '/downloads'
                }]
                return super().start()
        c.JupyterHub.spawner_class = MyCustomSpawner
        c.JupyterHub.authenticator_class = MyCustomAuth
        c.JupyterHub.cookie_max_age_days = 1/(60*60*24)*1 # 10 mins
#      proxy_set_header X-Real-IP $remote_addr;
#      auth_request /jupyterhub_auth;
jupyterhub:
  enabled: false
  version: "1.1.1"
  proxy_upstreams: |
    upstream jupyterhub {
      server jupyterhub-proxy-public:80;
    }
    upstream jupyterhub_auth {
      server server:8080;
    }
  proxy_locations: |
    location /jupyterhub {
      try_files /nonexistent @jupyterhub_$http_upgrade;
    }
    location @jupyterhub_websocket {
      proxy_pass http://jupyterhub;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection \"Upgrade\";
      proxy_set_header Host $host;
      proxy_read_timeout 600;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    location @jupyterhub_ {
      proxy_pass http://jupyterhub;
      proxy_set_header Host $host:$server_port;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_hide_header Content-Security-Policy;
      add_header Content-Security-Policy \"frame-ancestors 'self' https://*.digitalwavetechnology.com https://*.goalprofit.com\";
      add_header \'Access-Control-Allow-Origin\' \'*\';
      add_header \'Access-Control-Allow-Methods\' \'GET, POST, OPTIONS\';
      add_header \'Access-Control-Allow-Headers\' \'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range\';
      add_header \'Access-Control-Expose-Headers\' \'Content-Length,Content-Range\';
    }
    location /jupyterhub_auth {
      internal;
      proxy_method POST;
      proxy_set_header content-type \"application/json\";
      proxy_set_body '{\"query\": \"{}\"}';
      proxy_pass http://jupyterhub_auth/graphql;
    }
kubeflow:
  enabled: false
