Skip to content
New issue

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

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

Already on GitHub? # to your account

[OpenShift] Add rbac files to pipelines while adding release yaml #375

Merged
merged 2 commits into from
Aug 5, 2021
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: pipelines-scc-role
rules:
- apiGroups: [security.openshift.io]
resourceNames: [nonroot]
resources: [securitycontextconstraints]
verbs: [use]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: openshift-pipelines-permission
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: pipelines-scc-role
subjects:
- kind: ServiceAccount
name: tekton-pipelines-controller
namespace: openshift-pipelines
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
# Copyright 2018 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: openshift-pipelines-read
namespace: tekton-pipelines
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- pods
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: openshift-pipelines-prometheus-k8s-read-binding
namespace: tekton-pipelines
annotations:
operator.tekton.dev/preserve-rb-subject-namespace: "true"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: openshift-pipelines-read
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: openshift-monitoring
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app: controller
annotations:
networkoperator.openshift.io/ignore-errors: ""
name: openshift-pipelines-monitor
namespace: tekton-pipelines
spec:
endpoints:
- interval: 10s
port: http-metrics
jobLabel: app
namespaceSelector:
matchNames:
- openshift-pipelines
selector:
matchLabels:
app: tekton-pipelines-controller
21 changes: 11 additions & 10 deletions hack/fetch-releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,12 @@ release_yaml() {
;;
esac

# remove existing versions
comp_dir=${SCRIPT_DIR}/cmd/${TARGET}/operator/kodata/tekton-${dir}
ko_data=${SCRIPT_DIR}/cmd/${TARGET}/operator/kodata
comp_dir=${ko_data}/tekton-${dir}

# In case of openshift pipelines we have 00-prereconcile preserve it
# when removing and adding new version
if [[ ${TARGET} == "openshift" ]] && [[ ${comp} == "pipeline" ]]; then
mv ${comp_dir}/00-prereconcile /tmp/00-prereconcile/ || true
rm -rf ${comp_dir}/*
mv /tmp/00-prereconcile/ ${comp_dir}/00-prereconcile/ || true
# while adding release for interceptor ignore removing existing version
elif [[ ${releaseFileName} != "interceptors" ]] ; then
# before adding releases, remove existing version directories
# ignore while adding for interceptors
if [[ ${releaseFileName} != "interceptors" ]] ; then
rm -rf ${comp_dir}/*
fi

Expand All @@ -67,6 +62,12 @@ release_yaml() {
exit 1
fi

# Add OpenShift specific files for pipelines
if [[ ${TARGET} == "openshift" ]] && [[ ${comp} == "pipeline" ]]; then
cp -r ${ko_data}/openshift/00-prereconcile ${comp_dir}/
cp ${ko_data}/openshift/pipelines-rbac/* ${dirPath}/
fi

echo "Info: Added $comp/$releaseFileName:$version release yaml !!"
}

Expand Down
Loading