komodorio / helm-dashboard

The missing UI for Helm - visualize your releases
Apache License 2.0
4.93k stars 300 forks source link

Can't serve from a subpath #529

Open LeoShivas opened 4 months ago

LeoShivas commented 4 months ago

Description

The helm-dashboard seems to only respond on a / context.

I want helm-dashboard to respond from my.domain.com/helm-dashboard.

Screenshots

image image image

Additional information

As stated in the ingress-nginx documentation, I deployed helm-dashboard like this :

helm upgrade \
--install \
-n helm-dashboard \
--create-namespace \
helm-dashboard komodorio/helm-dashboard \
--set ingress.enabled=true \
--set ingress.className=nginx \
--set ingress.hosts[0].host=my.domain.com \
--set ingress.hosts[0].paths[0].path="/helm-dashboard(/|$)(.*)" \
--set ingress.hosts[0].paths[0].pathType=ImplementationSpecific \
--set "ingress.annotations.nginx\\.ingress\\.kubernetes\\.io/use-regex"=\"true\" \
--set "ingress.annotations.nginx\\.ingress\\.kubernetes\\.io/rewrite-target"=/\$2 \
--set dashboard.persistence.storageClass=proxmox-data

Here is the result of the Ingress object deployed :

apiVersion: networking.k8s.io/v1                                                                                                                                                                                                              
kind: Ingress                                                                                                                                                                                                                                 
metadata:                                                                                                                                                                                                                                     
  annotations:                                                                                                                                                                                                                                
    meta.helm.sh/release-name: helm-dashboard                                                                                                                                                                                                 
    meta.helm.sh/release-namespace: helm-dashboard                                                                                                                                                                                            
    nginx.ingress.kubernetes.io/rewrite-target: /$2                                                                                                                                                                                           
    nginx.ingress.kubernetes.io/use-regex: '"true"'                                                                                                                                                                                           
  creationTimestamp: "2024-05-13T12:54:11Z"                                                                                                                                                                                                   
  generation: 4                                                                                                                                                                                                                               
  labels:                                                                                                                                                                                                                                     
    app.kubernetes.io/instance: helm-dashboard                                                                                                                                                                                                
    app.kubernetes.io/managed-by: Helm                                                                                                                                                                                                        
    app.kubernetes.io/name: helm-dashboard                                                                                                                                                                                                    
    app.kubernetes.io/version: 1.3.3                                                                                                                                                                                                          
    helm.sh/chart: helm-dashboard-0.1.10                                                                                                                                                                                                      
  name: helm-dashboard                                                                                                                                                                                                                        
  namespace: helm-dashboard                                                                                                                                                                                                                   
  resourceVersion: "64792982"                                                                                                                                                                                                                 
  uid: bb265280-fcf5-49ed-9f04-4ad5a8c7c4db                                                                                                                                                                                                   
spec:                                                                                                                                                                                                                                         
  ingressClassName: nginx                                                                                                                                                                                                                     
  rules:                                                                                                                                                                                                                                      
  - host: my.domain.com                                                                                                                                                                                                               
    http:                                                                                                                                                                                                                                     
      paths:                                                                                                                                                                                                                                  
      - backend:                                                                                                                                                                                                                              
          service:                                                                                                                                                                                                                            
            name: helm-dashboard                                                                                                                                                                                                              
            port:                                                                                                                                                                                                                             
              number: 8080                                                                                                                                                                                                                    
        path: /helm-dashboard(/|$)(.*)                                                                                                                                                                                                        
        pathType: ImplementationSpecific                                                                                                                                                                                                      
status:                                                                                                                                                                                                                                       
  loadBalancer:                                                                                                                                                                                                                               
    ingress:                                                                                                                                                                                                                                  
    - ip: x.x.x.x

Subsequently, I would like to set up oauth2 authentification.

undera commented 4 months ago

I acknowledge the problem. But I lack advanced ReactJS skills to make it work with subpath correctly. Some external help is needed here.

LeoShivas commented 4 months ago

It is absolutely not my domain either, but I found this issue where there are a lot of comments about this feature : https://github.com/storybookjs/storybook/issues/1291

I hope that could help.

LeoShivas commented 4 months ago

As helm-dashboard is built in a / context, it's difficult, in a multipaths context, to rewrite the / routes from helm-dashboard to a dedicated subpath (as / matches all the apps under it).

However, if helm-dashboard is built in a default /helm-dashboard context (or something else), it would be a lot easier to rewrite the /helm-dashboard routes to another dedicated subpath.

I know my idea is a big change, but can it be a possible solution ?

undera commented 4 months ago

I understand your idea, but it's same effort as making it work from subdirectory IMO. I'd prefer to keep it elegant.