From 7d6ad7549a1e23a7baceb40053be6bfa052bf1ab Mon Sep 17 00:00:00 2001 From: PuneetPunamiya Date: Mon, 4 Sep 2023 18:01:29 +0530 Subject: [PATCH] Adds a configMap named hub-info to have the Hub version Signed-off-by: Puneet Punamiya ppunamiy@redhat.com --- config/07-hub-info/hub-info.yaml | 23 +++++++++++++ config/07-hub-info/role-binding.yaml | 50 ++++++++++++++++++++++++++++ release.sh | 15 ++++++++- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 config/07-hub-info/hub-info.yaml create mode 100644 config/07-hub-info/role-binding.yaml diff --git a/config/07-hub-info/hub-info.yaml b/config/07-hub-info/hub-info.yaml new file mode 100644 index 0000000000..9374db84a9 --- /dev/null +++ b/config/07-hub-info/hub-info.yaml @@ -0,0 +1,23 @@ +# 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: v1 +kind: ConfigMap +metadata: + name: hub-info + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-hub +data: + version: devel diff --git a/config/07-hub-info/role-binding.yaml b/config/07-hub-info/role-binding.yaml new file mode 100644 index 0000000000..d911823031 --- /dev/null +++ b/config/07-hub-info/role-binding.yaml @@ -0,0 +1,50 @@ +# 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 diff --git a/release.sh b/release.sh index 37d7e9d815..b989f3d928 100755 --- a/release.sh +++ b/release.sh @@ -132,6 +132,16 @@ ui-openshift(){ echo "------------------------------------------" } +hub-info(){ + info Creating Hub-Info Release Yaml + + ko resolve -f config/07-hub-info > ${RELEASE_DIR}/hub-info.yaml || { + err 'hub-info release build failed' + return 1 + } + echo "------------------------------------------" +} + replaceImageName() { info Changing Image Name @@ -148,6 +158,8 @@ replaceImageName() { sed -i "s@image: quay.io/tekton-hub/ui@image: ${REGISTRY_BASE_URL}/ui:$RELEASE_VERSION@g" ${RELEASE_DIR}/ui-kubernetes.yaml sed -i "s@image: quay.io/tekton-hub/ui@image: ${REGISTRY_BASE_URL}/ui:$RELEASE_VERSION@g" ${RELEASE_DIR}/ui-openshift.yaml + + sed -i 's/version: .*/version: '"${RELEASE_VERSION}"'/' ${RELEASE_DIR}/hub-info.yaml } createNewPreRelease() { @@ -157,7 +169,7 @@ createNewPreRelease() { gh release create --draft --prerelease -t ${RELEASE_VERSION} ${RELEASE_VERSION} - gh release upload ${RELEASE_VERSION} db.yaml db-migration.yaml api-kubernetes.yaml api-openshift.yaml ui-kubernetes.yaml ui-openshift.yaml + gh release upload ${RELEASE_VERSION} db.yaml db-migration.yaml api-kubernetes.yaml api-openshift.yaml ui-kubernetes.yaml ui-openshift.yaml hub-info.yaml } createNewBranchAndPush() { @@ -194,6 +206,7 @@ main() { api-openshift ui-k8s ui-openshift + hub-info # Change the image name with the release version specified echo "********************************************"