Skip to content

Commit cef4c23

Browse files
committed
[OSDOCS-4353]: Adds GCP workload ID upgrade procedure
1 parent 7a9b74f commit cef4c23

File tree

5 files changed

+112
-44
lines changed

5 files changed

+112
-44
lines changed

authentication/managing_cloud_provider_credentials/cco-mode-gcp-workload-identity.adoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,17 @@ include::modules/sts-mode-installing-manual-run-installer.adoc[leveloffset=+2]
117117
//Task part 4: Verify that the cluster is using short-lived credentials
118118
include::modules/sts-mode-installing-verifying.adoc[leveloffset=+2]
119119

120-
////
121-
// No Upgrade in 4.10 but this should work exactly the same as AWS STS does.
122120
[id="gcp-workload-identity-mode-upgrading"]
123121
== Upgrading an {product-title} cluster configured for manual mode with GCP Workload Identity
124122

125123
The release image for the version of {product-title} that you are upgrading to contains a version of the `ccoctl` binary and list of `CredentialsRequest` objects specific to that release.
126124

127-
:context: sts-mode-upgrading
125+
:context: wif-mode-upgrading
128126

129127
include::modules/cco-ccoctl-configuring.adoc[leveloffset=+2]
130128

131129
include::modules/cco-ccoctl-upgrading.adoc[leveloffset=+2]
132130

133131
include::modules/manually-maintained-credentials-upgrade.adoc[leveloffset=+2]
134-
////
132+
133+
:context: cco-mode-gcp-workload-identity

authentication/managing_cloud_provider_credentials/cco-mode-sts.adoc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,10 @@ The release image for the version of {product-title} that you are upgrading to c
111111

112112
:context: sts-mode-upgrading
113113

114-
//Task part 1: Configuring the Cloud Credential Operator utility
115114
include::modules/cco-ccoctl-configuring.adoc[leveloffset=+2]
116115

117116
include::modules/cco-ccoctl-upgrading.adoc[leveloffset=+2]
118117

119118
include::modules/manually-maintained-credentials-upgrade.adoc[leveloffset=+2]
120119

121-
//Task part 3: Run the OCP installer
122-
//include::modules/sts-mode-installing-manual-run-installer.adoc[leveloffset=+2]
123-
124-
//Task part 4: Verify that the cluster is using short-lived credentials
125-
//include::modules/sts-mode-installing-verifying.adoc[leveloffset=+2]
120+
:context: cco-mode-sts

modules/cco-ccoctl-configuring.adoc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
ifeval::["{context}" == "cco-mode-sts"]
99
:aws-sts:
1010
endif::[]
11+
ifeval::["{context}" == "sts-mode-upgrading"]
12+
:aws-sts:
13+
endif::[]
1114
ifeval::["{context}" == "configuring-iam-ibm-cloud"]
1215
:ibm-cloud:
1316
endif::[]
@@ -17,6 +20,9 @@ endif::[]
1720
ifeval::["{context}" == "cco-mode-gcp-workload-identity"]
1821
:google-cloud-platform:
1922
endif::[]
23+
ifeval::["{context}" == "wif-mode-upgrading"]
24+
:google-cloud-platform:
25+
endif::[]
2026
ifeval::["{context}" == "preparing-to-install-on-nutanix"]
2127
:nutanix:
2228
endif::[]
@@ -96,11 +102,11 @@ endif::aws-sts[]
96102
$ RELEASE_IMAGE=$(./openshift-install version | awk '/release image/ {print $3}')
97103
----
98104

