15.2. Cloud Credential Operator ユーティリティーを使用した Google Cloud リソースの削除
Google Cloud Workload Identity を使用して手動モードで Cloud Credential Operator (CCO)を使用して OpenShift Container Platform クラスターをアンインストールした後にリソースをクリーンアップするには、CCO ユーティリティー(ccoctl)を使用して、インストール時に ccoctl が作成した Google Cloud リソースを削除します。
前提条件
-
ccoctlバイナリーを展開して準備しておく。 - Google Cloud Workload Identity を使用して手動モードで CCO を使用して OpenShift Container Platform クラスターをインストールします。
手順
以下のコマンドを実行して、OpenShift Container Platform リリースイメージを取得します。
RELEASE_IMAGE=$(./openshift-install version | awk '/release image/ {print $3}')$ RELEASE_IMAGE=$(./openshift-install version | awk '/release image/ {print $3}')Copy to Clipboard Copied! Toggle word wrap Toggle overflow 以下のコマンドを実行して、OpenShift Container Platform リリースイメージから
CredentialsRequestカスタムリソース (CR) のリストを抽出します。oc adm release extract --credentials-requests \ --cloud=gcp \ --to=<path_to_directory_with_list_of_credentials_requests>/credrequests \ $RELEASE_IMAGE
$ oc adm release extract --credentials-requests \ --cloud=gcp \ --to=<path_to_directory_with_list_of_credentials_requests>/credrequests \1 $RELEASE_IMAGECopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
credrequestsは、CredentialsRequestオブジェクトのリストが格納されるディレクトリーです。ディレクトリーが存在しない場合、このコマンドはディレクトリーを作成します。
ccoctlが作成した Google Cloud リソースを削除します。ccoctl gcp delete \ --name=<name> \ --project=<gcp_project_id> \ --credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests
$ ccoctl gcp delete \ --name=<name> \1 --project=<gcp_project_id> \2 --credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequestsCopy to Clipboard Copied! Toggle word wrap Toggle overflow
検証
- リソースが削除されたことを確認するには、Google Cloud にクエリーを実行します。詳細については、Google Cloud のドキュメントを参照してください。