Skip to content

Commit a563c50

Browse files
committed
create and use service acount with edit role
1 parent 67b1a3b commit a563c50

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

nexus/chart/templates/nexus-snapshot-cronjob.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ spec:
1212
ttlSecondsAfterFinished: {{ .Values.global.nexusSnapshotTTL }}
1313
template:
1414
spec:
15-
serviceAccountName: jenkins
15+
serviceAccountName: ods-edit
1616
containers:
1717
- name: snapshot-creator
1818
image: image-registry.openshift-image-registry.svc:5000/openshift/ose-cli:latest

ods-setup/setup-ods-project.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ fi
5555
# Allow system:authenticated group to view resources in central namespace
5656
oc adm policy add-role-to-group view system:authenticated -n ${NAMESPACE}
5757

58+
# Create ods-edit service account and grant edit permissions
59+
if ! oc get serviceaccount ods-edit -n ${NAMESPACE} > /dev/null 2>&1; then
60+
echo "Creating service account 'ods-edit' ..."
61+
oc create serviceaccount ods-edit -n ${NAMESPACE}
62+
oc adm policy add-role-to-user edit system:serviceaccount:${NAMESPACE}:ods-edit -n ${NAMESPACE}
63+
else
64+
echo "Service account 'ods-edit' already exists"
65+
fi
66+
5867
# Allow system:authenticated group to pull images from central namespace
5968
if ! oc adm policy add-cluster-role-to-group system:image-puller system:authenticated -n ${NAMESPACE}; then
6069
echo "You might not have enough rights to assign 'system:image-puller' to 'system:authenticated'."

0 commit comments

Comments
 (0)