Skip to content

Commit f7ab669

Browse files
AlanGreenetekton-robot
authored andcommitted
Improve release process and structure of release manifests
Reduce unnecessary differences between the read-only and read-write manifests, both to reduce maintenance overhead and to avoid user confusion. There have been a few instances where users thought the read-only mode was broken as they switched the `read-only` flag in the deployment args but didn't replace the associated roles with the appropriate versions. With this update we now include all roles in the manifest, and create bindings for the relevant ones with updated naming to make it clear which grant view access and which grant edit rather than keeping the same name and swapping out the rules. Update install script to accept input from a previously generated installer manifest. This removes the need to run the `ko` build 4 times (2x installer modes + 2x normal release modes) as part of our releases. Now it builds once, and uses the resulting manifest as input to the normal releases so they can augment it with the appropriate RBAC resources depending on mode (read-only vs. read-write). This also means there's no need for a dedicated read-write installer manifest. Update the release pipeline's publish task to take advantage of this new approach, and eliminate other unnecessary config. Use the aggregate ClusterRoles provided by Tekton Pipelines and Triggers instead of defining them ourselves, ensuring we stay in sync with the versions deployed on the cluster. The one exception to this is for `ClusterTask` resources as they're not included in the aggregate roles provided by Tekton Pipelines. We will remove support for these resources in a future release and remove the corresponding rule from the Dashboard backend role. With this new approach to building the manifests, we no longer need separate overlays or additional patches to modify the resources to match the desired mode. Instead, the installer augments the base installer manifest with the appropriate ClusterRoleBindings or RoleBindings to grant the read-only or read-write permissions as desired, and replaces other config in-place. Move the remaining resources into the `config` folder for consistency with other Tekton projects. All of this should be mostly transparent to consumers. They will still use the `installer` or `release-installer` scripts as before. There is some cleanup that should be performed on clusters if upgrading from a previous Dashboard release, by removing the following resources after upgrade: - `clusterrole/tekton-dashboard-backend` - `clusterrole/tekton-dashboard-tenant` - `clusterrolebinding/tekton-dashboard-backend` - `clusterrolebinding/tekton-dashboard-tenant` and if the Dashboard was installed with limited namespace visibility (i.e. using the `--tenant-namespaces` installer flag, or directly via the `--namespaces` deployment arg): - `rolebinding/tekton-dashboard-tenant` in each of the tenant namespaces
1 parent 4bbda10 commit f7ab669

26 files changed

+272
-424
lines changed

overlays/installer/read-write/100-namespace.yaml renamed to config/100-namespace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023 The Tekton Authors
1+
# Copyright 2019-2024 The Tekton Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2021 The Tekton Authors
1+
# Copyright 2019-2024 The Tekton Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,20 +12,29 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
kind: ClusterRole
1516
apiVersion: rbac.authorization.k8s.io/v1
16-
kind: Role
1717
metadata:
18-
name: tekton-dashboard-info
19-
namespace: tekton-dashboard
18+
name: tekton-dashboard-backend-edit
2019
labels:
20+
app.kubernetes.io/component: dashboard
2121
app.kubernetes.io/instance: default
2222
app.kubernetes.io/part-of: tekton-dashboard
2323
rules:
24-
# All system:authenticated users needs to have access
25-
# of the dashboard-info ConfigMap even if they don't
26-
# have access to the other resources present in the
27-
# installed namespace.
28-
- apiGroups: [""]
29-
resources: ["configmaps"]
30-
resourceNames: ["dashboard-info"]
31-
verbs: ["get"]
24+
- apiGroups:
25+
- ''
26+
resources:
27+
- serviceaccounts
28+
verbs:
29+
- get
30+
- list
31+
- watch
32+
- apiGroups:
33+
- dashboard.tekton.dev
34+
resources:
35+
- extensions
36+
verbs:
37+
- create
38+
- update
39+
- delete
40+
- patch

