Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove the deprecated single namespace mode #3299

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions cmd/dashboard/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2023 The Tekton Authors
Copyright 2019-2024 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -35,7 +35,6 @@ var (
portNumber = flag.Int("port", 8080, "Dashboard port number")
readOnly = flag.Bool("read-only", true, "Enable or disable read-only mode")
logoutURL = flag.String("logout-url", "", "If set, enables logout on the frontend and binds the logout button to this url")
tenantNamespace = flag.String("namespace", "", "Deprecated: use --namespaces instead. If set, limits the scope of resources displayed to this namespace only")
tenantNamespaces = flag.String("namespaces", "", "If set, limits the scope of resources displayed to this comma-separated list of namespaces only")
logLevel = flag.String("log-level", "info", "Minimum log level output by the logger")
logFormat = flag.String("log-format", "json", "Format for log output (json or console)")
Expand Down Expand Up @@ -80,10 +79,6 @@ func main() {
logging.Log.Errorf("Error building k8s clientset: %s", err.Error())
}

if *tenantNamespace != "" {
logging.Log.Warn("DEPRECATION NOTICE: --namespace arg is deprecated, use --namespaces instead")
}

// use FieldsFunc instead of Split as Split returns an array containing an empty string
// instead of the desired empty array when there is no delimeter (i.e. empty string or single namespace)
splitByComma := func(c rune) bool {
Expand All @@ -95,7 +90,6 @@ func main() {
InstallNamespace: installNamespace,
PipelinesNamespace: *pipelinesNamespace,
TriggersNamespace: *triggersNamespace,
TenantNamespace: *tenantNamespace,
TenantNamespaces: tenants,
ReadOnly: *readOnly,
LogoutURL: *logoutURL,
Expand Down
3 changes: 1 addition & 2 deletions docs/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,13 @@ These options are documented below:
| `--port` | Dashboard port number | `int` | `8080` |
| `--read-only` | Enable or disable read-only mode | `bool` | `true` |
| `--logout-url` | If set, enables logout on the frontend and binds the logout button to this url | `string` | `""` |
| `--namespace` | Deprecated: use --namespaces instead. If set, limits the scope of resources displayed to this namespace only | `string` | `""` |
| `--namespaces` | If set, limits the scope of resources displayed to this comma-separated list of namespaces only | `string` | `""` |
| `--log-level` | Minimum log level output by the logger | `string` | `"info"` |
| `--log-format` | Format for log output (json or console) | `string` | `"json"` |

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

**Important note:** using `--namespace` or `--namespaces` provides this list of namespaces to the frontend, but does not limit actions that can be performed to just these namespaces. It's important when these flags are used that RBAC rules are setup accordingly.
**Important note:** using `--namespaces` provides this list of namespaces to the frontend, but does not limit actions that can be performed to just these namespaces. It's important when this flag is used that RBAC rules are setup accordingly.

## Build and deploy with the installer script

Expand Down
11 changes: 5 additions & 6 deletions docs/dev/installer.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ Accepted options:
[--read-write] Will build manifests for a read/write deployment
[--stream-logs false] Will disable log streaming and use polling instead
[--tag <tag>] Tag used for the image produced by ko
[--tenant-namespace <namespace>] [DEPRECATED: use tenant-namespaces instead] Will limit the visibility to the specified namespace only
[--tenant-namespaces <namespaces>] Will limit the visibility to the specified comma-separated namespaces only
[--triggers-namespace <namespace>] Override the namespace where Tekton Triggers is installed (defaults to Dashboard install namespace)
[--version <version>] Will download manifests for specified version or build everything using kustomize/ko
Expand Down Expand Up @@ -131,16 +130,16 @@ To install the Dashboard add the `--read-write` option when calling the `install
./scripts/installer install --read-write
```

### Installing for single namespace visibility
### Installing for limited namespace visibility

Single namespace visibility restricts the Tekton Dashboard actions scope and resources that can be seen to a single namespace in the cluster.
Limited namespace visibility restricts the Tekton Dashboard actions scope and resources that can be seen to a subset of namespaces in the cluster.

To install for single namespace visibility run the following command:
To install for limited namespace visibility run the following command:

```bash
TENANT_NAMESPACE=my-namespace
TENANT_NAMESPACES=my-namespace1,my-namespace2

./scripts/installer install --tenant-namespace $TENANT_NAMESPACE
./scripts/installer install --tenant-namespaces $TENANT_NAMESPACES
```

### Install ingress
Expand Down
6 changes: 1 addition & 5 deletions overlays/patches/installer/deployment-patch.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2023 The Tekton Authors
# Copyright 2020-2024 The Tekton Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,10 +37,6 @@
path: /spec/template/spec/containers/0/args/-
value:
--log-format=--log-format
- op: add
path: /spec/template/spec/containers/0/args/-
value:
--namespace=--tenant-namespace
- op: add
path: /spec/template/spec/containers/0/args/-
value:
Expand Down
4 changes: 1 addition & 3 deletions pkg/endpoints/cluster.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2023 The Tekton Authors
Copyright 2019-2024 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -30,7 +30,6 @@ type Properties struct {
PipelineVersion string `json:"pipelinesVersion"`
ReadOnly bool `json:"isReadOnly"`
StreamLogs bool `json:"streamLogs"`
TenantNamespace string `json:"tenantNamespace,omitempty"`
TenantNamespaces []string `json:"tenantNamespaces,omitEmpty"`
TriggersNamespace string `json:"triggersNamespace,omitempty"`
TriggersVersion string `json:"triggersVersion,omitempty"`
Expand All @@ -52,7 +51,6 @@ func (r Resource) GetProperties(response http.ResponseWriter, _ *http.Request) {
PipelineVersion: pipelineVersion,
ReadOnly: r.Options.ReadOnly,
LogoutURL: r.Options.LogoutURL,
TenantNamespace: r.Options.TenantNamespace,
TenantNamespaces: r.Options.TenantNamespaces,
StreamLogs: r.Options.StreamLogs,
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/endpoints/types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2023 The Tekton Authors
Copyright 2019-2024 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -23,7 +23,6 @@ type Options struct {
InstallNamespace string
PipelinesNamespace string
TriggersNamespace string
TenantNamespace string
TenantNamespaces []string
ReadOnly bool
LogoutURL string
Expand Down
9 changes: 1 addition & 8 deletions scripts/installer
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2021-2023 The Tekton Authors
# Copyright 2021-2024 The Tekton Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down Expand Up @@ -172,7 +172,6 @@ patch() {
replace "--log-format=--log-format" "--log-format=$LOG_FORMAT"
replace "--logout-url=--logout-url" "--logout-url=$LOGOUT_URL"
replace "--read-only=--read-only" "--read-only=$READONLY"
replace "--namespace=--tenant-namespace" "--namespace="
replace "--namespaces=--tenant-namespaces" "--namespaces=$TENANT_NAMESPACES"
replace "--stream-logs=--stream-logs" "--stream-logs=$STREAM_LOGS"
replace "--external-logs=--external-logs" "--external-logs=$EXTERNAL_LOGS"
Expand Down Expand Up @@ -406,7 +405,6 @@ help () {
echo -e "\t[--read-write]\t\t\t\tWill build manifests for a read/write deployment"
echo -e "\t[--stream-logs false]\t\t\tWill disable log streaming and use polling instead"
echo -e "\t[--tag <tag>]\t\t\t\tTag used for the image produced by ko"
echo -e "\t[--tenant-namespace <namespace>]\t[DEPRECATED: use tenant-namespaces instead] Will limit the visibility to the specified namespace only"
echo -e "\t[--tenant-namespaces <namespaces>]\tWill limit the visibility to the specified comma-separated namespaces only"
echo -e "\t[--triggers-namespace <namespace>]\tOverride the namespace where Tekton Triggers is installed (defaults to Dashboard install namespace)"
echo -e "\t[--version <version>]\t\t\tWill download manifests for specified version or build everything using kustomize/ko"
Expand Down Expand Up @@ -505,11 +503,6 @@ while [[ $# -gt 0 ]]; do
shift
OVERRIDE_TRIGGERS_NAMESPACE="${1}"
;;
'--tenant-namespace')
warning "--tenant-namespace is deprecated, use --tenant-namespaces instead"
shift
TENANT_NAMESPACES="${1}"
;;
'--tenant-namespaces')
shift
TENANT_NAMESPACES="${1}"
Expand Down
10 changes: 2 additions & 8 deletions src/api/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2023 The Tekton Authors
Copyright 2019-2024 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -338,11 +338,5 @@ export function useLogoutURL() {

export function useTenantNamespaces() {
const { data } = useProperties();
if (data.tenantNamespace) {
return [data.tenantNamespace];
}
if (data.tenantNamespaces) {
return data.tenantNamespaces;
}
return [];
return data.tenantNamespaces || [];
}
4 changes: 2 additions & 2 deletions src/api/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2023 The Tekton Authors
Copyright 2019-2024 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -516,7 +516,7 @@ it('other hooks that depend on useProperties', async () => {
isReadOnly,
logoutURL,
streamLogs,
tenantNamespace,
tenantNamespaces: [tenantNamespace],
triggersNamespace,
triggersVersion
};
Expand Down
Loading