Hi, I want to mount the lakefs frontend under an e...
# help
u
Hi, I want to mount the lakefs frontend under an existing domain, such as https://test.domain.com/lakefs. This way, all requests to the backend API will also include /lakefs. I need to change the original /api/v1 to /lakefs/api/v1. I see that the current helm chart supports configuring
ingress.hosts.paths
. Is it possible to directly modify this configuration? However, I see the frontend JS has a hardcoded `export const API_ENDPOINT = '/api/v1'`; https://github.com/treeverse/lakeFS/blob/master/webui/src/lib/api/index.js#L1
b
The chart values should enable you to control the ingress controller. so for example in case nginx; using rewrite-target you can override the path to your location and direct the request to /api/v1.
Passing annotations:
<http://kubernetes.io/ingress.class|kubernetes.io/ingress.class>: "nginx"
<http://nginx.ingress.kubernetes.io/rewrite-target|nginx.ingress.kubernetes.io/rewrite-target>: /api/v1/$2
and settings 'pathsOverrides' to
/lakefs/api/v1
u
@Barak Amar Thanks for your answer! I'm still a little confused: 1. Does
$2
here capture all path parameters? So the corresponding configuration would be:
Copy code
ingress:
  enabled: true
  annotations:
    <http://kubernetes.io/ingress.class|kubernetes.io/ingress.class>: nginx
    <http://nginx.ingress.kubernetes.io/rewrite-target|nginx.ingress.kubernetes.io/rewrite-target>: /api/v1/$2
  hosts:
    - host: <http://existing-host.testdomain.com|existing-host.testdomain.com>
      paths: ["/lakefs(/|$)(.*)"]
      pathsOverrides:
        - path: /lakefs/api/v1
2. The lakefs code hard-codes
API_ENDPOINT = '/api/v1'
. Do I need to modify the js code after changing this?
b
I was thinking on using
/lakefs/(/api/v1/.*)
- i can test it later today, it should capture the group in the request what will take the request of the request part and rewrite the request - which will make all incoming request drop the
/lakefs/
. Note that using
pathsOverrides
in the charts values should have expended to a
pathType: Prefix
based on the chart https://github.com/treeverse/charts/blob/b721e541f6837cd48ff3158a8735e6ef504399cb/charts/lakefs/templates/ingress.yaml#L58C20-L58C34
gratitude thank you 1
u
@Barak Amar Sorry to bother you again, is this way feasible?
b
hi @薛宇豪, didn't had a chance to test the above yet on my local env; but let me know what you are getting with
helm template
output if it doesn't work for you (using nginx)
u
@Barak Amar Sorry for the late reply. I recently had a chance to try it out and found that after making the changes, the frontend no longer displays properly. There are errors on the JavaScript side, and it appears the request forwarding failed.
b
Hi @薛宇豪 I half right, you can have ingress point to lakefs served until a different route. but the issue is that the current web ui app uses abs path to load assets and call the lakefs api. so in order it to work it will require several fixes to support such setup. Share here the local kind nginx ingress I used, just for future reference. Wasn't able to configure the path type using the chart, so the following is based on the helm installed I had 'my-lakefs'.
Copy code
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: Ingress
metadata:
  name: my-lakefs
  labels:
    app: lakefs
    <http://app.kubernetes.io/name|app.kubernetes.io/name>: lakefs
  annotations:
    <http://nginx.ingress.kubernetes.io/rewrite-target|nginx.ingress.kubernetes.io/rewrite-target>: /$2
    <http://nginx.ingress.kubernetes.io/use-regex|nginx.ingress.kubernetes.io/use-regex>: "true"
spec:
  rules:
    - host: "localhost"
      http:
        paths:
          - path: /lakefs(/|$)(.*)
            pathType: ImplementationSpecific
            backend:
              service:
                name: my-lakefs
                port:
                  number: 80
In order to serve the UI resources I had to build the webui with /lakefs as base. Update the client to call he API using the web app's new base. I assume there are more changes that needs to be make to have a complete solution. Suggest to have lakefs configured as a sub-domain and not sub-path and/or open an issue and maybe some community member will pick it up.
gratitude thank you 1