Skip to content

Instantly share code, notes, and snippets.

@aramalipoor
Last active December 30, 2018 17:02
Show Gist options
  • Save aramalipoor/1ec40a934da4606d90f2a2e4c4a13350 to your computer and use it in GitHub Desktop.
Save aramalipoor/1ec40a934da4606d90f2a2e4c4a13350 to your computer and use it in GitHub Desktop.
OKD Role and RoleBinding suitable to share Templates and ImageStreams with other users and projects
apiVersion: v1
kind: Template
metadata:
name: shared-resource-viewer
parameters:
- displayName: Project / Namespace
description: Name of the project (might be current project) from which you want to publish/share Templates and ImageStreams
name: NAMESPACE
required: true
value: my-project-name
objects:
- apiVersion: authorization.openshift.io/v1
kind: Role
metadata:
annotations:
openshift.io/reconcile-protect: "false"
name: shared-resource-viewer
namespace: ${NAMESPACE}
rules:
- apiGroups:
- ""
- template.openshift.io
attributeRestrictions: null
resources:
- templates
verbs:
- get
- list
- watch
- apiGroups:
- ""
- image.openshift.io
attributeRestrictions: null
resources:
- imagestreamimages
- imagestreams
- imagestreamtags
verbs:
- get
- list
- watch
- apiGroups:
- ""
- image.openshift.io
attributeRestrictions: null
resources:
- imagestreams/layers
verbs:
- get
- apiVersion: authorization.openshift.io/v1
groupNames:
- system:authenticated
kind: RoleBinding
metadata:
annotations:
openshift.io/reconcile-protect: "false"
name: shared-resource-viewers
namespace: ${NAMESPACE}
roleRef:
name: shared-resource-viewer
namespace: ${NAMESPACE}
subjects:
- kind: SystemGroup
name: system:authenticated
userNames: null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment