@@ -19,11 +19,11 @@ Change the cluster name to match your ROSA cluster, and ensure you are logged in
19
19
[source,terminal]
20
20
----
21
21
$ 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)
23
23
export REGION=$(rosa describe cluster -c ${CLUSTER_NAME} --output json | jq -r .region.id)
24
24
export 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 '.')
27
27
export ROLE_NAME="${CLUSTER_NAME}-openshift-oadp-aws-cloud-credentials"
28
28
export SCRATCH="/tmp/${CLUSTER_NAME}/oadp"
29
29
mkdir -p ${SCRATCH}
@@ -39,7 +39,7 @@ ${OIDC_ENDPOINT}, AWS Account ID: ${AWS_ACCOUNT_ID}"
39
39
+
40
40
[source,terminal]
41
41
----
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>
43
43
----
44
44
+
45
45
<1> Replace `RosaOadp` with your policy name.
@@ -61,10 +61,10 @@ cat << EOF > ${SCRATCH}/policy.json <1>
61
61
{
62
62
"Effect": "Allow",
63
63
"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 ",
68
68
"s3:PutEncryptionConfiguration",
69
69
"s3:GetEncryptionConfiguration",
70
70
"s3:PutLifecycleConfiguration",
@@ -73,10 +73,10 @@ cat << EOF > ${SCRATCH}/policy.json <1>
73
73
"s3:ListBucket",
74
74
"s3:GetObject",
75
75
"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 ",
80
80
"s3:DescribeSnapshots",
81
81
"ec2:DescribeVolumes",
82
82
"ec2:DescribeVolumeAttribute",
@@ -85,15 +85,16 @@ cat << EOF > ${SCRATCH}/policy.json <1>
85
85
"ec2:CreateTags",
86
86
"ec2:CreateVolume",
87
87
"ec2:CreateSnapshot",
88
- "ec2:DeleteSnapshot",
89
- ]
88
+ "ec2:DeleteSnapshot"
89
+ ],
90
90
"Resource": "*"
91
91
}
92
92
]}
93
93
EOF
94
- POLICY_ARN=$(aws iam create-policy --policy-mane "RosaOadpVer1" \
94
+
95
+ POLICY_ARN=$(aws iam create-policy --policy-name "RosaOadpVer1" \
95
96
--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 \
97
98
--output text)
98
99
fi
99
100
----
@@ -116,7 +117,7 @@ $ echo ${POLICY_ARN}
116
117
----
117
118
$ cat <<EOF > ${SCRATCH}/trust-policy.json
118
119
{
119
- "Version": : 2012-10-17",
120
+ "Version":2012-10-17",
120
121
"Statement": [{
121
122
"Effect": "Allow",
122
123
"Principal": {
@@ -127,7 +128,7 @@ $ cat <<EOF > ${SCRATCH}/trust-policy.json
127
128
"StringEquals": {
128
129
"${OIDC_ENDPOINT}:sub": [
129
130
"system:serviceaccount:openshift-adp:openshift-adp-controller-manager",
130
- "system:serviceaccount:openshift-adp:velero: ]
131
+ "system:serviceaccount:openshift-adp:velero" ]
131
132
}
132
133
}
133
134
}]
@@ -142,11 +143,11 @@ EOF
142
143
$ ROLE_ARN=$(aws iam create-role --role-name \
143
144
"${ROLE_NAME}" \
144
145
--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}
147
148
Key=rosa_role_prefix,Value=ManagedOpenShift
148
149
Key=operator_namespace,Value=openshift-adp
149
- Key=operator_name,Value- openshift-oadp \
150
+ Key=operator_name,Value= openshift-oadp \
150
151
--query Role.Arn --output text)
151
152
----
152
153
0 commit comments