|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * storage/container_storage_csi-google_cloud_file.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="persistent-storage-csi-gcp-filestore-wif_{context}"] |
| 7 | += Preparing to install the {gcp-short} Filestore CSI Driver Operator with Workload Identity |
| 8 | + |
| 9 | +If you are planning to use {gcp-wid-short} with Google Compute Platform Filestore, you must obtain certain parameters that you will use during the installation of the {gcp-short} Filestore Container Storage Interface (CSI) Driver Operator. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | +* Access to the cluster as a user with the cluster-admin role. |
| 13 | +
|
| 14 | +// Put note in install area of docs to remind users to take note of the identity pool ID and the provider ID |
| 15 | + |
| 16 | +.Procedure |
| 17 | + |
| 18 | +To prepare to install the {gcp-short} Filestore CSI Driver Operator with Workload Identity: |
| 19 | + |
| 20 | +. Obtain the project number: |
| 21 | + |
| 22 | +.. Obtain the project ID by running the following command: |
| 23 | ++ |
| 24 | +[source, terminal] |
| 25 | +---- |
| 26 | +$ export PROJECT_ID=$(oc get infrastructure/cluster -o jsonpath='{.status.platformStatus.gcp.projectID}') |
| 27 | +---- |
| 28 | + |
| 29 | +.. Obtain the project number, using the project ID, by running the following command: |
| 30 | ++ |
| 31 | +[source, terminal] |
| 32 | +---- |
| 33 | +$ gcloud projects describe $PROJECT_ID --format="value(projectNumber)" |
| 34 | +---- |
| 35 | + |
| 36 | +. Find the identity pool ID and the provider ID: |
| 37 | ++ |
| 38 | +During cluster installation, the names of these resources are provided to the Cloud Credential Operator utility (`ccoctl`) with the `--name parameter`. See "Creating {gcp-short} resources with the Cloud Credential Operator utility". |
| 39 | + |
| 40 | +. Create Workload Identity resources for the {gcp-short} Filestore Operator: |
| 41 | + |
| 42 | +.. Create a `CredentialsRequest` file using the following example file: |
| 43 | ++ |
| 44 | +.Example Credentials Request YAML file |
| 45 | +[source, YAML] |
| 46 | +---- |
| 47 | +apiVersion: cloudcredential.openshift.io/v1 |
| 48 | +kind: CredentialsRequest |
| 49 | +metadata: |
| 50 | + name: openshift-gcp-filestore-csi-driver-operator |
| 51 | + namespace: openshift-cloud-credential-operator |
| 52 | + annotations: |
| 53 | + include.release.openshift.io/self-managed-high-availability: "true" |
| 54 | + include.release.openshift.io/single-node-developer: "true" |
| 55 | +spec: |
| 56 | + serviceAccountNames: |
| 57 | + - gcp-filestore-csi-driver-operator |
| 58 | + - gcp-filestore-csi-driver-controller-sa |
| 59 | + secretRef: |
| 60 | + name: gcp-filestore-cloud-credentials |
| 61 | + namespace: openshift-cluster-csi-drivers |
| 62 | + providerSpec: |
| 63 | + apiVersion: cloudcredential.openshift.io/v1 |
| 64 | + kind: GCPProviderSpec |
| 65 | + predefinedRoles: |
| 66 | + - roles/file.editor |
| 67 | + - roles/resourcemanager.tagUser |
| 68 | + skipServiceCheck: true |
| 69 | +---- |
| 70 | + |
| 71 | +.. Use the `CredentialsRequest` file to create a {gcp-short} service account by running the following command: |
| 72 | ++ |
| 73 | +[source, terminal] |
| 74 | +---- |
| 75 | +$ ./ccoctl gcp create-service-accounts --name=<filestore-service-account> \// <1> |
| 76 | + --workload-identity-pool=<workload-identity-pool> \// <2> |
| 77 | + --workload-identity-provider=<workload-identity-provider> \// <3> |
| 78 | + --project=<project-id> \// <4> |
| 79 | + --credentials-requests-dir=/tmp/credreq <5> |
| 80 | +---- |
| 81 | +<1> <filestore-service-account> is a user-chosen name. |
| 82 | +<2> <workload-identity-pool> comes from Step 2 above. |
| 83 | +<3> <workload-identity-provider> comes from Step 2 above. |
| 84 | +<4> <project-id> comes from Step 1.a above. |
| 85 | +<5> The name of directory where the `CredentialsRequest` file resides. |
| 86 | ++ |
| 87 | +.Example output |
| 88 | +[source, terminal] |
| 89 | +---- |
| 90 | +2025/02/10 17:47:39 Credentials loaded from gcloud CLI defaults |
| 91 | +2025/02/10 17:47:42 IAM service account filestore-service-account-openshift-gcp-filestore-csi-driver-operator created |
| 92 | +2025/02/10 17:47:44 Unable to add predefined roles to IAM service account, retrying... |
| 93 | +2025/02/10 17:47:59 Updated policy bindings for IAM service account filestore-service-account-openshift-gcp-filestore-csi-driver-operator |
| 94 | +2025/02/10 17:47:59 Saved credentials configuration to: /tmp/install-dir/ <1> |
| 95 | +openshift-cluster-csi-drivers-gcp-filestore-cloud-credentials-credentials.yaml |
| 96 | +---- |
| 97 | +<1> The current directory. |
| 98 | + |
| 99 | +.. Find the service account email of the newly created service account by running the following command: |
| 100 | ++ |
| 101 | +[source, terminal] |
| 102 | +---- |
| 103 | +$ cat /tmp/install-dir/manifests/openshift-cluster-csi-drivers-gcp-filestore-cloud-credentials-credentials.yaml | yq '.data["service_account.json"]' | base64 -d | jq '.service_account_impersonation_url' |
| 104 | +---- |
| 105 | ++ |
| 106 | +.Example output |
| 107 | +[source, terminal] |
| 108 | +---- |
| 109 | +https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/filestore-se-openshift-g-ch8cm@openshift-gce-devel.iam.gserviceaccount.com:generateAccessToken |
| 110 | +---- |
| 111 | ++ |
| 112 | +In this example output, the service account email is `filestore-se-openshift-g-ch8cm@openshift-gce-devel.iam.gserviceaccount.com`. |
| 113 | + |
| 114 | +.Results |
| 115 | + |
| 116 | +You now have the following parameters that you need to install the {gcp-short} Filestore CSI Driver Operator: |
| 117 | + |
| 118 | +* Project number - from Step 1.b |
| 119 | +
|
| 120 | +* Pool ID - from Step 2 |
| 121 | +
|
| 122 | +* Provider ID - from Step 2 |
| 123 | +
|
| 124 | +* Service account email - from Step 3.c |
| 125 | +
|
| 126 | +
|
0 commit comments