# Copyright 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
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: tekton-hub-info
  labels:
    app.kubernetes.io/instance: default
    app.kubernetes.io/part-of: tekton-hub
rules:
  # All system:authenticated users need to have access
  # to the hub-info ConfigMap even if they don't
  # have access to other resources present in the
  # installed namespace
  - apiGroups: [""]
    resources: ["configmaps"]
    resourceNames: ["hub-info"]
    verbs: ["get"]

---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: tekton-hub-info
  labels:
    app.kubernetes.io/instance: default
    app.kubernetes.io/part-of: tekton-hub
subjects:
  # Giving all system:authenticated users the access to the
  # ConfigMap which contains version information
  - kind: Group
    name: system:authenticated
    apiGroup: rbac.authorization.k8s.io
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: tekton-hub-info
