Skip to content

Commit 6137392

Browse files
committed
GCP Workload Identity
1 parent 70855cd commit 6137392

12 files changed

+400
-81
lines changed

_topic_maps/_topic_map.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,8 +952,10 @@ Topics:
952952
File: cco-mode-passthrough
953953
- Name: Using manual mode
954954
File: cco-mode-manual
955-
- Name: Using manual mode with STS
955+
- Name: Using manual mode with AWS Secure Token Service
956956
File: cco-mode-sts
957+
- Name: Using manual mode with GCP Workload Identity
958+
File: cco-mode-gcp-workload-identity
957959
---
958960
Name: Networking
959961
Dir: networking

authentication/managing_cloud_provider_credentials/about-cloud-credential-operator.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ Mint mode is the default and recommended best practice setting for the CCO to us
2626

2727
* **xref:../../authentication/managing_cloud_provider_credentials/cco-mode-manual.adoc#cco-mode-manual[Manual]**: In manual mode, a user manages cloud credentials instead of the CCO.
2828

29-
** **xref:../../authentication/managing_cloud_provider_credentials/cco-mode-sts.adoc#cco-mode-sts[Manual with AWS STS]**: In manual mode, you can configure an AWS cluster to use Amazon Web Services Secure Token Service (AWS STS). With this configuration, the CCO uses temporary credentials for different components.
29+
** **xref:../../authentication/managing_cloud_provider_credentials/cco-mode-sts.adoc#cco-mode-sts[Manual with AWS Secure Token Service]**: In manual mode, you can configure an AWS cluster to use Amazon Web Services Secure Token Service (AWS STS). With this configuration, the CCO uses temporary credentials for different components.
30+
31+
** **xref:../../authentication/managing_cloud_provider_credentials/cco-mode-gcp-workload-identity.adoc#cco-mode-gcp-workload-identity[Manual with GCP Workload Identity]**: In manual mode, you can configure a GCP cluster to use GCP Workload Identity. With this configuration, the CCO uses temporary credentials for different components.
3032

3133
.CCO mode support matrix
3234
[cols="<.^2,^.^1,^.^1,^.^1"]
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
:_content-type: ASSEMBLY
2+
[id="cco-mode-gcp-workload-identity"]
3+
= Using manual mode with GCP Workload Identity
4+
include::_attributes/common-attributes.adoc[]
5+
:context: cco-mode-gcp-workload-identity
6+
7+
toc::[]
8+
9+
Manual mode with GCP Workload Identity is supported for Google Cloud Platform (GCP).
10+
11+
In manual mode with GCP Workload Identity, the individual {product-title} cluster components can impersonate IAM service accounts using short-term, limited-privilege credentials.
12+
13+
Requests for new and refreshed credentials are automated by using an appropriately configured OpenID Connect (OIDC) identity provider, combined with IAM service accounts. {product-title} signs service account tokens that are trusted by GCP, and can be projected into a pod and used for authentication. Tokens are refreshed after one hour by default.
14+
15+
////
16+
to-do: GCP diagram from https://github.com/openshift/cloud-credential-operator/blob/master/docs/gcp_workload_identity_flow.png?raw=true
17+
18+
.Workload Identity authentication flow
19+
image::<new_filename_for_gcp_workload_id.svg[Detailed authentication flow between GCP and the cluster when using GCP Workload Identity]
20+
//to-do: improve alt-text
21+
////
22+
23+
Using manual mode with GCP Workload Identity changes the content of the GCP credentials that are provided to individual {product-title} components.
24+
25+
.GCP secret format
26+
27+
[source,yaml]
28+
----
29+
apiVersion: v1
30+
kind: Secret
31+
metadata:
32+
namespace: <target_namespace> <1>
33+
name: <target_secret_name> <2>
34+
data:
35+
service_account.json: <service_account> <3>
36+
----
37+
<1> The namespace for the component.
38+
<2> The name of the component secret.
39+
<3> The Base64 encoded service account.
40+
41+
.Content of the Base64 encoded `service_account.json` file using long-lived credentials
42+
43+
[source,json]
44+
----
45+
{
46+
"type": "service_account", <1>
47+
"project_id": "<project_id>",
48+
"private_key_id": "<private_key_id>",
49+
"private_key": "<private_key>", <2>
50+
"client_email": "<client_email_address>",
51+
"client_id": "<client_id>",
52+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
53+
"token_uri": "https://oauth2.googleapis.com/token",
54+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
55+
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/<client_email_address>"
56+
}
57+
----
58+
<1> The credential type is `service_account`.
59+
<2> The private RSA key that is used to authenticate to GCP. This key must be kept secure and is not rotated.
60+
61+
.Content of the Base64 encoded `service_account.json` file using GCP Workload Identity
62+
63+
[source,json]
64+
----
65+
{
66+
"type": "external_account", <1>
67+
"audience": "//iam.googleapis.com/projects/123456789/locations/global/workloadIdentityPools/test-pool/providers/test-provider", <2>
68+
"subject_token_type": "urn:ietf:params:oauth:token-type:jwt",
69+
"token_url": "https://sts.googleapis.com/v1/token",
70+
"service_account_impersonation_url": "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/<client_email_address>:generateAccessToken", <3>
71+
"credential_source": {
72+
"file": "<path_to_token>", <4>
73+
"format": {
74+
"type": "text"
75+
}
76+
}
77+
}
78+
----
79+
<1> The credential type is `external_account`.
80+
<2> The target audience is the GCP Workload Identity provider.
81+
<3> The resource URL of the service account that can be impersonated with these credentials.
82+
<4> The path to the service account token inside the pod. By convention, this is `/var/run/secrets/openshift/serviceaccount/token` for {product-title} components.
83+
84+
//Supertask: Installing an OCP cluster configured for manual mode with GCP Workload Identity
85+
[id="gcp-workload-identity-mode-installing"]
86+
== Installing an {product-title} cluster configured for manual mode with GCP Workload Identity
87+
88+
To install a cluster that is configured to use the Cloud Credential Operator (CCO) in manual mode with GCP Workload Identity:
89+
90+
. xref:../../authentication/managing_cloud_provider_credentials/cco-mode-gcp-workload-identity.adoc#cco-ccoctl-configuring_cco-mode-gcp-workload-identity[Configure the Cloud Credential Operator utility].
91+
. xref:../../authentication/managing_cloud_provider_credentials/cco-mode-gcp-workload-identity.adoc#cco-ccoctl-creating-at-once_cco-mode-gcp-workload-identity[Create the required GCP resources].
92+
. xref:../../authentication/managing_cloud_provider_credentials/cco-mode-gcp-workload-identity.adoc#sts-mode-installing-manual-run-installer_cco-mode-gcp-workload-identity[Run the {product-title} installer].
93+
. xref:../../authentication/managing_cloud_provider_credentials/cco-mode-gcp-workload-identity.adoc#sts-mode-installing-verifying_cco-mode-gcp-workload-identity[Verify that the cluster is using short-lived credentials].
94+
95+
////
96+
// Remove until upgrade is supported.
97+
[NOTE]
98+
====
99+
Because the cluster is operating in manual mode when using GCP Workload Identity, it is not able to create new credentials for components with the permissions that they require. When upgrading to a different minor version of {product-title}, there are often new GCP permission requirements. Before upgrading a cluster that is using GCP Workload Identity, the cluster administrator must manually ensure that the GCP permissions are sufficient for existing components and available to any new components.
100+
====
101+
////
102+
103+
//Task part 1: Configuring the Cloud Credential Operator utility
104+
include::modules/cco-ccoctl-configuring.adoc[leveloffset=+2]
105+
106+
//Task part 2: Creating the required GCP resources all at once
107+
include::modules/cco-ccoctl-creating-at-once.adoc[leveloffset=+2]
108+
109+
//Task part 3: Run the OCP installer
110+
include::modules/sts-mode-installing-manual-run-installer.adoc[leveloffset=+2]
111+
112+
//Task part 4: Verify that the cluster is using short-lived credentials
113+
include::modules/sts-mode-installing-verifying.adoc[leveloffset=+2]
114+
115+
////
116+
// No Upgrade in 4.10 but this should work exactly the same as AWS STS does.
117+
[id="gcp-workload-identity-mode-upgrading"]
118+
== Upgrading an {product-title} cluster configured for manual mode with GCP Workload Identity
119+
120+
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.
121+
122+
:context: sts-mode-upgrading
123+
124+
include::modules/cco-ccoctl-configuring.adoc[leveloffset=+2]
125+
126+
include::modules/cco-ccoctl-upgrading.adoc[leveloffset=+2]
127+
128+
include::modules/manually-maintained-credentials-upgrade.adoc[leveloffset=+2]
129+
////

