Microsoft.AppPlatform Spring/應用/部署 2023-12-01

備註

注意:Azure Spring 應用程式 Application Deployments(Microsoft.AppPlatform/Spring/apps/deployments)現已棄用,將於 2028-05-31 正式退休。 如需相關資訊,請參閱 https://aka.ms/asaretirement 。

Bicep 資源定義

Spring/apps/deployments 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。

使用範例

Bicep 範例

部署 Spring Cloud Deployment 的基本範例。

param resourceName string = 'acctest0001'
param location string = 'westeurope'

resource spring 'Microsoft.AppPlatform/Spring@2023-05-01-preview' = {
  name: resourceName
  location: location
  sku: {
    name: 'E0'
  }
  properties: {
    zoneRedundant: false
  }
}

resource app 'Microsoft.AppPlatform/Spring/apps@2023-05-01-preview' = {
  name: resourceName
  location: location
  parent: spring
  properties: {
    customPersistentDisks: []
    enableEndToEndTLS: false
    public: false
  }
}

resource deployment 'Microsoft.AppPlatform/Spring/apps/deployments@2023-05-01-preview' = {
  name: resourceName
  parent: app
  sku: {
    capacity: 1
    name: 'E0'
    tier: 'Enterprise'
  }
  properties: {
    deploymentSettings: {
      environmentVariables: {}
    }
    source: {
      customContainer: {
        args: []
        command: []
        containerImage: 'springio/gs-spring-boot-docker'
        languageFramework: ''
        server: 'docker.io'
      }
      type: 'Container'
    }
  }
}

Azure 快速入門範例

以下的 Azure 快速啟動範本 包含用於部署此資源類型的 Bicep 範例。

Bicep 檔 Description
部署一個簡單的Azure Spring 應用程式 微服務應用程式 此範本部署一個簡單的 Azure Spring 應用程式 微服務應用程式,讓它能在 Azure 上執行。

資源格式

若要建立 Microsoft.AppPlatform/Spring/apps/deployments 資源,請將下列 Bicep 新增至範本。

resource symbolicname 'Microsoft.AppPlatform/Spring/apps/deployments@2023-12-01' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    active: bool
    deploymentSettings: {
      addonConfigs: {
        {customized property}: any(...)
      }
      apms: [
        {
          resourceId: 'string'
        }
      ]
      containerProbeSettings: {
        disableProbe: bool
      }
      environmentVariables: {
        {customized property}: 'string'
      }
      livenessProbe: {
        disableProbe: bool
        failureThreshold: int
        initialDelaySeconds: int
        periodSeconds: int
        probeAction: {
          type: 'string'
          // For remaining properties, see ProbeAction objects
        }
        successThreshold: int
        timeoutSeconds: int
      }
      readinessProbe: {
        disableProbe: bool
        failureThreshold: int
        initialDelaySeconds: int
        periodSeconds: int
        probeAction: {
          type: 'string'
          // For remaining properties, see ProbeAction objects
        }
        successThreshold: int
        timeoutSeconds: int
      }
      resourceRequests: {
        cpu: 'string'
        memory: 'string'
      }
      startupProbe: {
        disableProbe: bool
        failureThreshold: int
        initialDelaySeconds: int
        periodSeconds: int
        probeAction: {
          type: 'string'
          // For remaining properties, see ProbeAction objects
        }
        successThreshold: int
        timeoutSeconds: int
      }
      terminationGracePeriodSeconds: int
    }
    source: {
      version: 'string'
      type: 'string'
      // For remaining properties, see UserSourceInfo objects
    }
  }
  sku: {
    capacity: int
    name: 'string'
    tier: 'string'
  }
}

ProbeAction 物件

設置 type 屬性以指定物件的類型。

針對 ExecAction,請使用:

{
  command: [
    'string'
  ]
  type: 'ExecAction'
}

針對 HTTPGetAction,請使用:

{
  path: 'string'
  scheme: 'string'
  type: 'HTTPGetAction'
}

針對 TCPSocketAction,請使用:

{
  type: 'TCPSocketAction'
}

UserSourceInfo 物件

設置 type 屬性以指定物件的類型。

針對 BuildResult,請使用:

{
  buildResultId: 'string'
  type: 'BuildResult'
}

針對 容器,請使用:

{
  customContainer: {
    args: [
      'string'
    ]
    command: [
      'string'
    ]
    containerImage: 'string'
    imageRegistryCredential: {
      password: 'string'
      username: 'string'
    }
    languageFramework: 'string'
    server: 'string'
  }
  type: 'Container'
}

針對 Jar,請使用:

{
  jvmOptions: 'string'
  relativePath: 'string'
  runtimeVersion: 'string'
  type: 'Jar'
}

針對 NetCoreZip,請使用:

{
  netCoreMainEntryPath: 'string'
  relativePath: 'string'
  runtimeVersion: 'string'
  type: 'NetCoreZip'
}

對於 源,請使用:

{
  artifactSelector: 'string'
  relativePath: 'string'
  runtimeVersion: 'string'
  type: 'Source'
}

對於 戰爭,使用:

{
  jvmOptions: 'string'
  relativePath: 'string'
  runtimeVersion: 'string'
  serverVersion: 'string'
  type: 'War'
}

屬性值

Microsoft.AppPlatform/Spring/apps/deployments

Name Description Value
name 資源名稱 字串(必填)
父代 在 Bicep 中,您可以指定子資源的父資源。 只有在父資源外部宣告子資源時,才需要新增這個屬性。

欲了解更多資訊,請參閱 Child 資源 外部 parent resource。
類型的資源符號名稱:Spring/apps
properties 部署資源的屬性 DeploymentResourceProperties
sku 部署資源的 SKU Sku

ApmReference

Name Description Value
resourceId APM 的資源標識碼 字串(必填)

BuildResultUserSourceInfo

Name Description Value
buildResultId 相同 Spring 實例下現有成功建置結果的資源標識碼。 字串
型別 上傳的來源類型 'BuildResult'(必需)

ContainerProbeSettings

Name Description Value
disableProbe 指出是否停用活躍度和整備程度探查 bool

CustomContainer

Name Description Value
args 進入點的自變數。 如果未提供,則會使用 Docker 映像的 CMD。 string[]
command Entrypoint 陣列。 未在殼層內執行。 如果未提供,則會使用 Docker 映像的 ENTRYPOINT。 string[]
containerImage 自訂容器的容器映像。 這應該以 <存放庫>的形式:<標籤>,而不需登錄的伺服器名稱 字串
imageRegistryCredential 映像登錄的認證 ImageRegistryCredential
languageFramework 上傳之容器映像的語言架構。 支援的值:「springboot」、” 字串
伺服器 包含容器映像的登錄名稱 字串

CustomContainerUserSourceInfo

Name Description Value
customContainer 自定義容器承載 CustomContainer
型別 上傳的來源類型 '容器'(必填)

DeploymentResourceProperties

Name Description Value
active 指出部署是否為使用中 bool
deploymentSettings 部署的部署設定 DeploymentSettings
來源 已上傳部署的來源資訊。 UserSourceInfo

DeploymentSettings

Name Description Value
addonConfigs 附加元件集合 DeploymentSettingsAddonConfigs
apms ApmReferences 集合 ApmReference[]
containerProbeSettings 容器活躍度和整備探查設定 ContainerProbeSettings
environmentVariables 環境變數的集合 DeploymentSettingsEnvironmentVariables
livenessProbe 應用程式實例活躍度定期探查。 如果探查失敗,應用程式實例將會重新啟動。 詳細資訊:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes Probe
readinessProbe 定期探查應用程式實例服務整備程度。 如果探查失敗,應用程式實例將會從服務端點中移除。 詳細資訊:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes Probe
resourceRequests 所需 CPU 和記憶體的要求資源數量。 建議使用此欄位來代表所需的 CPU 和記憶體,稍後將會淘汰舊的欄位 cpu 和 memoryInGB。 ResourceRequests
startupProbe StartupProbe 表示應用程式實例已成功初始化。 如果指定,則不會執行其他探查,直到順利完成為止。 如果此探查失敗,Pod 將會重新啟動,就像 livenessProbe 失敗一樣。 這可以用來在應用程式實例生命週期的開頭提供不同的探查參數,這時可能需要很長的時間才能載入數據或將快取暖,而不是在穩定狀態作業期間。 這無法更新。 詳細資訊:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes Probe
terminationGracePeriodSeconds 應用程式實例需要正常終止的秒數選擇性持續時間。 刪除要求可能會減少。 值必須是非負整數。 值零表示透過終止訊號立即停止(沒有機會關閉)。 如果此值為 nil,則會改用預設寬限期。 寬限期是在應用程式實例中執行的進程傳送終止訊號及以終止訊號強制停止進程的時間后,以秒為單位的持續時間。 設定此值的時間超過程式的預期清除時間。 預設值為90秒。 int

DeploymentSettingsAddonConfigs

Name Description Value

DeploymentSettingsEnvironmentVariables

Name Description Value

ExecAction

Name Description Value
command 命令是在容器內執行的命令行,命令的工作目錄是容器文件系統中的根目錄 ('/')。 命令不會在殼層內執行,因此傳統殼層指令 ('|' 等) 將無法運作。 若要使用殼層,您必須明確呼叫該殼層。 結束狀態 0 會被視為即時/健康狀態,且非零狀況不良。 string[]
型別 要採取的動作類型,以執行健康情況檢查。 “ExecAction”(必需)

HttpGetAction

Name Description Value
路徑 HTTP 伺服器上的 access 路徑。 字串
scheme 用於連線到主機的配置。 默認為 HTTP。

可能的列舉值:
- "HTTP" 表示所使用的設定將會 http://
- "HTTPS" 表示所使用的設定將會 https://
'HTTP'
'HTTPS'
型別 要採取的動作類型,以執行健康情況檢查。 'HTTPGetAction'(必需)

ImageRegistryCredential

Name Description Value
密碼 映像登錄認證的密碼 字串
使用者名稱 映像登錄認證的用戶名稱 字串

JarUploadedUserSourceInfo

Name Description Value
jvmOptions JVM 參數 字串
relativePath 儲存來源的 storage 的相對路徑 字串
runtimeVersion Jar 檔案的運行時間版本 字串
型別 上傳的來源類型 'Jar'(必填)

NetCoreZipUploadedUserSourceInfo

Name Description Value
netCoreMainEntryPath 相對於 zip 根的路徑,指向 .NET 執行檔 字串
relativePath 儲存來源的 storage 的相對路徑 字串
runtimeVersion .Net 檔案的執行版本 字串
型別 上傳的來源類型 “NetCoreZip”(必需)

Probe

Name Description Value
disableProbe 指出是否停用探查。 bool(必填)
failureThreshold 探查在成功之後,要視為失敗的最小連續失敗。 最小值為 1。 int
initialDelaySeconds 在啟動探查之前,應用程式實例啟動后的秒數。 詳細資訊:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes int
periodSeconds 執行探查的頻率(以秒為單位)。 最小值為 1。 int
probeAction 探查的動作。 ProbeAction
successThreshold 探查在失敗后要視為成功的最小連續成功。 對於活躍度和啟動,必須是1。 最小值為 1。 int
timeoutSeconds 探查逾時後的秒數。最小值為 1。 int

ProbeAction

Name Description Value
型別 將 類型設定為 'ExecAction',ExecAction。 將 類型設定為 'HTTPGetAction',HttpGetAction。 針對 tcpSocketAction 類型設定為 『TCPSocketAction』,。 'ExecAction'
'HTTPGetAction'
'TCPSocketAction'(必需)

ResourceRequests

Name Description Value
cpu 必要的CPU。 1 個核心可以以 1 或 1000m 表示。 這應該是基本層的 500m 或 1,標準層的 {500m、1、2、3、4} 。 字串
記憶體 必要的記憶體。 1 GB 可由 1Gi 或 1024Mi 表示。 這應該是基本層的 {512Mi、1Gi、2Gi} 和標準層的 {512Mi、1Gi、2Gi、...、8Gi} 。 字串

Sku

Name Description Value
容量 目標資源的目前容量 int
name Sku 的名稱 字串
分層 Sku 的階層 字串

SourceUploadedUserSourceInfo

Name Description Value
artifactSelector 要用於多模組專案的部署成品選取器。 這應該是
指向目標模組/project 的相對路徑。
字串
relativePath 儲存來源的 storage 的相對路徑 字串
runtimeVersion 來源檔案的運行時間版本 字串
型別 上傳的來源類型 “來源”(必填)

TCPSocketAction

Name Description Value
型別 要採取的動作類型,以執行健康情況檢查。 'TCPSocketAction'(必需)

UserSourceInfo

Name Description Value
型別 將 設定為 type BuildResultUserSourceInfo的 'BuildResult'。 針對 customContainerUserSourceInfo 類型 設定為 'Container',。 將 類型設定為 『Jar』 JarUploadedUserSourceInfo。 針對 netCoreZipUploadedUserSourceInfo 類型 設定為 'NetCoreZip',。 針對 sourceUploadedUserSourceInfo 類型 設定為 'Source',。 將類型 WarUploadedUserSourceInfo 設置為“War”。 'BuildResult'
'Container'
'Jar'
'NetCoreZip'
'Source'
“戰爭”(必填)
版本 來源的版本 字串

WarUploadedUserSourceInfo

Name Description Value
jvmOptions JVM 參數 字串
relativePath 儲存來源的 storage 的相對路徑 字串
runtimeVersion War 檔案的運行時間版本 字串
serverVersion 伺服器版本,目前僅支援 Apache Tomcat 字串
型別 上傳的來源類型 “戰爭”(必填)

ARM 樣本資源定義

Spring/apps/deployments 資源類型可以使用目標作業來部署:

使用範例

Azure Quickstart templates

以下的 Azure 快速起始範本部署此資源類型。

Template Description
部署一個簡單的Azure Spring 應用程式 微服務應用程式

部署至Azure
此範本部署一個簡單的 Azure Spring 應用程式 微服務應用程式,讓它能在 Azure 上執行。

資源格式

若要建立 Microsoft.AppPlatform/Spring/apps/deployments 資源,請將下列 JSON 新增至範本。

{
  "type": "Microsoft.AppPlatform/Spring/apps/deployments",
  "apiVersion": "2023-12-01",
  "name": "string",
  "properties": {
    "active": "bool",
    "deploymentSettings": {
      "addonConfigs": {
        "{customized property}": {}
      },
      "apms": [
        {
          "resourceId": "string"
        }
      ],
      "containerProbeSettings": {
        "disableProbe": "bool"
      },
      "environmentVariables": {
        "{customized property}": "string"
      },
      "livenessProbe": {
        "disableProbe": "bool",
        "failureThreshold": "int",
        "initialDelaySeconds": "int",
        "periodSeconds": "int",
        "probeAction": {
          "type": "string"
          // For remaining properties, see ProbeAction objects
        },
        "successThreshold": "int",
        "timeoutSeconds": "int"
      },
      "readinessProbe": {
        "disableProbe": "bool",
        "failureThreshold": "int",
        "initialDelaySeconds": "int",
        "periodSeconds": "int",
        "probeAction": {
          "type": "string"
          // For remaining properties, see ProbeAction objects
        },
        "successThreshold": "int",
        "timeoutSeconds": "int"
      },
      "resourceRequests": {
        "cpu": "string",
        "memory": "string"
      },
      "startupProbe": {
        "disableProbe": "bool",
        "failureThreshold": "int",
        "initialDelaySeconds": "int",
        "periodSeconds": "int",
        "probeAction": {
          "type": "string"
          // For remaining properties, see ProbeAction objects
        },
        "successThreshold": "int",
        "timeoutSeconds": "int"
      },
      "terminationGracePeriodSeconds": "int"
    },
    "source": {
      "version": "string",
      "type": "string"
      // For remaining properties, see UserSourceInfo objects
    }
  },
  "sku": {
    "capacity": "int",
    "name": "string",
    "tier": "string"
  }
}

ProbeAction 物件

設置 type 屬性以指定物件的類型。

針對 ExecAction,請使用:

{
  "command": [ "string" ],
  "type": "ExecAction"
}

針對 HTTPGetAction,請使用:

{
  "path": "string",
  "scheme": "string",
  "type": "HTTPGetAction"
}

針對 TCPSocketAction,請使用:

{
  "type": "TCPSocketAction"
}

UserSourceInfo 物件

設置 type 屬性以指定物件的類型。

針對 BuildResult,請使用:

{
  "buildResultId": "string",
  "type": "BuildResult"
}

針對 容器,請使用:

{
  "customContainer": {
    "args": [ "string" ],
    "command": [ "string" ],
    "containerImage": "string",
    "imageRegistryCredential": {
      "password": "string",
      "username": "string"
    },
    "languageFramework": "string",
    "server": "string"
  },
  "type": "Container"
}

針對 Jar,請使用:

{
  "jvmOptions": "string",
  "relativePath": "string",
  "runtimeVersion": "string",
  "type": "Jar"
}

針對 NetCoreZip,請使用:

{
  "netCoreMainEntryPath": "string",
  "relativePath": "string",
  "runtimeVersion": "string",
  "type": "NetCoreZip"
}

對於 源,請使用:

{
  "artifactSelector": "string",
  "relativePath": "string",
  "runtimeVersion": "string",
  "type": "Source"
}

對於 戰爭,使用:

{
  "jvmOptions": "string",
  "relativePath": "string",
  "runtimeVersion": "string",
  "serverVersion": "string",
  "type": "War"
}

屬性值

Microsoft.AppPlatform/Spring/apps/deployments

Name Description Value
apiVersion API 版本 '2023-12-01'
name 資源名稱 字串(必填)
properties 部署資源的屬性 DeploymentResourceProperties
sku 部署資源的 SKU Sku
型別 資源類型 'Microsoft.AppPlatform/Spring/apps/deployments'

ApmReference

Name Description Value
resourceId APM 的資源標識碼 字串(必填)

BuildResultUserSourceInfo

Name Description Value
buildResultId 相同 Spring 實例下現有成功建置結果的資源標識碼。 字串
型別 上傳的來源類型 'BuildResult'(必需)

ContainerProbeSettings

Name Description Value
disableProbe 指出是否停用活躍度和整備程度探查 bool

CustomContainer

Name Description Value
args 進入點的自變數。 如果未提供,則會使用 Docker 映像的 CMD。 string[]
command Entrypoint 陣列。 未在殼層內執行。 如果未提供,則會使用 Docker 映像的 ENTRYPOINT。 string[]
containerImage 自訂容器的容器映像。 這應該以 <存放庫>的形式:<標籤>,而不需登錄的伺服器名稱 字串
imageRegistryCredential 映像登錄的認證 ImageRegistryCredential
languageFramework 上傳之容器映像的語言架構。 支援的值:「springboot」、” 字串
伺服器 包含容器映像的登錄名稱 字串

CustomContainerUserSourceInfo

Name Description Value
customContainer 自定義容器承載 CustomContainer
型別 上傳的來源類型 '容器'(必填)

DeploymentResourceProperties

Name Description Value
active 指出部署是否為使用中 bool
deploymentSettings 部署的部署設定 DeploymentSettings
來源 已上傳部署的來源資訊。 UserSourceInfo

DeploymentSettings

Name Description Value
addonConfigs 附加元件集合 DeploymentSettingsAddonConfigs
apms ApmReferences 集合 ApmReference[]
containerProbeSettings 容器活躍度和整備探查設定 ContainerProbeSettings
environmentVariables 環境變數的集合 DeploymentSettingsEnvironmentVariables
livenessProbe 應用程式實例活躍度定期探查。 如果探查失敗,應用程式實例將會重新啟動。 詳細資訊:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes Probe
readinessProbe 定期探查應用程式實例服務整備程度。 如果探查失敗,應用程式實例將會從服務端點中移除。 詳細資訊:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes Probe
resourceRequests 所需 CPU 和記憶體的要求資源數量。 建議使用此欄位來代表所需的 CPU 和記憶體,稍後將會淘汰舊的欄位 cpu 和 memoryInGB。 ResourceRequests
startupProbe StartupProbe 表示應用程式實例已成功初始化。 如果指定,則不會執行其他探查,直到順利完成為止。 如果此探查失敗,Pod 將會重新啟動,就像 livenessProbe 失敗一樣。 這可以用來在應用程式實例生命週期的開頭提供不同的探查參數,這時可能需要很長的時間才能載入數據或將快取暖,而不是在穩定狀態作業期間。 這無法更新。 詳細資訊:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes Probe
terminationGracePeriodSeconds 應用程式實例需要正常終止的秒數選擇性持續時間。 刪除要求可能會減少。 值必須是非負整數。 值零表示透過終止訊號立即停止(沒有機會關閉)。 如果此值為 nil,則會改用預設寬限期。 寬限期是在應用程式實例中執行的進程傳送終止訊號及以終止訊號強制停止進程的時間后,以秒為單位的持續時間。 設定此值的時間超過程式的預期清除時間。 預設值為90秒。 int

DeploymentSettingsAddonConfigs

Name Description Value

DeploymentSettingsEnvironmentVariables

Name Description Value

ExecAction

Name Description Value
command 命令是在容器內執行的命令行,命令的工作目錄是容器文件系統中的根目錄 ('/')。 命令不會在殼層內執行,因此傳統殼層指令 ('|' 等) 將無法運作。 若要使用殼層,您必須明確呼叫該殼層。 結束狀態 0 會被視為即時/健康狀態,且非零狀況不良。 string[]
型別 要採取的動作類型,以執行健康情況檢查。 “ExecAction”(必需)

HttpGetAction

Name Description Value
路徑 HTTP 伺服器上的 access 路徑。 字串
scheme 用於連線到主機的配置。 默認為 HTTP。

可能的列舉值:
- "HTTP" 表示所使用的設定將會 http://
- "HTTPS" 表示所使用的設定將會 https://
'HTTP'
'HTTPS'
型別 要採取的動作類型,以執行健康情況檢查。 'HTTPGetAction'(必需)

ImageRegistryCredential

Name Description Value
密碼 映像登錄認證的密碼 字串
使用者名稱 映像登錄認證的用戶名稱 字串

JarUploadedUserSourceInfo

Name Description Value
jvmOptions JVM 參數 字串
relativePath 儲存來源的 storage 的相對路徑 字串
runtimeVersion Jar 檔案的運行時間版本 字串
型別 上傳的來源類型 'Jar'(必填)

NetCoreZipUploadedUserSourceInfo

Name Description Value
netCoreMainEntryPath 相對於 zip 根的路徑,指向 .NET 執行檔 字串
relativePath 儲存來源的 storage 的相對路徑 字串
runtimeVersion .Net 檔案的執行版本 字串
型別 上傳的來源類型 “NetCoreZip”(必需)

Probe

Name Description Value
disableProbe 指出是否停用探查。 bool(必填)
failureThreshold 探查在成功之後,要視為失敗的最小連續失敗。 最小值為 1。 int
initialDelaySeconds 在啟動探查之前,應用程式實例啟動后的秒數。 詳細資訊:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes int
periodSeconds 執行探查的頻率(以秒為單位)。 最小值為 1。 int
probeAction 探查的動作。 ProbeAction
successThreshold 探查在失敗后要視為成功的最小連續成功。 對於活躍度和啟動,必須是1。 最小值為 1。 int
timeoutSeconds 探查逾時後的秒數。最小值為 1。 int

ProbeAction

Name Description Value
型別 將 類型設定為 'ExecAction',ExecAction。 將 類型設定為 'HTTPGetAction',HttpGetAction。 針對 tcpSocketAction 類型設定為 『TCPSocketAction』,。 'ExecAction'
'HTTPGetAction'
'TCPSocketAction'(必需)

ResourceRequests

Name Description Value
cpu 必要的CPU。 1 個核心可以以 1 或 1000m 表示。 這應該是基本層的 500m 或 1,標準層的 {500m、1、2、3、4} 。 字串
記憶體 必要的記憶體。 1 GB 可由 1Gi 或 1024Mi 表示。 這應該是基本層的 {512Mi、1Gi、2Gi} 和標準層的 {512Mi、1Gi、2Gi、...、8Gi} 。 字串

