Last active
May 27, 2020 20:16
-
-
Save alaypatel07/9e06cbb074eb7fcd2157aa65478761f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export RESOURCE="migrationcontrollers" | |
export NAMESPACE="openshift-migration" | |
if [ -z "$1" ]; then | |
export USER="bob" | |
else | |
export USER=$1 | |
fi | |
if [ -z "$2" ]; then | |
export NAMESPACE="openshift-migration" | |
else | |
export USER=$2 | |
fi | |
export ROLE_NAME=use-migration-controller | |
cat <<EOF | oc apply -f - | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: Role | |
metadata: | |
namespace: "$NAMESPACE" | |
name: "$ROLE_NAME" | |
rules: | |
- apiGroups: ["migration.openshift.io"] | |
resources: ["$RESOURCE"] | |
resourceNames: ["migration-controller"] | |
verbs: ["use"] | |
EOF | |
oc create rolebinding $USER-use-migration-controller --role $ROLE_NAME --user $USER --namespace $NAMESPACE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment