Skip to content

Commit 7cef870

Browse files
committed
BZ2035903: Manually creating IAM instructions for tech preview CRs
1 parent 0ae1506 commit 7cef870

9 files changed

+175
-79
lines changed

modules/cco-ccoctl-creating-at-once.adoc

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ endif::alibabacloud-default,alibabacloud-customizations[]
4343

4444
[NOTE]
4545
====
46-
By default, `ccoctl` creates objects in the directory in which the commands are run. To specify a directory, use the `--output-dir` flag. This procedure uses `<path_to_ccoctl_output_dir>` to refer to this location.
46+
By default, `ccoctl` creates objects in the directory in which the commands are run. To create the objects in a different directory, use the `--output-dir` flag. This procedure uses `<path_to_ccoctl_output_dir>` to refer to this directory.
4747
====
4848

4949
.Prerequisites
@@ -63,17 +63,26 @@ endif::alibabacloud-default,alibabacloud-customizations[]
6363
[source,terminal]
6464
ifdef::aws-sts[]
6565
----
66-
$ oc adm release extract --credentials-requests --cloud=aws --to=<path_to_directory_with_list_of_credentials_requests>/credrequests quay.io/<path_to>/ocp-release:<version>
66+
$ oc adm release extract \
67+
--credentials-requests \
68+
--cloud=aws \
69+
--to=<path_to_directory_with_list_of_credentials_requests>/credrequests quay.io/<path_to>/ocp-release:<version>
6770
----
6871
endif::aws-sts[]
6972
ifdef::google-cloud-platform[]
7073
----
71-
$ oc adm release extract --credentials-requests --cloud=gcp --to=<path_to_directory_with_list_of_credentials_requests>/credrequests quay.io/<path_to>/ocp-release:<version>
74+
$ oc adm release extract \
75+
--credentials-requests \
76+
--cloud=gcp \
77+
--to=<path_to_directory_with_list_of_credentials_requests>/credrequests quay.io/<path_to>/ocp-release:<version>
7278
----
7379
endif::google-cloud-platform[]
7480
ifdef::alibabacloud-default,alibabacloud-customizations[]
7581
----
76-
$ oc adm release extract --credentials-requests --cloud=alibabacloud --to=<path_to_directory_with_list_of_credentials_requests>/credrequests quay.io/<path_to>/ocp-release:<version>
82+
$ oc adm release extract \
83+
--credentials-requests \
84+
--cloud=alibabacloud \
85+
--to=<path_to_directory_with_list_of_credentials_requests>/credrequests quay.io/<path_to>/ocp-release:<version>
7786
----
7887
endif::alibabacloud-default,alibabacloud-customizations[]
7988
+
@@ -89,27 +98,48 @@ endif::aws-sts,google-cloud-platform[]
8998
ifdef::aws-sts[]
9099
[source,terminal]
91100
----
92-
$ ccoctl aws create-all --name=<name> --region=<aws_region> --credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests
101+
$ ccoctl aws create-all \
102+
--name=<name> \
103+
--region=<aws_region> \
104+
--credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests
93105
----
94106
+
95107
where:
96108
+
109+
--
97110
** `<name>` is the name used to tag any cloud resources that are created for tracking.
98111
** `<aws_region>` is the AWS region in which cloud resources will be created.
99112
** `<path_to_directory_with_list_of_credentials_requests>/credrequests` is the directory containing the files for the component `CredentialsRequest` objects.
113+
--
114+
+
115+
[NOTE]
116+
====
117+
If your cluster uses Technology Preview features that are enabled by the `TechPreviewNoUpgrade` feature set, you must include the `--enable-tech-preview` parameter.
118+
====
100119
endif::aws-sts[]
101120
ifdef::google-cloud-platform[]
102121
[source,terminal]
103122
----
104-
$ ccoctl gcp create-all --name=<name> --region=<gcp_region> --project=<gcp_project_id> --credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests
123+
$ ccoctl gcp create-all \
124+
--name=<name> \
125+
--region=<gcp_region> \
126+
--project=<gcp_project_id> \
127+
--credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests
105128
----
106129
+
107130
where:
108131
+
132+
--
109133
** `<name>` is the user-defined name for all created GCP resources used for tracking.
110134
** `<gcp_region>` is the GCP region in which cloud resources will be created.
111135
** `<gcp_project_id>` is the GCP project ID in which cloud resources will be created.
112136
** `<path_to_directory_with_list_of_credentials_requests>/credrequests` is the directory containing the files of `CredentialsRequest` manifests to create GCP service accounts.
137+
--
138+
+
139+
[NOTE]
140+
====
141+
If your cluster uses Technology Preview features that are enabled by the `TechPreviewNoUpgrade` feature set, you must include the `--enable-tech-preview` parameter.
142+
====
113143
endif::google-cloud-platform[]
114144

115145
ifdef::alibabacloud-default,alibabacloud-customizations[]
@@ -119,15 +149,26 @@ ifdef::alibabacloud-default,alibabacloud-customizations[]
119149
+
120150
[source,terminal]
121151
----
122-
$ ccoctl alibabacloud create-ram-users --name <name> --region=<alibaba_region> --credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests --output-dir=<path_to_ccoctl_output_dir>
152+
$ ccoctl alibabacloud create-ram-users \
153+
--name <name> \
154+
--region=<alibaba_region> \
155+
--credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests \
156+
--output-dir=<path_to_ccoctl_output_dir>
123157
----
124158
+
125159
where:
126160
+
161+
--
127162
** `<name>` is the name used to tag any cloud resources that are created for tracking.
128163
** `<alibaba_region>` is the Alibaba Cloud region in which cloud resources will be created.
129164
** `<path_to_directory_with_list_of_credentials_requests>/credrequests` is the directory containing the files for the component `CredentialsRequest` objects.
130165
** `<path_to_ccoctl_output_dir>` is the directory where the generated component credentials secrets will be placed.
166+
--
167+
+
168+
[NOTE]
169+
====
170+
If your cluster uses Technology Preview features that are enabled by the `TechPreviewNoUpgrade` feature set, you must include the `--enable-tech-preview` parameter.
171+
====
131172
+
132173
.Example output
133174
+

modules/cco-ccoctl-creating-individually.adoc

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Otherwise, you can use the `ccoctl aws create-all` command to create the AWS res
1414

1515
[NOTE]
1616
====
17-
By default, `ccoctl` creates objects in the directory in which the commands are run. To specify a directory, use the `--output-dir` flag. This procedure uses `_<path_to_ccoctl_output_dir>_` to refer to this location.
17+
By default, `ccoctl` creates objects in the directory in which the commands are run. To create the objects in a different directory, use the `--output-dir` flag. This procedure uses `<path_to_ccoctl_output_dir>` to refer to this directory.
1818
19-
Some `ccoctl` commands make AWS API calls to create or modify AWS resources. To place JSON files on the local file system instead, use the `--dry-run` flag. These JSON files can be reviewed or modified and then applied with the AWS CLI tool using the `--cli-input-json` parameters.
19+
Some `ccoctl` commands make AWS API calls to create or modify AWS resources. You can use the `--dry-run` flag to avoid making API calls. Using this flag creates JSON files on the local file system instead. You can review and modify the JSON files and then apply them with the AWS CLI tool using the `--cli-input-json` parameters.
2020
====
2121

2222
.Prerequisites
@@ -34,89 +34,102 @@ $ ccoctl aws create-key-pair
3434
+
3535
.Example output:
3636
+
37-
[source,terminal,subs="+quotes"]
37+
[source,terminal]
3838
----
3939
2021/04/13 11:01:02 Generating RSA keypair
40-
2021/04/13 11:01:03 Writing private key to /__<path_to_ccoctl_output_dir>__/serviceaccount-signer.private
41-
2021/04/13 11:01:03 Writing public key to /__<path_to_ccoctl_output_dir>__/serviceaccount-signer.public
40+
2021/04/13 11:01:03 Writing private key to /<path_to_ccoctl_output_dir>/serviceaccount-signer.private
41+
2021/04/13 11:01:03 Writing public key to /<path_to_ccoctl_output_dir>/serviceaccount-signer.public
4242
2021/04/13 11:01:03 Copying signing key for use by installer
4343
----
4444
+
4545
where `serviceaccount-signer.private` and `serviceaccount-signer.public` are the generated key files.
4646
+
47-
This command also creates a private key that the cluster requires during installation in `/_<path_to_ccoctl_output_dir>_/tls/bound-service-account-signing-key.key`.
47+
This command also creates a private key that the cluster requires during installation in `/<path_to_ccoctl_output_dir>/tls/bound-service-account-signing-key.key`.
4848

4949
. Create an OpenID Connect identity provider and S3 bucket on AWS:
5050
+
51-
[source,terminal,subs="+quotes"]
51+
[source,terminal]
5252
----
53-
$ ccoctl aws create-identity-provider --name=__<name>__ --region=__<aws_region>__ --public-key-file=__<path_to_ccoctl_output_dir>__/serviceaccount-signer.public
53+
$ ccoctl aws create-identity-provider \
54+
--name=<name> \
55+
--region=<aws_region> \
56+
--public-key-file=<path_to_ccoctl_output_dir>/serviceaccount-signer.public
5457
----
5558
+
5659
where:
5760
+
58-
** `_<name>_` is the name used to tag any cloud resources that are created for tracking.
59-
** `_<aws-region>_` is the AWS region in which cloud resources will be created.
60-
** `_<path_to_ccoctl_output_dir>_` is the path to the public key file that the `ccoctl aws create-key-pair` command generated.
61+
--
62+
** `<name>` is the name used to tag any cloud resources that are created for tracking.
63+
** `<aws-region>` is the AWS region in which cloud resources will be created.
64+
** `<path_to_ccoctl_output_dir>` is the path to the public key file that the `ccoctl aws create-key-pair` command generated.
65+
--
6166
+
6267
.Example output:
6368
+
64-
[source,terminal,subs="+quotes"]
69+
[source,terminal]
6570
----
66-
2021/04/13 11:16:09 Bucket __<name>__-oidc created
67-
2021/04/13 11:16:10 OpenID Connect discovery document in the S3 bucket __<name>__-oidc at .well-known/openid-configuration updated
71+
2021/04/13 11:16:09 Bucket <name>-oidc created
72+
2021/04/13 11:16:10 OpenID Connect discovery document in the S3 bucket <name>-oidc at .well-known/openid-configuration updated
6873
2021/04/13 11:16:10 Reading public key
69-
2021/04/13 11:16:10 JSON web key set (JWKS) in the S3 bucket __<name>__-oidc at keys.json updated
70-
2021/04/13 11:16:18 Identity Provider created with ARN: arn:aws:iam::__<aws_account_id>__:oidc-provider/__<name>__-oidc.s3.__<aws_region>__.amazonaws.com
74+
2021/04/13 11:16:10 JSON web key set (JWKS) in the S3 bucket <name>-oidc at keys.json updated
75+
2021/04/13 11:16:18 Identity Provider created with ARN: arn:aws:iam::<aws_account_id>:oidc-provider/<name>-oidc.s3.<aws_region>.amazonaws.com
7176
----
7277
+
7378
where `02-openid-configuration` is a discovery document and `03-keys.json` is a JSON web key set file.
7479
+
75-
This command also creates a YAML configuration file in `/_<path_to_ccoctl_output_dir>_/manifests/cluster-authentication-02-config.yaml`. This file sets the issuer URL field for the service account tokens that the cluster generates, so that the AWS IAM identity provider trusts the tokens.
80+
This command also creates a YAML configuration file in `/<path_to_ccoctl_output_dir>/manifests/cluster-authentication-02-config.yaml`. This file sets the issuer URL field for the service account tokens that the cluster generates, so that the AWS IAM identity provider trusts the tokens.
7681

7782
. Create IAM roles for each component in the cluster.
7883

7984
.. Extract the list of `CredentialsRequest` objects from the {product-title} release image:
8085
+
81-
[source,terminal,subs="+quotes"]
86+
[source,terminal]
8287
----
83-
$ oc adm release extract --credentials-requests --cloud=aws --to=__<path_to_directory_with_list_of_credentials_requests>__/credrequests quay.io/__<path_to>__/ocp-release:__<version>__
88+
$ oc adm release extract --credentials-requests \
89+
--cloud=aws \
90+
--to=<path_to_directory_with_list_of_credentials_requests>/credrequests quay.io/<path_to>/ocp-release:<version>
8491
----
8592

