Argo: BASE_HREF is not working

Created on 22 May 2020  ยท  14Comments  ยท  Source: argoproj/argo

Cant Access argo UI if I change the BASE_HREF to something other than /

I want it to be accessible at xxx.com/argo

To reproduce it you can just change the env variable BASE_HREF to something other than /. I have tried these - argo, /argo , /argo/ . None of these work.

Getting this on the console of my browser -

 Uncaught SyntaxError: Unexpected token '<'

THis is the image we are using: argoproj/argocli:v2.7.4

- Kubernetes version : 1.16


Message from the maintainers:

If you are impacted by this bug please add a ๐Ÿ‘ reaction to this issue! We often sort issues this way to know what to prioritize.

enhancement more-information-needed workaround

Most helpful comment

@alexec I got it working with this setup

  1. BASE_HREF set to subpath with trailing slash (trailing slash is an important one because of how <base href> tag works, I guess we can just update docs here https://github.com/argoproj/argo/blob/676868f31da1bce361e89bebfa1eea81471784ac/docs/argo-server.md#base-href from /argo to /argo/ - that's what got me confused at first), or maybe just add a check to always append a slash if it's not present.
  2. No updates to argo Service, just put it behind Ingress with a similar config:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    external-dns.alpha.kubernetes.io/alias: "true"
    external-dns.alpha.kubernetes.io/target: target.example.com
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/backend-protocol: HTTP
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: server.example.com
    http:
      paths:
      - backend:
          serviceName: argo-server
          servicePort: 2746
        path: /argo/(.*)
      - backend:
          serviceName: argo-server
          servicePort: 2746
        path: /argo
  tls:
  - hosts:
    - server.example.com
    secretName: some-cert-manager-seceret

All 14 comments

๐Ÿ‘

Hello,
I am also facing a similar issue

BASE_HREF setup

- name: BASE_HREF
   value: /argo/

Ingress setup

rules:
  - host: {{domain-name}}
    http:
      paths:
      - backend:
          serviceName: argo-server
          servicePort: http
        path: /argo(/|$)(.*)

I can see workflows in https://{{domain-name}}/argo/workflows

But when I click on a workflow, I see a blank screen

Screenshot 2020-06-23 at 8 43 46 PM

Under network I can see this

image

I can see workflows in https://{{domain-name}}/argo/workflows

This screen can be blank if the workflow in invalid. Check under the summary tab (one of the the small buttons top right)

This screen can be blank if the workflow in invalid. Check under the summary tab (one of the the small buttons top right)

@alexec
When i submit a workflow from the ui, i can see the steps
When i go back to main workflows/ page and then click on the workflow, I get a blank screen

On clicking resubmit from the blank screen, I can see all the steps
image

going back to main page
image

Now click on workflow again. You can see a blank page
image

Also from cli, I can see workflow is successful

argo get artifact-passing-x8zhr
Name: artifact-passing-x8zhr
Namespace: argo
ServiceAccount: argo-workflow-service-account
Status: Succeeded
Created: Tue Jun 23 21:45:24 +0530 (8 minutes ago)
Started: Tue Jun 23 21:45:24 +0530 (8 minutes ago)
Finished: Tue Jun 23 21:45:35 +0530 (8 minutes ago)
Duration: 11 seconds

STEP TEMPLATE PODNAME DURATION MESSAGE
โœ” artifact-passing-x8zhr artifact-example
โ”œ---โœ” generate-artifact whalesay artifact-passing-x8zhr-982905896 4s
โ””---โœ” consume-artifact print-message artifact-passing-x8zhr-2574371560 5s

@alexec In ideal case it should load the UI on /argo we shouldn't put extra routes.

You can get ingress working as follows:

  1. Update service/argo-server spec with type: LoadBalancer
  2. Add BASH_HREF as environment variable to deployment/argo-server .
  3. Create a ingress, with the annotation ingress.kubernetes.io/rewrite-target: /.
diff --git a/manifests/base/argo-server/argo-server-deployment.yaml b/manifests/base/argo-server/argo-server-deployment.yaml
index dbafbfd8..3ad77285 100644
--- a/manifests/base/argo-server/argo-server-deployment.yaml
+++ b/manifests/base/argo-server/argo-server-deployment.yaml
@@ -16,6 +16,9 @@ spec:
         - name: argo-server
           image: argoproj/argocli:latest
           args: [server]
+          env:
+            - name: BASE_HREF
+              value: /argo/
           ports:
             - name: web
               containerPort: 2746
diff --git a/manifests/base/argo-server/argo-server-ingress.yaml b/manifests/base/argo-server/argo-server-ingress.yaml
index e69de29b..f4599000 100644
--- a/manifests/base/argo-server/argo-server-ingress.yaml
+++ b/manifests/base/argo-server/argo-server-ingress.yaml
@@ -0,0 +1,16 @@
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: argo-server
+  annotations:
+    ingress.kubernetes.io/rewrite-target: /
+spec:
+  rules:
+    - http:
+        paths:
+          - backend:
+              serviceName: argo-server
+              servicePort: 2746
+            path: /argo
+
diff --git a/manifests/base/argo-server/argo-server-service.yaml b/manifests/base/argo-server/argo-server-service.yaml
index 0c6e58d3..5bdc67ac 100644
--- a/manifests/base/argo-server/argo-server-service.yaml
+++ b/manifests/base/argo-server/argo-server-service.yaml
@@ -9,3 +9,4 @@ spec:
     - name: web
       port: 2746
       targetPort: 2746
+  type: LoadBalancer

While needing this in not uncommon for ingresses, it's not also straight forward.

@kevinsimons-wf, @ramanNarasimhan77, @ematpad, @gordonbondon, @damianoneill, @yuvraj9, and @yk634 - could I please ask you to review the proposed solution and state if it is adequate - or a better solution is needed?

@alexec I will test this today and comeback with my findings

@alexec I got it working with this setup

  1. BASE_HREF set to subpath with trailing slash (trailing slash is an important one because of how <base href> tag works, I guess we can just update docs here https://github.com/argoproj/argo/blob/676868f31da1bce361e89bebfa1eea81471784ac/docs/argo-server.md#base-href from /argo to /argo/ - that's what got me confused at first), or maybe just add a check to always append a slash if it's not present.
  2. No updates to argo Service, just put it behind Ingress with a similar config:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    external-dns.alpha.kubernetes.io/alias: "true"
    external-dns.alpha.kubernetes.io/target: target.example.com
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/backend-protocol: HTTP
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: server.example.com
    http:
      paths:
      - backend:
          serviceName: argo-server
          servicePort: 2746
        path: /argo/(.*)
      - backend:
          serviceName: argo-server
          servicePort: 2746
        path: /argo
  tls:
  - hosts:
    - server.example.com
    secretName: some-cert-manager-seceret

@alexec for my case the ingress does not seem to be the issue as the main workflow page renders properly.
However, I see an empty screen when i click on any specific workflow and it takes sometime to load.

Our cluster has this setup
load balancer -> cluster wide ingress controller -> gatekeeper -> application's ingress controller -> argo

When I deploy argo separately using the manifests I dont see this problem.

@ramanNarasimhan77 do you have a very large workflow? 1000+ nodes?

@ramanNarasimhan77 do you have a very large workflow? 1000+ nodes?

@alexec No, my workflow only has 3 steps. I am not sure what could cause this behavior. But if others are able to use Argo with Base_href set, then I think this ticket can be closed. The issue on my cluster is probably caused by one of the ingress controllers. I will continue my investigation.

Documentation updated with https://github.com/argoproj/argo/pull/4306/ as there is no need to change svc argo-server just ingress and Deployment change with BASE_HREF is ok

Was this page helpful?
0 / 5 - 0 ratings