SaaS 供應商或平台管理員可以使用 App Lifecycle Manager,檢查及更新部署後的 SaaS 產品、單位種類和單位,藉此調整區域、標籤、預設版本和維護固定。這些更新會變更設定中繼資料,但不會觸發基礎架構佈建作業。如要推出基礎架構變更,請參閱「更新 SaaS 產品」。如需概念背景,請參閱「App Lifecycle Manager 總覽」。
事前準備
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
Enable the App Lifecycle Manager API, if it is not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
Install the Google Cloud CLI.
-
Configure the gcloud CLI to use your federated identity.
For more information, see Sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
必要的角色
如要取得查看及更新 App Lifecycle Manager 資源所需的權限,請要求管理員授予您專案的下列 IAM 角色:
-
查看資源:SaaS Service Management 檢視者 (
roles/saasservicemgmt.viewer) -
查看及更新資源:SaaS Service Management 管理員 (
roles/saasservicemgmt.admin)
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
檢查資源
編輯資源前,請先檢查其設定、位置和標籤,確認可以修改哪些屬性。選取下列選項之一:
控制台
前往 Google Cloud 控制台的「SaaS offerings」(SaaS 產品) 頁面:
按一下 SaaS 產品名稱,或在導覽選單中選取「Unit kinds」(單位種類) 或「Units」(單位),然後按一下資源名稱。
gcloud
使用 gcloud app-lifecycle-manager saas list 指令列出 SaaS 產品:
gcloud app-lifecycle-manager saas list --location=LOCATION
將 LOCATION 替換為資源位置,例如 global 或 us-central1。
使用 gcloud app-lifecycle-manager saas describe 指令,說明特定 SaaS 產品:
gcloud app-lifecycle-manager saas describe \
SAAS_OFFERING_NAME --location=LOCATION
更改下列內容:
SAAS_OFFERING_NAME:SaaS 產品名稱LOCATION:資源位置,例如global或us-central1
使用 gcloud app-lifecycle-manager unit-kinds list 指令列出單位種類:
gcloud app-lifecycle-manager unit-kinds list --location=LOCATION
將 LOCATION 替換為資源位置,例如 global 或 us-central1。
使用 gcloud app-lifecycle-manager units list 指令列出單位:
gcloud app-lifecycle-manager units list --location=LOCATION
將 LOCATION 替換為區域位置,例如 us-central1。單位只會儲存在區域位置,不會複製到 global。
如要檢查個別單位種類或單位,請使用 gcloud app-lifecycle-manager unit-kinds describe 指令或 gcloud app-lifecycle-manager units describe 指令。
編輯 SaaS 產品
您可以更新 SaaS 產品的可用區域、標籤,以及連結的 Application Design Center 複合範本。資源名稱和父項位置無法變更。選取下列選項之一:
控制台
前往 Google Cloud 控制台的「SaaS offerings」(SaaS 產品) 頁面:
在「Name」(名稱) 欄中,按一下要更新的 SaaS 產品。
在「SaaS offering details」(SaaS 產品詳細資料) 頁面中,按一下 「Edit」(編輯)。
在「Region」(區域) 清單中,選取或清除區域,然後按一下「OK」(確定),或在「Labels」(標籤) 區段中,新增、編輯或移除鍵/值組合。
按一下「儲存」。
gcloud
使用 gcloud app-lifecycle-manager saas update 指令更新 SaaS 產品的區域或標籤:
gcloud app-lifecycle-manager saas update \
SAAS_OFFERING_NAME --location=LOCATION \
--add-locations=name=REGION \
--update-labels=KEY=VALUE
更改下列內容:
SAAS_OFFERING_NAME:SaaS 產品名稱LOCATION:SaaS 產品的位置REGION:要新增的 Google Cloud 區域,例如europe-west1KEY:要新增或更新的標籤鍵VALUE:要新增或更新的標籤值
如要移除位置或標籤,請傳遞 --remove-locations=name=REGION 或 --remove-labels=KEY。
連結新範本
如果 SaaS 產品未連結任何 App Design Center 複合範本,請連結現有範本或建立新範本:
控制台
- 在「SaaS offering details」(SaaS 產品詳細資料) 頁面的「Connected application template」(連結的應用程式範本) 下方,按一下「Connect existing template」(連結現有範本) 選取現有範本,或按一下「Create new template」(建立新範本),在 App Design Center 中設計範本。
- 按照提示將範本連結至 SaaS 產品。
gcloud
將複合範本的完整資源名稱傳遞至 --application-template,並使用 gcloud app-lifecycle-manager saas update,在來源區域連結複合範本:
gcloud app-lifecycle-manager saas update \
SAAS_OFFERING_NAME --location=LOCATION \
--application-template=projects/PROJECT_ID/locations/LOCATION/spaces/SPACE/applicationTemplates/TEMPLATE_ID
更改下列內容:
SAAS_OFFERING_NAME:SaaS 產品名稱LOCATION:SaaS 產品的來源區域PROJECT_ID: Google Cloud 專案 IDSPACE:App Design Center 空間 IDTEMPLATE_ID:複合範本 ID
更新連結範本
如果已連結 App Design Center 複合式範本,您可以更新範本修訂版本、在設計畫布中編輯範本、更新依附元件,或中斷範本連結:
控制台
- 在「SaaS offering details」(SaaS 產品詳細資料) 頁面的「Connected application template」(連結的應用程式範本) 下方,按一下「Manage template」(管理範本)。
- 選取下列其中一個選項:
- 更新範本修訂版本:選擇要更新至哪個較新的範本修訂版本,並觸發範本重新同步。
- 在畫布中設定:在 App Design Center 畫布中開啟範本,修改元件和設定。
- 編輯依附元件:開啟範本詳細資料,更新其依附元件。
- 取消連結範本:移除範本與 SaaS 產品之間的關聯,但不刪除匯入的資源。
gcloud
將完整的修訂版本資源名稱傳遞至 --application-template-revision,並使用 gcloud app-lifecycle-manager saas update,即可切換來源區域中連結的範本修訂版本:
gcloud app-lifecycle-manager saas update \
SAAS_OFFERING_NAME --location=LOCATION \
--application-template-revision=projects/PROJECT_ID/locations/LOCATION/spaces/SPACE/applicationTemplates/TEMPLATE_ID/revisions/REVISION_ID
更改下列內容:
SAAS_OFFERING_NAME:SaaS 產品名稱LOCATION:SaaS 產品的來源區域PROJECT_ID: Google Cloud 專案 IDSPACE:App Design Center 空間 IDTEMPLATE_ID:複合範本 IDREVISION_ID:範本修訂版本 ID
變更範本修訂版本會觸發範本重新同步,而非僅更新中繼資料。
編輯單元 kind
您可以在 Google Cloud 控制台或使用 Google Cloud CLI,更新單元類型的預設版本和標籤。單元 kind 名稱、上層 SaaS 產品和依附元件均無法變更。如果是從複合範本匯入的單元 kind,請在 App Design Center 中管理依附元件和變數對應。選取下列選項之一:
控制台
前往 Google Cloud 控制台的「Unit kinds」(單位種類) 頁面:
在「Name」(名稱) 欄中,按一下要更新的單位類型。
在「Unit kind details」(單位種類詳細資料) 頁面中,按一下 「Edit」(編輯)。
在「Default release」(預設版本) 清單中,選取版本或「No default release」(無預設版本),然後在「Labels」(標籤) 區段中更新標籤。
按一下「儲存」。
gcloud
使用 gcloud app-lifecycle-manager unit-kinds update 指令更新單位 kind:
gcloud app-lifecycle-manager unit-kinds update \
UNIT_KIND_NAME --location=LOCATION \
--default-release=RELEASE_NAME \
--update-labels=KEY=VALUE
更改下列內容:
UNIT_KIND_NAME:單位種類名稱LOCATION:單位種類的位置RELEASE_NAME:單元的預設版本名稱KEY:要新增或更新的標籤鍵VALUE:要新增或更新的標籤值
如要取消設定預設版本,請在 UNIT_KIND_NAME 後方直接傳遞 --clear-default-release 旗標:
gcloud app-lifecycle-manager unit-kinds update \
UNIT_KIND_NAME --clear-default-release \
--location=LOCATION
編輯單位
您可以更新單元的標籤、租戶關聯和維護固定設定,而不必觸發基礎架構佈建作業。建立後,單位名稱、單位種類和管理模式即無法變更。如要將單元與租戶建立關聯,或重新指派租戶,請參閱「將單元與租戶建立關聯」,或將 --tenant 傳遞至 gcloud app-lifecycle-manager units update。選取下列其中一個選項:
控制台
前往 Google Cloud 控制台的「Units」(單位) 頁面:
在「名稱」欄中,按一下要更新的單位。
在「Unit details」(單位詳細資料) 頁面中,按一下 「Edit」(編輯)。
在「Labels」(標籤) 部分更新鍵/值組合,或是在「Pin Unit」(固定單元) 部分的「Pinned Until」(固定至) 欄位中輸入未來的日期和時間 (如要取消固定單元,請按一下「Clear date」(清除日期))。
按一下「儲存」。
gcloud
使用 gcloud app-lifecycle-manager units update 指令,更新單元的標籤或固定目前的版本:
gcloud app-lifecycle-manager units update UNIT_NAME \
--location=LOCATION \
--update-labels=KEY=VALUE \
--maintenance-pinned-until-time=PINNED_UNTIL_TIME
更改下列內容:
UNIT_NAME:單元名稱LOCATION:裝置的位置KEY:要新增或更新的標籤鍵VALUE:要新增或更新的標籤值PINNED_UNTIL_TIME:RFC 3339 時間戳記,代表推出作業略過升級單位的未來時間,例如2099-12-31T23:59:59Z
如要取消固定,請傳遞過去的時間戳記,例如 --maintenance-pinned-until-time=1970-01-01T00:00:00Z。
驗證資源更新
在 Google Cloud 控制台的資源詳細資料頁面確認變更,或使用 gcloud CLI 描述更新後的資源:
gcloud app-lifecycle-manager units describe UNIT_NAME \
--location=LOCATION
更改下列內容:
UNIT_NAME:單元名稱LOCATION:單元的位置
後續步驟
- 透過版本和推出作業更新 SaaS 產品。
- 刪除不再需要的資源。
- 使用 IAM 設定 App Lifecycle Manager 資源的存取控管機制。