99-
. Get the CCO container image from the {product-title} release image by running the following command:
105+
. Obtain the CCO container image from the {product-title} release image by running the following command:
100106
+
101107
[source,terminal]
102108
----
103-
$ CCO_IMAGE=$(oc adm release info --image-for='cloud-credential-operator' $RELEASE_IMAGE)
109+
$ CCO_IMAGE=$(oc adm release info --image-for='cloud-credential-operator' $RELEASE_IMAGE -a ~/.pull-secret)
104110
----
105111
+
106112
[NOTE]
@@ -157,6 +163,9 @@ Use "ccoctl [command] --help" for more information about a command.
157163
ifeval::["{context}" == "cco-mode-sts"]
158164
:!aws-sts:
159165
endif::[]
166+
ifeval::["{context}" == "sts-mode-upgrading"]
167+
:!aws-sts:
168+
endif::[]
160169
ifeval::["{context}" == "configuring-iam-ibm-cloud"]
161170
:!ibm-cloud:
162171
endif::[]
@@ -166,6 +175,9 @@ endif::[]
166175
ifeval::["{context}" == "cco-mode-gcp-workload-identity"]
167176
:!google-cloud-platform:
168177
endif::[]
178+
ifeval::["{context}" == "wif-mode-upgrading"]
179+
:!google-cloud-platform:
180+
endif::[]
169181
ifeval::["{context}" == "preparing-to-install-on-nutanix"]
170182
:!nutanix:
171183
endif::[]

modules/cco-ccoctl-creating-individually.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ where:
7575
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
7676
----
7777
+
78-
where `02-openid-configuration` is a discovery document and `03-keys.json` is a JSON web key set file.
78+
where `openid-configuration` is a discovery document and `keys.json` is a JSON web key set file.
7979
+
8080
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.
8181

modules/cco-ccoctl-upgrading.adoc

Lines changed: 93 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,27 @@
66
ifeval::["{context}" == "sts-mode-upgrading"]
77
:aws-sts:
88
endif::[]
9-
ifeval::["{context}" == "cco-mode-gcp-workload-identity"]
9+
ifeval::["{context}" == "wif-mode-upgrading"]
1010
:google-cloud-platform:
1111
endif::[]
1212

1313
:_content-type: PROCEDURE
1414
[id="cco-ccoctl-upgrading_{context}"]
15-
ifdef::aws-sts[]
16-
= Updating AWS resources with the Cloud Credential Operator utility
15+
= Updating cloud provider resources with the Cloud Credential Operator utility
1716

18-
The process for upgrading an {product-title} cluster configured for manual mode with AWS Secure Token Service (STS) is similar to installing on a cluster for which you create the AWS resources individually.
17+
The process for upgrading an {product-title} cluster configured for
18+
ifdef::aws-sts[manual mode with STS]
19+
ifdef::google-cloud-platform[manual mode with GCP Workload Identity]
20+
is similar to creating the cloud provider resources during installation.
1921

2022
[NOTE]
2123
====
2224
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.
25+
ifdef::aws-sts[]
2326
2427
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.
25-
====
2628
endif::aws-sts[]
27-
ifdef::google-cloud-platform[]
28-
= Updating GCP resources with the Cloud Credential Operator utility
29-
30-
The process for upgrading an {product-title} cluster configured for manual mode with GCP Workload Identity is similar to installing on a cluster for which you create the GCP resources individually.
31-
32-
[NOTE]
3329
====
34-
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.
35-
36-
Some `ccoctl` commands make GCP API calls to create or modify GCP resources. You can use the `--dry-run` flag to avoid making API calls. Using this flag creates bash scripts with Google Cloud CLI commands on the local file system instead. You can review and modify the bash scripts and then run them to create the required GCP resources.
37-
====
38-
endif::google-cloud-platform[]
3930

4031
.Prerequisites
4132

@@ -45,12 +36,13 @@ endif::google-cloud-platform[]
4536
4637
.Procedure
4738

48-
. Extract the list of `CredentialsRequest` custom resources (CRs) from the {product-title} release image:
39+
. Extract the list of `CredentialsRequest` custom resources (CRs) from the {product-title} release image by running the following command:
4940
+
5041
[source,terminal]
5142
----
5243
$ oc adm release extract --credentials-requests \
53-
--cloud=aws \
44+
ifdef::aws-sts[--cloud=aws \]
45+
ifdef::google-cloud-platform[--cloud=gcp \]
5446
--to=<path_to_directory_with_list_of_credentials_requests>/credrequests \ <1>
5547
quay.io/<path_to>/ocp-release:<version>
5648
----
@@ -59,6 +51,7 @@ quay.io/<path_to>/ocp-release:<version>
5951

