@@ -19,11 +19,11 @@ Change the cluster name to match your ROSA cluster, and ensure you are logged in
1919[source,terminal]
2020----
2121$ export CLUSTER_NAME=my-cluster <1>
22- export ROSA_CLUSTER_ID- $(rosa describe cluster -c ${CLUSTER_NAME} --output json | jq -r .id)
22+ export ROSA_CLUSTER_ID= $(rosa describe cluster -c ${CLUSTER_NAME} --output json | jq -r .id)
2323export REGION=$(rosa describe cluster -c ${CLUSTER_NAME} --output json | jq -r .region.id)
2424export OIDC_ENDPOINT=$(oc get authentication.config.openshift.io cluster -o jsonpath='{.spec.serviceAccountIssuer}' | sed 's|^https://||')
25- export AWS_ACCOUNT_ID=' aws sts get-caller-identity --query Account --output text'
26- export CLUSTER_VERSION=' rosa describe cluster -c ${CLUSTER_NAME} -o json | jq -r .version.raw_id | but -f -2 -d '.' '
25+ export AWS_ACCOUNT_ID=$( aws sts get-caller-identity --query Account --output text)
26+ export CLUSTER_VERSION=$( rosa describe cluster -c ${CLUSTER_NAME} -o json | jq -r .version.raw_id | cut -f -2 -d '.')
2727export ROLE_NAME="${CLUSTER_NAME}-openshift-oadp-aws-cloud-credentials"
2828export SCRATCH="/tmp/${CLUSTER_NAME}/oadp"
2929mkdir -p ${SCRATCH}
@@ -39,7 +39,7 @@ ${OIDC_ENDPOINT}, AWS Account ID: ${AWS_ACCOUNT_ID}"
3939+
4040[source,terminal]
4141----
42- $ POLICY_ARN=$(aws iam list-policies --query "Policies[?PolicyName=='RosaOadpVer1'].{ARN:Arn}" -- output text) <1>
42+ $ POLICY_ARN=$(aws iam list-policies --query "Policies[?PolicyName=='RosaOadpVer1'].{ARN:Arn}" --output text) <1>
4343----
4444+
4545 <1> Replace `RosaOadp` with your policy name.
@@ -61,10 +61,10 @@ cat << EOF > ${SCRATCH}/policy.json <1>
6161 {
6262 "Effect": "Allow",
6363 "Action": [
64- "s3:CreateBucket",$ echo ${POLICY_ARN}
65- "s3:DeleteBucket",cd openshift-docs
66- "s3:PutBucketTegging ",
67- "s3:GetBucketTegging ",
64+ "s3:CreateBucket",
65+ "s3:DeleteBucket",
66+ "s3:PutBucketTagging ",
67+ "s3:GetBucketTagging ",
6868 "s3:PutEncryptionConfiguration",
6969 "s3:GetEncryptionConfiguration",
7070 "s3:PutLifecycleConfiguration",
@@ -73,10 +73,10 @@ cat << EOF > ${SCRATCH}/policy.json <1>
7373 "s3:ListBucket",
7474 "s3:GetObject",
7575 "s3:PutObject",
76- "s3:DeleteOgject ",
77- "s3:ListBucketMultipartUpLoads ",
78- "s3:AbortMultipartUpLoads ",
79- "s3:ListMultipartUpLoadParts ",
76+ "s3:DeleteObject ",
77+ "s3:ListBucketMultipartUploads ",
78+ "s3:AbortMultipartUploads ",
79+ "s3:ListMultipartUploadParts ",
8080 "s3:DescribeSnapshots",
8181 "ec2:DescribeVolumes",
8282 "ec2:DescribeVolumeAttribute",
@@ -85,15 +85,16 @@ cat << EOF > ${SCRATCH}/policy.json <1>
8585 "ec2:CreateTags",
8686 "ec2:CreateVolume",
8787 "ec2:CreateSnapshot",
88- "ec2:DeleteSnapshot",
89- ]
88+ "ec2:DeleteSnapshot"
89+ ],
9090 "Resource": "*"
9191 }
9292 ]}
9393EOF
94- POLICY_ARN=$(aws iam create-policy --policy-mane "RosaOadpVer1" \
94+
95+ POLICY_ARN=$(aws iam create-policy --policy-name "RosaOadpVer1" \
9596--policy-document file:///${SCRATCH}/policy.json --query Policy.Arn \
96- --tags Key=rosa_openshift_version,Value=${CLUSTER_VERSION} Key- rosa_role_prefix,Value=ManagedOpenShift Key=operator_namespace,Value=openshift-oadp Key=operator_name,Value=openshift-oadp \
97+ --tags Key=rosa_openshift_version,Value=${CLUSTER_VERSION} Key= rosa_role_prefix,Value=ManagedOpenShift Key=operator_namespace,Value=openshift-oadp Key=operator_name,Value=openshift-oadp \
9798--output text)
9899fi
99100----
@@ -116,7 +117,7 @@ $ echo ${POLICY_ARN}
116117----
117118$ cat <<EOF > ${SCRATCH}/trust-policy.json
118119{
119- "Version": : 2012-10-17",
120+ "Version":2012-10-17",
120121 "Statement": [{
121122 "Effect": "Allow",
122123 "Principal": {
@@ -127,7 +128,7 @@ $ cat <<EOF > ${SCRATCH}/trust-policy.json
127128 "StringEquals": {
128129 "${OIDC_ENDPOINT}:sub": [
129130 "system:serviceaccount:openshift-adp:openshift-adp-controller-manager",
130- "system:serviceaccount:openshift-adp:velero: ]
131+ "system:serviceaccount:openshift-adp:velero" ]
131132 }
132133 }
133134 }]
@@ -142,11 +143,11 @@ EOF
142143$ ROLE_ARN=$(aws iam create-role --role-name \
143144 "${ROLE_NAME}" \
144145 --assume-role-policy-document file://${SCRATCH}/trust-policy.json \
145- --tags Key+ rosa_cluster_id,Value=${ROSA_CLUSTER_ID}
146- Key=rosa_openshift_verson ,Value=${CLUSTER_VERSION}
146+ --tags Key= rosa_cluster_id,Value=${ROSA_CLUSTER_ID}
147+ Key=rosa_openshift_version ,Value=${CLUSTER_VERSION}
147148Key=rosa_role_prefix,Value=ManagedOpenShift
148149Key=operator_namespace,Value=openshift-adp
149- Key=operator_name,Value- openshift-oadp \
150+ Key=operator_name,Value= openshift-oadp \
150151 --query Role.Arn --output text)
151152----
152153
0 commit comments