Skip to content

Commit

Permalink
Add flag for logout url
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-edouard.breteche authored and tekton-robot committed May 22, 2020
1 parent a91b799 commit da51e62
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ These options are documented below:
| `--port` | Dashboard port number | `int` | `8080` |
| `--read-only` | Enable or disable read only mode | `bool` | `false` |
| `--web-dir` | Dashboard web resources directory | `string` | `""` |
| `--logout-url` | If set, enables logout on the frontend and binds the logout button to this url | `string` | `""` |

Run `dashboard --help` to show the supported command line arguments and their default value directly from the `dashboard` binary.

### Optionally set up the Ingress endpoint
Expand Down
2 changes: 2 additions & 0 deletions cmd/dashboard/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var (
portNumber = flag.Int("port", 8080, "Dashboard port number")
readOnly = flag.Bool("read-only", false, "Enable or disable read only mode")
webDir = flag.String("web-dir", "", "Dashboard web resources dir")
logoutUrl = flag.String("logout-url", "", "If set, enables logout on the frontend and binds the logout button to this url")
csrfSecureCookie = flag.Bool("csrf-secure-cookie", true, "Enable or disable Secure attribute on the CSRF cookie")
)

Expand Down Expand Up @@ -115,6 +116,7 @@ func main() {
TriggersNamespace: *triggersNamespace,
ReadOnly: *readOnly,
WebDir: *webDir,
LogoutURL: *logoutUrl,
}

resource := endpoints.Resource{
Expand Down
7 changes: 7 additions & 0 deletions overlays/dev-openshift-imagestream/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ patchesJson6902:
name: tekton-dashboard
namespace: tekton-pipelines
path: ../openshift-patches/oauth-proxy-in-deployment.yaml
- target:
group: apps
version: v1
kind: Deployment
name: tekton-dashboard
namespace: tekton-pipelines
path: ../logout/deployment-patch.yaml
images:
- name: dashboardImage
newName: tekton-pipelines/tekton-dashboard
Expand Down
7 changes: 7 additions & 0 deletions overlays/dev-openshift-locked-down/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ patchesJson6902:
name: tekton-dashboard
namespace: tekton-pipelines
path: ../openshift-patches/oauth-proxy-in-deployment.yaml
- target:
group: apps
version: v1
kind: Deployment
name: tekton-dashboard
namespace: tekton-pipelines
path: ../logout/deployment-patch.yaml
images:
- name: dashboardImage
newName: github.com/tektoncd/dashboard/cmd/dashboard
Expand Down
7 changes: 7 additions & 0 deletions overlays/dev-openshift/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ patchesJson6902:
name: tekton-dashboard
namespace: tekton-pipelines
path: ../openshift-patches/oauth-proxy-in-deployment.yaml
- target:
group: apps
version: v1
kind: Deployment
name: tekton-dashboard
namespace: tekton-pipelines
path: ../logout/deployment-patch.yaml
images:
- name: dashboardImage
newName: github.com/tektoncd/dashboard/cmd/dashboard
Expand Down
7 changes: 7 additions & 0 deletions overlays/latest-openshift-locked-down/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ patchesJson6902:
name: tekton-dashboard
namespace: tekton-pipelines
path: ../openshift-patches/oauth-proxy-in-deployment.yaml
- target:
group: apps
version: v1
kind: Deployment
name: tekton-dashboard
namespace: tekton-pipelines
path: ../logout/deployment-patch.yaml
images:
- name: dashboardImage
newName: gcr.io/tekton-nightly/dashboard
Expand Down
7 changes: 7 additions & 0 deletions overlays/latest-openshift/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ patchesJson6902:
name: tekton-dashboard
namespace: tekton-pipelines
path: ../openshift-patches/oauth-proxy-in-deployment.yaml
- target:
group: apps
version: v1
kind: Deployment
name: tekton-dashboard
namespace: tekton-pipelines
path: ../logout/deployment-patch.yaml
images:
- name: dashboardImage
newName: gcr.io/tekton-nightly/dashboard
Expand Down
5 changes: 5 additions & 0 deletions overlays/logout/deployment-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- op: add
path: /spec/template/spec/containers/0/args/-
value:
--logout-url=/oauth/sign_out
6 changes: 1 addition & 5 deletions pkg/endpoints/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,7 @@ func (r Resource) GetProperties(request *restful.Request, response *restful.Resp
PipelineVersion: pipelineVersion,
IsOpenShift: isOpenShift,
ReadOnly: r.Options.ReadOnly,
}

// If running on OpenShift, set the logout url
if isOpenShift {
properties.LogoutURL = "/oauth/sign_out"
LogoutURL: r.Options.LogoutURL,
}

isTriggersInstalled := isTriggersInstalled(r, triggersNamespace)
Expand Down
1 change: 1 addition & 0 deletions pkg/endpoints/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type Options struct {
TriggersNamespace string
ReadOnly bool
WebDir string
LogoutURL string
}

// GetPipelinesNamespace returns the PipelinesNamespace property if set
Expand Down

0 comments on commit da51e62

Please sign in to comment.