Sku

Name Description Value
容量 目標資源的目前容量 int
name Sku 的名稱 字串
分層 Sku 的階層 字串

SourceUploadedUserSourceInfo

Name Description Value
artifactSelector 要用於多模組專案的部署成品選取器。 這應該是
指向目標模組/project 的相對路徑。
字串
relativePath 儲存來源的 storage 的相對路徑 字串
runtimeVersion 來源檔案的運行時間版本 字串
型別 上傳的來源類型 “來源”(必填)

TCPSocketAction

Name Description Value
型別 要採取的動作類型,以執行健康情況檢查。 'TCPSocketAction'(必需)

UserSourceInfo

Name Description Value
型別 將 設定為 type BuildResultUserSourceInfo的 'BuildResult'。 針對 customContainerUserSourceInfo 類型 設定為 'Container',。 將 類型設定為 『Jar』 JarUploadedUserSourceInfo。 針對 netCoreZipUploadedUserSourceInfo 類型 設定為 'NetCoreZip',。 針對 sourceUploadedUserSourceInfo 類型 設定為 'Source',。 將類型 WarUploadedUserSourceInfo 設置為“War”。 'BuildResult'
'Container'
'Jar'
'NetCoreZip'
'Source'
“戰爭”(必填)
版本 來源的版本 字串

WarUploadedUserSourceInfo

Name Description Value
jvmOptions JVM 參數 字串
relativePath 儲存來源的 storage 的相對路徑 字串
runtimeVersion War 檔案的運行時間版本 字串
serverVersion 伺服器版本,目前僅支援 Apache Tomcat 字串
型別 上傳的來源類型 “戰爭”(必填)

Terraform (AzAPI 提供者) 資源定義

Spring/apps/deployments 資源類型可以使用目標作業來部署:

  • 資源團體 關於每個 API 版本變更屬性的清單,請參見 變更日誌。

使用範例

Terraform 範例