6052
. For each `CredentialsRequest` CR in the release image, ensure that a namespace that matches the text in the `spec.secretRef.namespace` field exists in the cluster. This field is where the generated secrets that hold the credentials configuration are stored.
6153
+
54+
ifdef::aws-sts[]
6255
.Sample AWS `CredentialsRequest` object
6356
[source,yaml]
6457
----
@@ -68,9 +61,6 @@ metadata:
6861
name: cloud-credential-operator-iam-ro
6962
namespace: openshift-cloud-credential-operator
7063
spec:
71-
secretRef:
72-
name: cloud-credential-operator-iam-ro-creds
73-
namespace: openshift-cloud-credential-operator <1>
7464
providerSpec:
7565
apiVersion: cloudcredential.openshift.io/v1
7666
kind: AWSProviderSpec
@@ -81,26 +71,58 @@ spec:
8171
- iam:GetUserPolicy
8272
- iam:ListAccessKeys
8373
resource: "*"
74+
secretRef:
75+
name: cloud-credential-operator-iam-ro-creds
76+
namespace: openshift-cloud-credential-operator <1>
8477
----
78+
endif::aws-sts[]
79+
ifdef::google-cloud-platform[]
80+
.Sample GCP `CredentialsRequest` object
81+
[source,yaml]
82+
----
83+
apiVersion: cloudcredential.openshift.io/v1
84+
kind: CredentialsRequest
85+
metadata:
86+
annotations:
87+
exclude.release.openshift.io/internal-openshift-hosted: "true"
88+
include.release.openshift.io/self-managed-high-availability: "true"
89+
name: cloud-credential-operator-gcp-ro-creds
90+
namespace: openshift-cloud-credential-operator
91+
spec:
92+
providerSpec:
93+
apiVersion: cloudcredential.openshift.io/v1
94+
kind: GCPProviderSpec
95+
predefinedRoles:
96+
- roles/iam.securityReviewer
97+
- roles/iam.roleViewer
98+
skipServiceCheck: true
99+
secretRef:
100+
name: cloud-credential-operator-gcp-ro-creds
101+
namespace: openshift-cloud-credential-operator <1>
102+
serviceAccountNames:
103+
- cloud-credential-operator
104+
----
105+
endif::google-cloud-platform[]
85106
+
86107
<1> This field indicates the namespace which needs to exist to hold the generated secret.
87108
88-
. For any `CredentialsRequest` CR for which the cluster does not already have a namespace with the name specified in `spec.secretRef.namespace`, create the namespace:
109+
. For any `CredentialsRequest` CR for which the cluster does not already have a namespace with the name specified in `spec.secretRef.namespace`, create the namespace by running the following command:
89110
+
90-
[source,terminal,subs="+quotes"]
111+
[source,terminal]
91112
----
92113
$ oc create namespace <component_namespace>
93114
----
94115
95-
. Use the `ccoctl` tool to process all `CredentialsRequest` objects in the `credrequests` directory:
116+
. Use the `ccoctl` tool to process all `CredentialsRequest` objects in the `credrequests` directory by running the following command:
96117
+
97-
[source,terminal,subs="+quotes"]
118+
ifdef::aws-sts[]
119+
[source,terminal]
98120
----
99121
$ ccoctl aws create-iam-roles \
100-
--name <name> \
122+
--name=<name> \
101123
--region=<aws_region> \
102124
--credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests \
103-
--identity-provider-arn arn:aws:iam::<aws_account_id>:oidc-provider/<name>-oidc.s3.<aws_region>.amazonaws.com
125+
--identity-provider-arn=arn:aws:iam::<aws_account_id>:oidc-provider/<cluster_name>-oidc.s3.<aws_region>.amazonaws.com
104126
----
105127
+
106128
where:
@@ -109,6 +131,7 @@ where:
109131
** `<name>` is the name used to tag any cloud resources that are created for tracking. For upgrades, use the same value that was used for the initial installation.
110132
** `<aws_account_id>` is the AWS account ID.
111133
** `<aws_region>` is the AWS region in which cloud resources will be created.
134+
** `<aws_account_id>`, `<cluster_name>`, and `<aws_region>` are standard elements of the Amazon Resource Name (ARN) for your cluster, provided here to illustrate the format of an ARN. You can obtain the ARN for your cluster's identity provider from the *Identity Providers* menu in the link:https://console.aws.amazon.com/iam/[AWS IAM console].
112135
--
113136
+
114137
[NOTE]
@@ -117,10 +140,38 @@ For AWS environments that use alternative IAM API endpoints, such as GovCloud, y
117140