installing/installing_gcp/manually-creating-iam-gcp.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ include::modules/alternatives-to-storing-admin-secrets-in-kube-system.adoc[level
1313
[role="_additional-resources"]
1414
.Additional resources
1515

16-
* xref:../../post_installation_configuration/cluster-tasks.adoc#post-install-rotate-remove-cloud-creds[Rotating or removing cloud provider credentials].
16+
* xref:../../authentication/managing_cloud_provider_credentials/cco-mode-gcp-workload-identity.adoc#cco-mode-gcp-workload-identity[Using manual mode with GCP Workload Identity]
17+
* xref:../../post_installation_configuration/cluster-tasks.adoc#post-install-rotate-remove-cloud-creds[Rotating or removing cloud provider credentials]
1718
1819
For a detailed description of all available CCO credential modes and their supported platforms, see xref:../../authentication/managing_cloud_provider_credentials/about-cloud-credential-operator.adoc#about-cloud-credential-operator[About the Cloud Credential Operator].
1920

installing/installing_gcp/uninstalling-cluster-gcp.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ toc::[]
99
You can remove a cluster that you deployed to Google Cloud Platform (GCP).
1010

1111
include::modules/installation-uninstall-clouds.adoc[leveloffset=+1]
12+
13+
include::modules/cco-ccoctl-deleting-sts-resources.adoc[leveloffset=+1]

modules/alternatives-to-storing-admin-secrets-in-kube-system.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ You can use the CCO utility (`ccoctl`) to configure the cluster to use the Amazo
3535

3636
endif::aws[]
3737

38+
ifdef::google-cloud-platform[]
39+
* *Use manual mode with GCP Workload Identity*:
40+
+
41+
You can use the CCO utility (`ccoctl`) to configure the cluster to use manual mode with GCP Workload Identity. When the CCO utility is used to configure the cluster for GCP Workload Identity, it signs service account tokens that provide short-term, limited-privilege security credentials to components.
42+
43+
endif::google-cloud-platform[]
44+
3845
ifdef::aws,google-cloud-platform[]
3946
* *Manage cloud credentials manually*:
4047
+

modules/cco-ccoctl-configuring.adoc

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Module included in the following assemblies:
22
//
33
// * authentication/managing_cloud_provider_credentials/cco-mode-sts.adoc
4+
// * authentication/managing_cloud_provider_credentials/cco-mode-gcp-workload-identity.adoc
45
// * installing/installing_ibm_cloud_public/configuring-iam-ibm-cloud.adoc
56
// * installing/installing_alibaba/manually-creating-alibaba-ram.adoc
67

@@ -13,14 +14,18 @@ endif::[]
1314
ifeval::["{context}" == "manually-creating-alibaba-ram"]
1415
:alibabacloud:
1516
endif::[]
17+
ifeval::["{context}" == "cco-mode-gcp-workload-identity"]
18+
:google-cloud-platform:
19+
endif::[]
1620

1721
:_content-type: PROCEDURE
1822
[id="cco-ccoctl-configuring_{context}"]
1923
= Configuring the Cloud Credential Operator utility
2024

21-
To create and manage cloud credentials from outside of the cluster when the Cloud Credential Operator (CCO) is operating in
25+
To create and manage cloud credentials from outside of the cluster when the Cloud Credential Operator (CCO) is operating in
2226
ifdef::aws-sts[manual mode with STS,]
2327
ifdef::ibm-cloud[manual mode,]
28+
ifdef::google-cloud-platform[manual mode with GCP Workload Identity,]
2429
extract and prepare the CCO utility (`ccoctl`) binary.
2530

2631
ifdef::alibabacloud[]
@@ -71,19 +76,10 @@ $ chmod 775 ccoctl
7176

7277
* To verify that `ccoctl` is ready to use, display the help file:
7378
+
74-
ifndef::ibm-cloud[]
7579
[source,terminal]
7680
----
7781
$ ccoctl --help
7882
----
79-
endif::ibm-cloud[]
80-
ifdef::ibm-cloud[]
81-
[source,terminal]
82-
----
83-
$ ccoctl ibmcloud --help
84-
----
85-
endif::ibm-cloud[]
86-
ifndef::ibm-cloud[]
8783
+
8884
.Output of `ccoctl --help`:
8985
+
@@ -106,7 +102,6 @@ Flags:
106102

107103
Use "ccoctl [command] --help" for more information about a command.
108104
----
109-
endif::ibm-cloud[]
110105

111106
ifeval::["{context}" == "cco-mode-sts"]
112107
:!aws-sts:
@@ -117,4 +112,6 @@ endif::[]
117112
ifeval::["{context}" == "manually-creating-alibaba-ram"]
118113
:!alibabacloud:
119114
endif::[]
120-
115+
ifeval::["{context}" == "cco-mode-gcp-workload-identity"]
116+
:!google-cloud-platform:
117+
endif::[]

0 commit comments

Comments
 (0)