8693
.. Use the `ccoctl` tool to process all `CredentialsRequest` objects in the `credrequests` directory:
8794
+
88-
[source,terminal,subs="+quotes"]
95+
[source,terminal]
8996
----
90-
$ ccoctl aws create-iam-roles --name=__<name>__ --region=__<aws_region>__ --credentials-requests-dir=__<path_to_directory_with_list_of_credentials_requests>__/credrequests --identity-provider-arn=arn:aws:iam::__<aws_account_id>__:oidc-provider/__<name>__-oidc.s3.__<aws_region>__.amazonaws.com
97+
$ ccoctl aws create-iam-roles \
98+
--name=<name> \
99+
--region=<aws_region> \
100+
--credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests \
101+
--identity-provider-arn=arn:aws:iam::<aws_account_id>:oidc-provider/<name>-oidc.s3.<aws_region>.amazonaws.com
91102
----
92103
+
93104
[NOTE]
94105
====
95106
For AWS environments that use alternative IAM API endpoints, such as GovCloud, you must also specify your region with the `--region` parameter.
107+
108+
If your cluster uses Technology Preview features that are enabled by the `TechPreviewNoUpgrade` feature set, you must include the `--enable-tech-preview` parameter.
96109
====
97110
+
98111
For each `CredentialsRequest` object, `ccoctl` creates an IAM role with a trust policy that is tied to the specified OIDC identity provider, and a permissions policy as defined in each `CredentialsRequest` object from the {product-title} release image.
99112

100113
.Verification
101114

102-
* To verify that the {product-title} secrets are created, list the files in the `_<path_to_ccoctl_output_dir>_/manifests` directory:
115+
* To verify that the {product-title} secrets are created, list the files in the `<path_to_ccoctl_output_dir>/manifests` directory:
103116
+
104-
[source,terminal,subs="+quotes"]
117+
[source,terminal]
105118
----
106-
$ ll __<path_to_ccoctl_output_dir>__/manifests
119+
$ ll <path_to_ccoctl_output_dir>/manifests
107120
----
108121
+
109122
.Example output:
110123
+
111-
[source,terminal,subs="+quotes"]
124+
[source,terminal]
112125
----
113126
total 24
114-
-rw-------. 1 __<user>__ __<user>__ 161 Apr 13 11:42 cluster-authentication-02-config.yaml
115-
-rw-------. 1 __<user>__ __<user>__ 379 Apr 13 11:59 openshift-cloud-credential-operator-cloud-credential-operator-iam-ro-creds-credentials.yaml
116-
-rw-------. 1 __<user>__ __<user>__ 353 Apr 13 11:59 openshift-cluster-csi-drivers-ebs-cloud-credentials-credentials.yaml
117-
-rw-------. 1 __<user>__ __<user>__ 355 Apr 13 11:59 openshift-image-registry-installer-cloud-credentials-credentials.yaml
118-
-rw-------. 1 __<user>__ __<user>__ 339 Apr 13 11:59 openshift-ingress-operator-cloud-credentials-credentials.yaml
119-
-rw-------. 1 __<user>__ __<user>__ 337 Apr 13 11:59 openshift-machine-api-aws-cloud-credentials-credentials.yaml
127+
-rw-------. 1 <user> <user> 161 Apr 13 11:42 cluster-authentication-02-config.yaml
128+
-rw-------. 1 <user> <user> 379 Apr 13 11:59 openshift-cloud-credential-operator-cloud-credential-operator-iam-ro-creds-credentials.yaml
129+
-rw-------. 1 <user> <user> 353 Apr 13 11:59 openshift-cluster-csi-drivers-ebs-cloud-credentials-credentials.yaml
130+
-rw-------. 1 <user> <user> 355 Apr 13 11:59 openshift-image-registry-installer-cloud-credentials-credentials.yaml
131+
-rw-------. 1 <user> <user> 339 Apr 13 11:59 openshift-ingress-operator-cloud-credentials-credentials.yaml
132+
-rw-------. 1 <user> <user> 337 Apr 13 11:59 openshift-machine-api-aws-cloud-credentials-credentials.yaml
120133
----
121134
122135
You can verify that the IAM roles are created by querying AWS. For more information, refer to AWS documentation on listing IAM roles.

0 commit comments

Comments
 (0)