118141
If your cluster uses Technology Preview features that are enabled by the `TechPreviewNoUpgrade` feature set, you must include the `--enable-tech-preview` parameter.
119142
====
143+
endif::aws-sts[]
144+
ifdef::google-cloud-platform[]
145+
[source,terminal]
146+
----
147+
$ ccoctl gcp create-service-accounts \
148+
--credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests \
149+
--name=<name> \
150+
--project=<gcp_project_id> \
151+
--workload-identity-pool=<name> \
152+
--workload-identity-provider=<name>
153+
----
154+
+
155+
where:
156+
+
157+
--
158+
** `<path_to_directory_with_list_of_credentials_requests>/credrequests` is the directory containing the files of `CredentialsRequest` manifests to create GCP service accounts.
159+
** `<name>` is the user-defined name for all created GCP resources used for tracking.
160+
** `<gcp_project_id>` is the GCP project ID in which cloud resources will be created.
161+
--
162+
+
163+
[NOTE]
164+
====
165+
If your cluster uses Technology Preview features that are enabled by the `TechPreviewNoUpgrade` feature set, you must include the `--enable-tech-preview` parameter.
166+
====
167+
endif::google-cloud-platform[]
120168
+
121-
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.
169+
For each `CredentialsRequest` object, `ccoctl` creates
170+
ifdef::aws-sts[an IAM role with a trust policy that is tied to the specified OIDC identity provider,]
171+
ifdef::google-cloud-platform[a service account]
172+
and a permissions policy as defined in each `CredentialsRequest` object from the {product-title} release image.
122173

123-
. Apply the secrets to your cluster:
174+
. Apply the secrets to your cluster by running the following command:
124175
+
125176
[source,terminal]
126177
----
@@ -129,11 +180,22 @@ $ ls <path_to_ccoctl_output_dir>/manifests/*-credentials.yaml | xargs -I{} oc ap
129180
130181
.Verification
131182
132-
You can verify that the IAM roles are created by querying AWS. For more information, refer to AWS documentation on listing IAM roles.
183+
You can verify that the
184+
ifdef::aws-sts[IAM roles]
185+
ifdef::google-cloud-platform[service accounts]
186+
are created by querying
187+
ifdef::aws-sts[AWS.]
188+
ifdef::google-cloud-platform[GCP.]
189+
For more information, refer to
190+
ifdef::aws-sts[AWS]
191+
ifdef::google-cloud-platform[GCP]
192+
documentation on listing
193+
ifdef::aws-sts[IAM roles.]
194+
ifdef::google-cloud-platform[service accounts.]
133195
134196
ifeval::["{context}" == "sts-mode-upgrading"]
135197
:!aws-sts:
136198
endif::[]
137-
ifeval::["{context}" == "cco-mode-gcp-workload-identity"]
199+
ifeval::["{context}" == "wif-mode-upgrading"]
138200
:!google-cloud-platform:
139201
endif::[]

0 commit comments

Comments
 (0)