base/200-clusterrole-backend.yaml renamed to config/200-clusterrole-backend-view.yaml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019-2022 The Tekton Authors
1+
# Copyright 2019-2024 The Tekton Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,11 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
---
1615
kind: ClusterRole
1716
apiVersion: rbac.authorization.k8s.io/v1
1817
metadata:
19-
name: tekton-dashboard-backend
18+
name: tekton-dashboard-backend-view
2019
labels:
2120
app.kubernetes.io/component: dashboard
2221
app.kubernetes.io/instance: default
@@ -35,8 +34,6 @@ rules:
3534
- securitycontextconstraints
3635
verbs:
3736
- use
38-
# clustertasks and clustertriggerbindings are cluster level resources,
39-
# it doesn't make sense to put them in the tenant ClusterRole
4037
- apiGroups:
4138
- tekton.dev
4239
resources:
@@ -45,12 +42,3 @@ rules:
4542
- get
4643
- list
4744
- watch
48-
- apiGroups:
49-
- triggers.tekton.dev
50-
resources:
51-
- clusterinterceptors
52-
- clustertriggerbindings
53-
verbs:
54-
- get
55-
- list
56-
- watch

base/200-clusterrole-tenant.yaml renamed to config/200-clusterrole-tenant-view.yaml

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
---
1615
kind: ClusterRole
1716
apiVersion: rbac.authorization.k8s.io/v1
1817
metadata:
19-
name: tekton-dashboard-tenant
18+
name: tekton-dashboard-tenant-view
2019
labels:
2120
app.kubernetes.io/component: dashboard
2221
app.kubernetes.io/instance: default
@@ -41,28 +40,3 @@ rules:
4140
- get
4241
- list
4342
- watch
44-
- apiGroups:
45-
- tekton.dev
46-
resources:
47-
- stepactions
48-
- tasks
49-
- taskruns
50-
- pipelines
51-
- pipelineruns
52-
- customruns
53-
verbs:
54-
- get
55-
- list
56-
- watch
57-
- apiGroups:
58-
- triggers.tekton.dev
59-
resources:
60-
- eventlisteners
61-
- interceptors
62-
- triggerbindings
63-
- triggers
64-
- triggertemplates
65-
verbs:
66-
- get
67-
- list
68-
- watch

base/201-clusterrolebinding-backend.yaml renamed to config/201-clusterrolebinding-backend.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019-2022 The Tekton Authors
1+
# Copyright 2019-2024 The Tekton Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,11 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
---
1615
apiVersion: rbac.authorization.k8s.io/v1
1716
kind: ClusterRoleBinding
1817
metadata:
19-
name: tekton-dashboard-backend
18+
name: tekton-dashboard-backend-view
2019
labels:
2120
app.kubernetes.io/component: dashboard
2221
app.kubernetes.io/instance: default
@@ -29,4 +28,4 @@ subjects:
2928
roleRef:
3029
apiGroup: rbac.authorization.k8s.io
3130
kind: ClusterRole
32-
name: tekton-dashboard-backend
31+
name: tekton-dashboard-backend-view

base/202-extension-crd.yaml renamed to config/202-extension-crd.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019-2021 The Tekton Authors
1+
# Copyright 2019-2024 The Tekton Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
---
1615
apiVersion: apiextensions.k8s.io/v1
1716
kind: CustomResourceDefinition
1817
metadata:

base/203-serviceaccount.yaml renamed to config/203-serviceaccount.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019-2023 The Tekton Authors
1+
# Copyright 2019-2024 The Tekton Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
---
1615
apiVersion: v1
1716
kind: ServiceAccount
1817
metadata:

config/300-config-info.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright 2021-2024 The Tekton Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
kind: ConfigMap
17+
metadata:
18+
name: dashboard-info
19+
namespace: tekton-dashboard
20+
labels:
21+
app.kubernetes.io/instance: default
22+
app.kubernetes.io/part-of: tekton-dashboard
23+
data:
24+
# Contains dashboard version which can be queried by external tools such as
25+
# the Tekton CLI. Elevated permissions are given to this ConfigMap such that
26+
# even if we don't have access to other resources in the namespace we still
27+
# have access to this ConfigMap.
28+
version: "devel"
29+
---
30+
apiVersion: rbac.authorization.k8s.io/v1
31+
kind: Role
32+
metadata:
33+
name: tekton-dashboard-info
34+
namespace: tekton-dashboard
35+
labels:
36+
app.kubernetes.io/instance: default
37+
app.kubernetes.io/part-of: tekton-dashboard
38+
rules:
39+
- apiGroups: [""]
40+
resources: ["configmaps"]
41+
resourceNames: ["dashboard-info"]
42+
verbs: ["get"]
43+
---
44+
apiVersion: rbac.authorization.k8s.io/v1
45+
kind: RoleBinding
46+
metadata:
47+
name: tekton-dashboard-info
48+
namespace: tekton-dashboard
49+
labels:
50+
app.kubernetes.io/instance: default
51+
app.kubernetes.io/part-of: tekton-dashboard
52+
subjects:
53+
# Grant all system:authenticated users access to the dashboard-info ConfigMap
54+
# even if they don't have access to other resources present in the namespace.
55+
- kind: Group
56+
name: system:authenticated
57+
apiGroup: rbac.authorization.k8s.io
58+
roleRef:
59+
apiGroup: rbac.authorization.k8s.io
60+
kind: Role
61+
name: tekton-dashboard-info

