Skip to content

Commit f1c3d42

Browse files
authored
Merge pull request openshift#64045 from fmcdonal/OSDOCS-6598-PR
2 parents c6b51d9 + 92f32b6 commit f1c3d42

File tree

2 files changed

+38
-30
lines changed

2 files changed

+38
-30
lines changed

modules/oadp-installing-oadp-rosa-sts.adoc

+16-9
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ web_identity_token_file = /var/run/secrets/openshift/serviceaccount/token
3434
EOF
3535
----
3636

37+
.. Create a namespace for OADP:
38+
+
39+
[source,terminal]
40+
----
41+
$ oc create namespace openshift-adp
42+
----
43+
3744
.. Create the OpenShift secret:
3845
+
3946
[source,terminal]
@@ -93,16 +100,16 @@ spec:
93100
defaultPlugins:
94101
- openshift
95102
- aws
96-
restic:
97-
enable: false
103+
restic:
104+
enable: false
98105
snapshotLocations:
99-
- velero:
100-
config:
101-
credentialsFile: /tmp/credentials/openshift-adp/cloud-credentials-credentials <1>
102-
enableSharedConfig: "true" <2>
103-
profile: default <3>
104-
region: ${REGION} <4>
105-
provider: aws
106+
- velero:
107+
config:
108+
credentialsFile: /tmp/credentials/openshift-adp/cloud-credentials-credentials <1>
109+
enableSharedConfig: "true" <2>
110+
profile: default <3>
111+
region: ${REGION} <4>
112+
provider: aws
106113
EOF
107114
----
108115

modules/oadp-preparing-aws-credentials.adoc

+22-21
Original file line numberDiff line numberDiff line change
@@ -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)
2323
export REGION=$(rosa describe cluster -c ${CLUSTER_NAME} --output json | jq -r .region.id)
2424
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 '.')
2727
export ROLE_NAME="${CLUSTER_NAME}-openshift-oadp-aws-cloud-credentials"
2828
export SCRATCH="/tmp/${CLUSTER_NAME}/oadp"
2929
mkdir -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
]}
9393
EOF
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)
9899
fi
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}
147148
Key=rosa_role_prefix,Value=ManagedOpenShift
148149
Key=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

Comments
 (0)