部署 Spring Cloud Deployment 的基本範例。

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "Spring" {
  type      = "Microsoft.AppPlatform/Spring@2023-05-01-preview"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      zoneRedundant = false
    }
    sku = {
      name = "E0"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "app" {
  type      = "Microsoft.AppPlatform/Spring/apps@2023-05-01-preview"
  parent_id = azapi_resource.Spring.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      customPersistentDisks = [
      ]
      enableEndToEndTLS = false
      public            = false
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "deployment" {
  type      = "Microsoft.AppPlatform/Spring/apps/deployments@2023-05-01-preview"
  parent_id = azapi_resource.app.id
  name      = var.resource_name
  body = {
    properties = {
      deploymentSettings = {
        environmentVariables = {
        }
      }
      source = {
        customContainer = {
          args = [
          ]
          command = [
          ]
          containerImage    = "springio/gs-spring-boot-docker"
          languageFramework = ""
          server            = "docker.io"
        }
        type = "Container"
      }
    }
    sku = {
      capacity = 1
      name     = "E0"
      tier     = "Enterprise"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

資源格式

若要建立 Microsoft.AppPlatform/Spring/apps/deployments 資源,請將下列 Terraform 新增至範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.AppPlatform/Spring/apps/deployments@2023-12-01"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      active = bool
      deploymentSettings = {
        addonConfigs = {
          {customized property} = ?
        }
        apms = [
          {
            resourceId = "string"
          }
        ]
        containerProbeSettings = {
          disableProbe = bool
        }
        environmentVariables = {
          {customized property} = "string"
        }
        livenessProbe = {
          disableProbe = bool
          failureThreshold = int
          initialDelaySeconds = int
          periodSeconds = int
          probeAction = {
            type = "string"
            // For remaining properties, see ProbeAction objects
          }
          successThreshold = int
          timeoutSeconds = int
        }
        readinessProbe = {
          disableProbe = bool
          failureThreshold = int
          initialDelaySeconds = int
          periodSeconds = int
          probeAction = {
            type = "string"
            // For remaining properties, see ProbeAction objects
          }
          successThreshold = int
          timeoutSeconds = int
        }
        resourceRequests = {
          cpu = "string"
          memory = "string"
        }
        startupProbe = {
          disableProbe = bool
          failureThreshold = int
          initialDelaySeconds = int
          periodSeconds = int
          probeAction = {
            type = "string"
            // For remaining properties, see ProbeAction objects
          }
          successThreshold = int
          timeoutSeconds = int
        }
        terminationGracePeriodSeconds = int
      }
      source = {
        version = "string"
        type = "string"
        // For remaining properties, see UserSourceInfo objects
      }
    }
    sku = {
      capacity = int
      name = "string"
      tier = "string"
    }
  }
}

ProbeAction 物件

設置 type 屬性以指定物件的類型。

針對 ExecAction,請使用:

{
  command = [
    "string"
  ]
  type = "ExecAction"
}

針對 HTTPGetAction,請使用:

{
  path = "string"
  scheme = "string"
  type = "HTTPGetAction"
}

針對 TCPSocketAction,請使用:

{
  type = "TCPSocketAction"
}

UserSourceInfo 物件

設置 type 屬性以指定物件的類型。

針對 BuildResult,請使用:

{
  buildResultId = "string"
  type = "BuildResult"
}

針對 容器,請使用:

{
  customContainer = {
    args = [
      "string"
    ]
    command = [
      "string"
    ]
    containerImage = "string"
    imageRegistryCredential = {
      password = "string"
      username = "string"
    }
    languageFramework = "string"
    server = "string"
  }
  type = "Container"
}

針對 Jar,請使用:

{
  jvmOptions = "string"
  relativePath = "string"
  runtimeVersion = "string"
  type = "Jar"
}

針對 NetCoreZip,請使用:

{
  netCoreMainEntryPath = "string"
  relativePath = "string"
  runtimeVersion = "string"
  type = "NetCoreZip"
}

對於 源,請使用:

{
  artifactSelector = "string"
  relativePath = "string"
  runtimeVersion = "string"
  type = "Source"
}

對於 戰爭,使用:

{
  jvmOptions = "string"
  relativePath = "string"
  runtimeVersion = "string"
  serverVersion = "string"
  type = "War"
}

屬性值

Microsoft.AppPlatform/Spring/apps/deployments

Name Description Value
name 資源名稱 字串(必填)
parent_id 此資源為父系之資源的標識碼。 類型資源的標識碼:Spring/apps
properties 部署資源的屬性 DeploymentResourceProperties
sku 部署資源的 SKU Sku
型別 資源類型 "Microsoft.AppPlatform/Spring/apps/deployments@2023-12-01"

ApmReference

Name Description Value
resourceId APM 的資源標識碼 字串(必填)

BuildResultUserSourceInfo

Name Description Value
buildResultId 相同 Spring 實例下現有成功建置結果的資源標識碼。 字串
型別 上傳的來源類型 'BuildResult'(必需)

ContainerProbeSettings

Name Description Value
disableProbe 指出是否停用活躍度和整備程度探查 bool

CustomContainer

Name Description Value
args 進入點的自變數。 如果未提供,則會使用 Docker 映像的 CMD。 string[]
command Entrypoint 陣列。 未在殼層內執行。 如果未提供,則會使用 Docker 映像的 ENTRYPOINT。 string[]
containerImage 自訂容器的容器映像。 這應該以 <存放庫>的形式:<標籤>,而不需登錄的伺服器名稱 字串
imageRegistryCredential 映像登錄的認證 ImageRegistryCredential
languageFramework 上傳之容器映像的語言架構。 支援的值:「springboot」、” 字串
伺服器 包含容器映像的登錄名稱 字串

CustomContainerUserSourceInfo

Name Description Value
customContainer 自定義容器承載 CustomContainer
型別 上傳的來源類型 '容器'(必填)

DeploymentResourceProperties

Name Description Value
active 指出部署是否為使用中 bool
deploymentSettings 部署的部署設定 DeploymentSettings
來源 已上傳部署的來源資訊。 UserSourceInfo

DeploymentSettings

Name Description Value
addonConfigs 附加元件集合 DeploymentSettingsAddonConfigs
apms ApmReferences 集合 ApmReference[]
containerProbeSettings 容器活躍度和整備探查設定 ContainerProbeSettings
environmentVariables 環境變數的集合 DeploymentSettingsEnvironmentVariables
livenessProbe 應用程式實例活躍度定期探查。 如果探查失敗,應用程式實例將會重新啟動。 詳細資訊:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes Probe
readinessProbe 定期探查應用程式實例服務整備程度。 如果探查失敗,應用程式實例將會從服務端點中移除。 詳細資訊:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes Probe
resourceRequests 所需 CPU 和記憶體的要求資源數量。 建議使用此欄位來代表所需的 CPU 和記憶體,稍後將會淘汰舊的欄位 cpu 和 memoryInGB。 ResourceRequests
startupProbe StartupProbe 表示應用程式實例已成功初始化。 如果指定,則不會執行其他探查,直到順利完成為止。 如果此探查失敗,Pod 將會重新啟動,就像 livenessProbe 失敗一樣。 這可以用來在應用程式實例生命週期的開頭提供不同的探查參數,這時可能需要很長的時間才能載入數據或將快取暖,而不是在穩定狀態作業期間。 這無法更新。 詳細資訊:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes Probe
terminationGracePeriodSeconds 應用程式實例需要正常終止的秒數選擇性持續時間。 刪除要求可能會減少。 值必須是非負整數。 值零表示透過終止訊號立即停止(沒有機會關閉)。 如果此值為 nil,則會改用預設寬限期。 寬限期是在應用程式實例中執行的進程傳送終止訊號及以終止訊號強制停止進程的時間后,以秒為單位的持續時間。 設定此值的時間超過程式的預期清除時間。 預設值為90秒。 int

DeploymentSettingsAddonConfigs

Name Description Value

DeploymentSettingsEnvironmentVariables

Name Description Value

ExecAction

Name Description Value
command 命令是在容器內執行的命令行,命令的工作目錄是容器文件系統中的根目錄 ('/')。 命令不會在殼層內執行,因此傳統殼層指令 ('|' 等) 將無法運作。 若要使用殼層,您必須明確呼叫該殼層。 結束狀態 0 會被視為即時/健康狀態,且非零狀況不良。 string[]
型別 要採取的動作類型,以執行健康情況檢查。 “ExecAction”(必需)

HttpGetAction

Name Description Value
路徑 HTTP 伺服器上的 access 路徑。 字串
scheme 用於連線到主機的配置。 默認為 HTTP。

可能的列舉值:
- "HTTP" 表示所使用的設定將會 http://
- "HTTPS" 表示所使用的設定將會 https://
'HTTP'
'HTTPS'
型別 要採取的動作類型,以執行健康情況檢查。 'HTTPGetAction'(必需)

ImageRegistryCredential

Name Description Value
密碼 映像登錄認證的密碼 字串
使用者名稱 映像登錄認證的用戶名稱 字串

JarUploadedUserSourceInfo

Name Description Value
jvmOptions JVM 參數 字串
relativePath 儲存來源的 storage 的相對路徑 字串
runtimeVersion Jar 檔案的運行時間版本 字串
型別 上傳的來源類型 'Jar'(必填)

NetCoreZipUploadedUserSourceInfo

Name Description Value
netCoreMainEntryPath 相對於 zip 根的路徑,指向 .NET 執行檔 字串
relativePath 儲存來源的 storage 的相對路徑 字串
runtimeVersion .Net 檔案的執行版本 字串
型別 上傳的來源類型 “NetCoreZip”(必需)

Probe

Name Description Value
disableProbe 指出是否停用探查。 bool(必填)
failureThreshold 探查在成功之後,要視為失敗的最小連續失敗。 最小值為 1。 int
initialDelaySeconds 在啟動探查之前,應用程式實例啟動后的秒數。 詳細資訊:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes int
periodSeconds 執行探查的頻率(以秒為單位)。 最小值為 1。 int
probeAction 探查的動作。 ProbeAction
successThreshold 探查在失敗后要視為成功的最小連續成功。 對於活躍度和啟動,必須是1。 最小值為 1。 int
timeoutSeconds 探查逾時後的秒數。最小值為 1。 int

ProbeAction

Name Description Value
型別 將 類型設定為 'ExecAction',ExecAction。 將 類型設定為 'HTTPGetAction',HttpGetAction。 針對 tcpSocketAction 類型設定為 『TCPSocketAction』,。 'ExecAction'
'HTTPGetAction'
'TCPSocketAction'(必需)

ResourceRequests

Name Description Value
cpu 必要的CPU。 1 個核心可以以 1 或 1000m 表示。 這應該是基本層的 500m 或 1,標準層的 {500m、1、2、3、4} 。 字串
記憶體 必要的記憶體。 1 GB 可由 1Gi 或 1024Mi 表示。 這應該是基本層的 {512Mi、1Gi、2Gi} 和標準層的 {512Mi、1Gi、2Gi、...、8Gi} 。 字串

Sku

Name Description Value
容量 目標資源的目前容量 int
name Sku 的名稱 字串
分層 Sku 的階層 字串

SourceUploadedUserSourceInfo

Name Description Value
artifactSelector 要用於多模組專案的部署成品選取器。 這應該是
指向目標模組/project 的相對路徑。
字串
relativePath 儲存來源的 storage 的相對路徑 字串
runtimeVersion 來源檔案的運行時間版本 字串
型別 上傳的來源類型 “來源”(必填)

TCPSocketAction

Name Description Value
型別 要採取的動作類型,以執行健康情況檢查。 'TCPSocketAction'(必需)

UserSourceInfo

Name Description Value
型別 將 設定為 type BuildResultUserSourceInfo的 'BuildResult'。 針對 customContainerUserSourceInfo 類型 設定為 'Container',。 將 類型設定為 『Jar』 JarUploadedUserSourceInfo。 針對 netCoreZipUploadedUserSourceInfo 類型 設定為 'NetCoreZip',。 針對 sourceUploadedUserSourceInfo 類型 設定為 'Source',。 將類型 WarUploadedUserSourceInfo 設置為“War”。 'BuildResult'
'Container'
'Jar'
'NetCoreZip'
'Source'
“戰爭”(必填)
版本 來源的版本 字串

WarUploadedUserSourceInfo

Name Description Value
jvmOptions JVM 參數 字串
relativePath 儲存來源的 storage 的相對路徑 字串
runtimeVersion War 檔案的運行時間版本 字串
serverVersion 伺服器版本,目前僅支援 Apache Tomcat 字串
型別 上傳的來源類型 “戰爭”(必填)