base/300-deployment.yaml renamed to config/300-deployment.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019-2023 The Tekton Authors
1+
# Copyright 2019-2024 The Tekton Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
---
1615
apiVersion: apps/v1
1716
kind: Deployment
1817
metadata:
@@ -64,7 +63,17 @@ spec:
6463
path: /readiness
6564
port: 9097
6665
args:
66+
- --default-namespace=--default-namespace
67+
- --external-logs=--external-logs
68+
- --log-format=--log-format
69+
- --log-level=--log-level
70+
- --logout-url=--logout-url
71+
- --namespaces=--tenant-namespaces
72+
- --pipelines-namespace=--pipelines-namespace
6773
- --port=9097
74+
- --read-only=--read-only
75+
- --stream-logs=--stream-logs
76+
- --triggers-namespace=--triggers-namespace
6877
env:
6978
- name: INSTALLED_NAMESPACE
7079
valueFrom:

base/300-service.yaml renamed to config/300-service.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019-2023 The Tekton Authors
1+
# Copyright 2019-2024 The Tekton Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
---
1615
kind: Service
1716
apiVersion: v1
1817
metadata:
Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2021 The Tekton Authors
1+
# Copyright 2024 The Tekton Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -13,20 +13,25 @@
1313
# limitations under the License.
1414

1515
apiVersion: rbac.authorization.k8s.io/v1
16-
kind: RoleBinding
16+
kind: ClusterRole
1717
metadata:
18-
name: tekton-dashboard-info
19-
namespace: tekton-dashboard
18+
name: tekton-dashboard-aggregate-edit
2019
labels:
2120
app.kubernetes.io/instance: default
2221
app.kubernetes.io/part-of: tekton-dashboard
23-
subjects:
24-
# Giving all system:authenticated users the access of the
25-
# ConfigMap which contains version information.
26-
- kind: Group
27-
name: system:authenticated
28-
apiGroup: rbac.authorization.k8s.io
29-
roleRef:
30-
apiGroup: rbac.authorization.k8s.io
31-
kind: Role
32-
name: tekton-dashboard-info
22+
rbac.authorization.k8s.io/aggregate-to-edit: "true"
23+
rbac.authorization.k8s.io/aggregate-to-admin: "true"
24+
rules:
25+
- apiGroups:
26+
- dashboard.tekton.dev
27+
resources:
28+
- extensions
29+
verbs:
30+
- create
31+
- delete
32+
- deletecollection
33+
- get
34+
- list
35+
- patch
36+
- update
37+
- watch
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2021 The Tekton Authors
1+
# Copyright 2024 The Tekton Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,18 +12,20 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
apiVersion: v1
16-
kind: ConfigMap
15+
apiVersion: rbac.authorization.k8s.io/v1
16+
kind: ClusterRole
1717
metadata:
18-
name: dashboard-info
19-
namespace: tekton-dashboard
18+
name: tekton-dashboard-aggregate-view
2019
labels:
2120
app.kubernetes.io/instance: default
2221
app.kubernetes.io/part-of: tekton-dashboard
23-
data:
24-
# Contains dashboard version which can be queried by external
25-
# tools such as CLI. Elevated permissions are already given to
26-
# this ConfigMap such that even if we don't have access to
27-
# other resources in the namespace we still can have access to
28-
# this ConfigMap.
29-
version: "devel"
22+
rbac.authorization.k8s.io/aggregate-to-view: "true"
23+
rules:
24+
- apiGroups:
25+
- dashboard.tekton.dev
26+
resources:
27+
- extensions
28+
verbs:
29+
- get
30+
- list
31+
- watch

0 commit comments

Comments
 (0)