Skip to content

Commit

Permalink
add rbac rules to make oc work in a backup job
Browse files Browse the repository at this point in the history
  • Loading branch information
pb82 committed Feb 26, 2019
1 parent 00a2c6b commit 9ceaa3a
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 3 deletions.
3 changes: 2 additions & 1 deletion image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ RUN yum --enablerepo=extras install -y epel-release && \
COPY tools /opt/intly/tools
RUN chown -R 1001:root /opt/intly

RUN find /opt/intly/tools -type f -exec chmod +x {} \;
RUN find /opt/intly/tools -type f -exec chmod +x {} \; && \
mkdir /.kube && touch /.kube/config && chmod -R 777 /.kube

ENTRYPOINT ["/opt/intly/tools/entrypoint.sh"]

Expand Down
3 changes: 2 additions & 1 deletion templates/openshift/backup-cronjob-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ objects:
labels:
cronjob-name: ${NAME}
spec:
serviceAccountName: backupjob
containers:
- name: backup-cronjob
image: "${IMAGE}"
Expand Down Expand Up @@ -71,4 +72,4 @@ parameters:
description: 'Backup docker image URL'
value: 'quay.io/integreatly/backup-container:master'
- name: DEBUG
description: "Debug flag to sleep the job pod after its execution"
description: "Debug flag to sleep the job pod after its execution"
3 changes: 2 additions & 1 deletion templates/openshift/backup-job-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ objects:
labels:
job-name: ${NAME}
spec:
serviceAccountName: backupjob
containers:
- name: backup-job
image: "${IMAGE}"
Expand Down Expand Up @@ -67,4 +68,4 @@ parameters:
description: 'Backup docker image URL'
value: 'quay.io/integreatly/backup-container:master'
- name: DEBUG
description: "Debug flag to sleep the job pod after its execution"
description: "Debug flag to sleep the job pod after its execution"
9 changes: 9 additions & 0 deletions templates/openshift/rbac/role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: authorization.openshift.io/v1
kind: ClusterRoleBinding
metadata:
name: backupjob
roleRef:
name: backupjob
subjects:
- kind: ServiceAccount
name: backupjob
12 changes: 12 additions & 0 deletions templates/openshift/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: authorization.openshift.io/v1
kind: ClusterRole
metadata:
name: backupjob
rules:
- apiGroups:
- ""
resources:
- configmaps
- secrets
verbs:
- '*'
4 changes: 4 additions & 0 deletions templates/openshift/rbac/service-account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: backupjob

0 comments on commit 9ceaa3a

Please sign in to comment.