本主題說明如何在 Apigee hybrid 中刪除環境。另請參閱關於環境和環境群組。
如何刪除環境
假設您有兩個環境,分別是 test 和 prod。在覆寫檔案中,定義可能會如下所示:
... envs: - name: test serviceAccountPaths: synchronizer: "your_keypath/synchronizer-manager-service-account.json udca: "your_keypath/analytic-agent-service-account.json - name: prod serviceAccountPaths: synchronizer: "your_keypath/synchronizer-manager-service-account.json udca: "your_keypath/analytic-agent-service-account.json ...
如要刪除 prod 環境,請按照下列步驟操作:
- 取得 gcloud 驗證憑證:
TOKEN=$(gcloud auth print-access-token)
- 從任何相關聯的環境群組中逐一刪除環境:
沒有資料落地
curl -X DELETE -H "Authorization: Bearer $TOKEN" \ "https://apigee.googleapis.com/v1/organizations/$ORG_NAME/envgroups/$ENV_GROUP/attachments/prod"
資料落地
curl -X DELETE -H "Authorization: Bearer $TOKEN" \ "https://$CONTROL_PLANE_LOCATION-apigee.googleapis.com/v1/organizations/$ORG_NAME/envgroups/$ENV_GROUP/attachments/prod"
- 進行模擬測試,以測試移除執行階段元件:
helm delete $ENV_NAME -n APIGEE_NAMESPACE --dry-run=server
--dry-run
指令會傳回與未使用--dry-run
選項的指令相同結果。例如:helm -n apigee delete example-env
release "example-env" uninstalled - 如果模擬測試沒有錯誤,請移除執行階段元件:
helm delete $ENV_NAME -n APIGEE_NAMESPACE
- 開啟覆寫檔案,並從
envs
和virtualhosts
中移除prod
環境定義,只保留 test 定義。例如:... envs: - name: test serviceAccountPaths: synchronizer: "your_keypath/synchronizer-manager-service-account.json udca: "your_keypath/analytic-agent-service-account.json ...
- 儲存檔案。