Skip to content

Commit 3f147c0

Browse files
bhandarivijay-pngakinfermo
authored andcommitted
chore:Migrate gsutil usage to gcloud storage
1 parent d81f9de commit 3f147c0

10 files changed

Lines changed: 38 additions & 39 deletions

File tree

docs/content/data-migration/automated-dataguard.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ for more instructions.
406406

407407
```sh
408408
export GCS_BUCKET=<your globally unique Google Cloud Storage bucket name>
409-
gsutil mb gs://$GCS_BUCKET
410-
gsutil cp <path to the Oracle database password file> gs://$GCS_BUCKET/password/orapw<primary SID>
409+
gcloud storage buckets create gs://$GCS_BUCKET
410+
gcloud storage cp <path to the Oracle database password file> gs://$GCS_BUCKET/password/orapw<primary SID>
411411
```
412412

413413
2. Find the GCP service account for El Carro instance in GKE, see
@@ -421,7 +421,7 @@ for more instructions.
421421
GCP service account
422422

423423
```sh
424-
gsutil iam ch serviceAccount:${INSTANCE_GCP_SA}:roles/storage.objectViewer gs://$GCS_BUCKET
424+
gcloud storage buckets add-iam-policy-binding gs://$GCS_BUCKET --member=serviceAccount:${INSTANCE_GCP_SA} --role=roles/storage.objectViewer
425425
```
426426

427427
4. Update `.spec.replicationSettings.passwordFileURI` to point to the uploaded
@@ -443,8 +443,8 @@ for more instructions.
443443

444444
```sh
445445
export GCS_BUCKET=<your globally unique Google Cloud Storage bucket name>
446-
gsutil mb gs://$GCS_BUCKET
447-
gsutil -m cp <path to the full backup> gs://$GCS_BUCKET/backup
446+
gcloud storage buckets create gs://$GCS_BUCKET
447+
gcloud storage cp <path to the full backup> gs://$GCS_BUCKET/backup
448448
```
449449

450450
2. Find the GCP service account for El Carro in GKE, see
@@ -458,7 +458,7 @@ for more instructions.
458458
GCP service account
459459

460460
```sh
461-
gsutil iam ch serviceAccount:${INSTANCE_GCP_SA}:roles/storage.objectViewer gs://$GCS_BUCKET
461+
gcloud storage buckets add-iam-policy-binding gs://$GCS_BUCKET --member=serviceAccount:${INSTANCE_GCP_SA} --role=roles/storage.objectViewer
462462
```
463463

464464
4. Update `.spec.replicationSettings.backupURI` to point to the uploaded backup
@@ -470,4 +470,3 @@ for more instructions.
470470
```
471471

472472
Then El Carro is able to download the backup.
473-

docs/content/preparation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ release, from this [GCS bucket](https://console.cloud.google.com/storage/browser
5454
using [gsutil](https://cloud.google.com/storage/docs/gsutil).
5555
5656
```sh
57-
gsutil -m cp -r gs://elcarro/latest .
57+
gcloud storage cp --recursive gs://elcarro/latest .
5858
Copying gs://elcarro/...
5959
...
6060

docs/content/provision/image.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ Google Cloud Build* or *building the image locally using Docker*.
5959
needed, a new Google Cloud Storage bucket can be created as follows:
6060

6161
```sh
62-
gsutil mb gs://${GCS_BUCKET}
63-
gsutil cp ~/Downloads/linuxx64_12201_database.zip gs://${GCS_BUCKET}/install/
64-
gsutil cp ~/Downloads/p6880880_200000_LINUX.zip gs://${GCS_BUCKET}/install/
65-
gsutil cp ~/Downloads/p32228578_122010_Linux-x86-64.zip gs://${GCS_BUCKET}/install/
62+
gcloud storage buckets create gs://${GCS_BUCKET}
63+
gcloud storage cp ~/Downloads/linuxx64_12201_database.zip gs://${GCS_BUCKET}/install/
64+
gcloud storage cp ~/Downloads/p6880880_200000_LINUX.zip gs://${GCS_BUCKET}/install/
65+
gcloud storage cp ~/Downloads/p32228578_122010_Linux-x86-64.zip gs://${GCS_BUCKET}/install/
6666
```
6767

6868
This is an example of how the three files in a Google Cloud Storage bucket
6969
could look like on the command line and in the Google Cloud Console:
7070

7171
```sh
72-
gsutil ls -l gs://${GCS_BUCKET}/install
72+
gcloud storage ls --long gs://${GCS_BUCKET}/install
7373
0 2020-10-13T19:24:05Z gs://${GCS_BUCKET}/install/
7474
3453696911 2020-10-13T19:24:24Z gs://${GCS_BUCKET}/install/linuxx64_12201_database.zip
7575
856130787 2020-10-13T19:37:29Z gs://${GCS_BUCKET}/install/p32228578_122010_Linux-x86-64.zip
@@ -83,7 +83,7 @@ Google Cloud Build* or *building the image locally using Docker*.
8383

8484
```sh
8585
export PROJECT_NUMBER=$(gcloud projects describe ${PROJECT_ID} --format="value(projectNumber)")
86-
gsutil iam ch serviceAccount:${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com:roles/storage.objectViewer gs://${GCS_BUCKET}
86+
gcloud storage buckets add-iam-policy-binding gs://${GCS_BUCKET} --member=serviceAccount:${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com --role=roles/storage.objectViewer
8787
```
8888

8989
2. Trigger the Google Cloud Build (GCB) pipeline.
@@ -140,7 +140,7 @@ Google Cloud Build* or *building the image locally using Docker*.
140140
~40+ minutes.
141141

142142
If AccessDeniedException is raised against the above command that likely
143-
means that the previous gsutil iam ch command didn't succeed. Once fixed,
143+
means that the previous gcloud storage buckets add-iam-policy-binding command didn't succeed. Once fixed,
144144
rerun the above image build script.
145145
146146
3. Verify that your containerized database image was successfully created.

docs/content/quickstart-12c-ee.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Download El Carro software to your workstation as follows:
4646
[gsutil](https://cloud.google.com/storage/docs/gsutil).
4747

4848
```sh
49-
gsutil -m cp -r gs://elcarro/latest $PATH_TO_EL_CARRO_RELEASE
49+
gcloud storage cp --recursive gs://elcarro/latest $PATH_TO_EL_CARRO_RELEASE
5050
```
5151

5252
[Create a new GCP project](https://cloud.google.com/resource-manager/docs/creating-managing-projects)
@@ -195,11 +195,11 @@ Cloud Build or building the image locally using Docker.
195195
can be created as follows:
196196
197197
```sh
198-
gsutil mb gs://$GCS_BUCKET
198+
gcloud storage buckets create gs://$GCS_BUCKET
199199
200-
gsutil cp ~/Downloads/V839960-01.zip gs://$GCS_BUCKET/install/
201-
gsutil cp ~/Downloads/p6880880_200000_Linux-x86-64.zip gs://$GCS_BUCKET/install/
202-
gsutil cp ~/Downloads/p32228578_122010_Linux-x86-64.zip gs://$GCS_BUCKET/install/
200+
gcloud storage cp ~/Downloads/V839960-01.zip gs://$GCS_BUCKET/install/
201+
gcloud storage cp ~/Downloads/p6880880_200000_Linux-x86-64.zip gs://$GCS_BUCKET/install/
202+
gcloud storage cp ~/Downloads/p32228578_122010_Linux-x86-64.zip gs://$GCS_BUCKET/install/
203203
```
204204
205205
Once the bucket is ready, grant the IAM read privilege
@@ -209,7 +209,7 @@ Cloud Build or building the image locally using Docker.
209209
210210
```sh
211211
export PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")
212-
gsutil iam ch serviceAccount:${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com:roles/storage.objectViewer gs://$GCS_BUCKET
212+
gcloud storage buckets add-iam-policy-binding gs://$GCS_BUCKET --member=serviceAccount:${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com --role=roles/storage.objectViewer
213213
```
214214
215215
3. Trigger the Google Cloud Build pipeline
@@ -233,8 +233,8 @@ Cloud Build or building the image locally using Docker.
233233
```
234234
235235
If **AccessDeniedException** is raised against the above command, it's
236-
likely because the previous `gsutil iam ch` command didn’t succeed. We
237-
suggest you rerun the `gsutil` command and ensure that the Cloud build
236+
likely because the previous `gcloud storage buckets add-iam-policy-binding` command didn’t succeed. We
237+
suggest you rerun the `gcloud storage` command and ensure that the Cloud build
238238
service account has the read privilege on the GCS bucket that contains the
239239
Oracle software.
240240

docs/content/quickstart-18c-xe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ release, from this [GCS bucket](https://console.cloud.google.com/storage/browser
4040
using [gsutil](https://cloud.google.com/storage/docs/gsutil).
4141

4242
```sh
43-
gsutil -m cp -r gs://elcarro/latest $PATH_TO_EL_CARRO_RELEASE
43+
gcloud storage cp --recursive gs://elcarro/latest $PATH_TO_EL_CARRO_RELEASE
4444
```
4545

4646
[Create a new GCP project](https://cloud.google.com/resource-manager/docs/creating-managing-projects)

docs/content/quickstart-19c-ee.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Download El Carro software to your workstation as follows:
4646
[gsutil](https://cloud.google.com/storage/docs/gsutil).
4747

4848
```sh
49-
gsutil -m cp -r gs://elcarro/latest $PATH_TO_EL_CARRO_RELEASE
49+
gcloud storage cp --recursive gs://elcarro/latest $PATH_TO_EL_CARRO_RELEASE
5050
```
5151

5252
[Create a new GCP project](https://cloud.google.com/resource-manager/docs/creating-managing-projects)
@@ -194,11 +194,11 @@ software from Oracle's website:
194194
can be created as follows:
195195
196196
```sh
197-
gsutil mb gs://$GCS_BUCKET
197+
gcloud storage buckets create gs://$GCS_BUCKET
198198
199-
gsutil cp ~/Downloads/LINUX.X64_193000_db_home.zip gs://$GCS_BUCKET/install/
200-
gsutil cp ~/Downloads/p6880880_200000_Linux-x86-64.zip gs://$GCS_BUCKET/install/
201-
gsutil cp ~/Downloads/p32545013_190000_Linux-x86-64.zip gs://$GCS_BUCKET/install/
199+
gcloud storage cp ~/Downloads/LINUX.X64_193000_db_home.zip gs://$GCS_BUCKET/install/
200+
gcloud storage cp ~/Downloads/p6880880_200000_Linux-x86-64.zip gs://$GCS_BUCKET/install/
201+
gcloud storage cp ~/Downloads/p32545013_190000_Linux-x86-64.zip gs://$GCS_BUCKET/install/
202202
```
203203
204204
Once the bucket is ready, grant the IAM read privilege
@@ -208,7 +208,7 @@ software from Oracle's website:
208208
209209
```sh
210210
export PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")
211-
gsutil iam ch serviceAccount:${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com:roles/storage.objectViewer gs://$GCS_BUCKET
211+
gcloud storage buckets add-iam-policy-binding gs://$GCS_BUCKET --member=serviceAccount:${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com --role=roles/storage.objectViewer
212212
```
213213
214214
3. Trigger the Google Cloud Build pipeline
@@ -232,8 +232,8 @@ software from Oracle's website:
232232
```
233233
234234
If **AccessDeniedException** is raised against the above command, it's
235-
likely because the previous `gsutil iam ch` command didn’t succeed. We
236-
suggest you rerun the `gsutil` command and ensure that the Cloud build
235+
likely because the previous `gcloud storage buckets add-iam-policy-binding` command didn’t succeed. We
236+
suggest you rerun the `gcloud storage` command and ensure that the Cloud build
237237
service account has the read privilege on the GCS bucket that contains the
238238
Oracle software.
239239

docs/content/recovery/point-in-time-recovery.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ This procedure enables point-in-time recovery for an existing El Carro instance.
4747
Grant permissions using the appropriate service account:
4848
4949
```shell
50-
gsutil iam ch serviceAccount:$SERVICE_ACCOUNT:admin $PITR_STORAGE_URI
50+
gcloud storage buckets add-iam-policy-binding $PITR_STORAGE_URI --member=serviceAccount:$SERVICE_ACCOUNT --role=admin
5151
```
5252
5353
TIPs: you can also use the [configure-service-account.sh](https://github.com/GoogleCloudPlatform/elcarro-oracle-operator/blob/main/hack/configure-service-account.sh) script to find out which service account to grant permission for if workload identity is disabled. Or specify an existing service account to for El Carro to use if workload identity is enabled.

docs/contributors/dev-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ but take considerably less time on subsequent runs.
118118
```
119119
8. Give your default Service Account permission to access your freshly built images
120120
```sh
121-
$ gsutil iam ch serviceAccount:$(gcloud projects describe ${PROJECT_ID} --format="value(projectNumber)")-compute@developer.gserviceaccount.com:objectViewer gs://artifacts.${PROJECT_ID}.appspot.com
121+
$ gcloud storage buckets add-iam-policy-binding gs://artifacts.${PROJECT_ID}.appspot.com --member=serviceAccount:$(gcloud projects describe ${PROJECT_ID} --format="value(projectNumber)")-compute@developer.gserviceaccount.com --role=roles/storage.objectViewer
122122
```
123123
9. Deploy the El Carro Operator
124124
```sh

oracle/scripts/deploy/install-18c-xe.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ function create_cluster() {
140140
--member serviceAccount:${GKE_SA_EMAIL} \
141141
--role roles/logging.logWriter
142142

143-
readonly GCR_GCS_PATH=$(gsutil ls | grep -E '^gs://artifacts.*appspot.com/$')
143+
readonly GCR_GCS_PATH=$(gcloud storage ls | grep -E '^gs://artifacts.*appspot.com/$')
144144
echo "adding project container repository bucket ${GCR_GCS_PATH} read permission to ${GKE_SA_EMAIL}"
145-
gsutil iam ch serviceAccount:${GKE_SA_EMAIL}:roles/storage.objectViewer "${GCR_GCS_PATH}"
145+
gcloud storage buckets add-iam-policy-binding "${GCR_GCS_PATH}" --member="serviceAccount:${GKE_SA_EMAIL}" --role="roles/storage.objectViewer"
146146

147147
gcloud beta container clusters create ${CLUSTER_NAME} --release-channel rapid \
148148
--machine-type=n1-standard-2 --num-nodes 2 --zone ${ZONE} \

oracle/scripts/deploy/install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ function create_cluster() {
171171
--member serviceAccount:${GKE_SA_EMAIL} \
172172
--role roles/logging.logWriter
173173

174-
readonly GCR_GCS_PATH=$(gsutil ls | grep -E '^gs://artifacts.*appspot.com/$')
174+
readonly GCR_GCS_PATH=$(gcloud storage ls | grep -E '^gs://artifacts.*appspot.com/$')
175175
echo "adding project container repository bucket ${GCR_GCS_PATH} read permission to ${GKE_SA_EMAIL}"
176-
gsutil iam ch serviceAccount:${GKE_SA_EMAIL}:roles/storage.objectViewer "${GCR_GCS_PATH}"
176+
gcloud storage buckets add-iam-policy-binding "${GCR_GCS_PATH}" --member="serviceAccount:${GKE_SA_EMAIL}" --role="roles/storage.objectViewer"
177177

178178
gcloud beta container clusters create ${CLUSTER_NAME} --release-channel rapid \
179179
--machine-type=n1-standard-2 --num-nodes 2 --zone ${ZONE} \
@@ -204,7 +204,7 @@ function build_image() {
204204

205205
# strip off part of the path after the bucket: gs://bucket/dir1/dir becomes gs://bucket
206206
local -r GCS_BUCKET="gs://$(echo ${GCS_PATH} | tr "/" "\n" | head -n3 | tail -n1)"
207-
gsutil iam ch serviceAccount:$(gcloud projects describe ${PROJECT} --format="value(projectNumber)")@cloudbuild.gserviceaccount.com:roles/storage.objectViewer "${GCS_BUCKET}"
207+
gcloud storage buckets add-iam-policy-binding "${GCS_BUCKET}" --member="serviceAccount:$(gcloud projects describe ${PROJECT} --format="value(projectNumber)")@cloudbuild.gserviceaccount.com" --role="roles/storage.objectViewer"
208208

209209
pushd "${RELEASE_DIR}/dbimage" > /dev/null
210210
bash image_build.sh --install_path="${GCS_PATH}" --db_version="${DB_VERSION}" --mem_pct=45 --create_cdb=true --cdb_name="${CDB_NAME}" --no_dry_run

0 commit comments

Comments
 (0)