Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Can't serve from a subpath #529

Open
LeoShivas opened this issue May 14, 2024 · 6 comments
Open

Can't serve from a subpath #529

LeoShivas opened this issue May 14, 2024 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@LeoShivas
Copy link

LeoShivas commented May 14, 2024

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
Copy link
Collaborator

undera commented May 14, 2024

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

@undera undera added the help wanted Extra attention is needed label May 14, 2024
@LeoShivas
Copy link
Author

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

I hope that could help.

@LeoShivas
Copy link
Author

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
Copy link
Collaborator

undera commented May 14, 2024

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

@r-maerz
Copy link

r-maerz commented Jan 31, 2025

I too would want to serve the dashboard from a subpath. As things stand an ingress definition can send traffic to the service, but assets (and hence the dashboard itself) won't load.
The re-factoring required to make such a setup work is not as bad as you may think. Have a look at 1 and 2 below for a quick overview.

[1] https://create-react-app.dev/docs/deployment/#building-for-relative-paths
[2] https://skryvets.com/blog/2018/09/20/an-elegant-solution-of-deploying-react-app-into-a-subdirectory/

@undera
Copy link
Collaborator

undera commented Feb 3, 2025

@r-maerz If you are proficient in ReactJS, it would be great if you bring the PR that would improve the code with this capability

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants