此文件提供內建的「特徵(Traits)」參考資訊。
Container
容器工作負載的基礎特徵。
Schema
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
type | ”container” | V | | 特徵型別名稱。 |
image | string | V | | 容器映像名稱。 |
imagePullPolicy | string | | | 容器映像下載的原則。“Always”, “Never”, “IfNotPresent” |
imagePullSecrets | []string | | | |
cmd | []string | | | |
args | []string | | | |
ports | []Port | | | |
env | []Env | | | |
volumeMounts | []VolumeMount | | | |
livenessProbe | LivenessProbe | | | |
readinessProbe | ReadinessProbe | | | |
serviceAccountName | string | | | |
Port
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
port | int | v | | |
name | string | | | |
protocol | string | | | |
Env
Name | Type | Required | Default | Description |
---|
name | string | v | | |
value | string | | | |
valueFrom | ValueFrom | | | |
value或valueFrom 其中一個必須為必填
ValueFrom
Name | Type | Required | Default | Description |
---|
secretKeyRef | SecretKeyRef | | | |
SecretKeyRef
Name | Type | Required | Default | Description |
---|
name | string | v | | secret name |
key | string | v | | secret value |
VolumeMount
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
emptyDir | EmptyDir | | | |
hostPath | HostPath | | | |
pvc | PVC | | | |
secret | Secret | | | |
EmptyDir
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
name | string | v | | |
mountPath | string | v | | |
subPath | string | | | |
medium | string | | "" | “Memory” or “” |
HostPath
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
name | string | v | | |
mountPath | string | v | | |
subPath | string | | | |
path | string | v | | Host filesystem path. |
PVC
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
name | string | v | | |
mountPath | string | v | | |
subPath | string | | | |
claimName | string | v | | |
Secret
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
name | string | v | | |
subPath | string | | | |
mountPath | string | v | | |
secretName | string | v | | |
HttpGet
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
path | string | v | | |
port | int | v | | |
host | string | | | |
scheme | string | | | |
httpHeaders | []HttpHeader | | | |
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
name | string | v | | |
value | string | v | | |
TcpSocket
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
ip | string | v | | |
hostnames | []string | v | | |
LivenessProbe
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
exec | Exec | | | |
httpGet | HttpGet | | | |
tcpSocket | TcpSocket | | | |
initialDelaySeconds | int | | 10 | |
timeoutSeconds | int | | 1 | |
successThreshold | int | | 1 | |
failureThreshold | int | | 3 | |
ReadinessProbe
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
exec | Exec | | | |
httpGet | HttpGet | | | |
tcpSocket | TcpSocket | | | |
initialDelaySeconds | int | | 10 | |
timeoutSeconds | int | | 1 | |
successThreshold | int | | 1 | |
failureThreshold | int | | 3 | |
StartupProbe
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
exec | Exec | | | |
httpGet | HttpGet | | | |
tcpSocket | TcpSocket | | | |
initialDelaySeconds | int | | 10 | |
timeoutSeconds | int | | 1 | |
successThreshold | int | | 1 | |
failureThreshold | int | | 3 | |
Exec
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
command | []string | v | | |
Sidecars
宣告容器化工作負載的伴隨邊車容器。
Schema
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
type | ”sidecars” | V | | 特徵型別名稱。 |
sidecar | []Sidecar | V | | 邊車容器資料。 |
Sidecar
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
image | string | V | | 容器映像名稱。 |
cmd | []string | | | 進入點命令名稱。 |
args | []string | | | 命令參數。 |
env | []Env | | | 環境變數。 |
volumes | string | | | 要與主容器共享的非永續暫時目錄。 |
livenessProbe | LivenessProbe | | | |
readlinessProbe | ReadinessProbe | | | |
Volume
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
name | string | V | | Volume 名稱,會以此產生一個 emptyDir。 |
path | string | V | | 綁定的路徑。 |
mainPath | string | | | 主容器的綁定路徑,如果沒有給的話跟 ‘path’ 相同。 |
Scaler
手動調整元件實例(Pod)數量。
Schema
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
type | ”scaler” | V | | 特徵型別名稱。 |
replica | int | V | | |
Resources
描述容器等工作負載使用的資源限制。
Schema
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
type | ”resources” | V | | 特徵型別名稱。 |
cpu | double | | 1 | 定義元件的 CPU requests 以及 limits 值。 |
memory | string | | 2048 Mi | 定義元件的記憶體 requests 以及 limits。 |
Limits
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
cpu | double | | 同 Resources.cpu | CPU limit for the component. |
memory | string | | 同 Resources.memory | Memory limits for the component. |
Properties
通用 Key-value 屬性表,常作為應用元件設定值,例如:在 K8s 叢集產生一個 ConfigMap 物件。
Schema
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
type | ”properties” | V | | 特徵型別名稱。 |
entries | mapping[string] string | | | key-value 表。 |
Ingress-Route
讓 Webservice 元件可以對外開放存取端口。不能跟 HttpRoute 共用。
Example
apiVersion: po.rapd.app/v1beta1
name: ingress-route-example
- type: webservice.container
Schema
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
type | ”ingressRoute” | V | | 特徵型別名稱。稱。 |
hostname | string | | | 匹配主機名稱。 |
paths | map[string] int | v | | 路徑到 port 的對照表。 |
pathType | string | | Prefix | 路徑比對的演算法。 “Prefix”, “Exact”, “ImplementationSpecific” |
ingressClassName | string | | | 指定 Ingress class 名稱。 |
Connections
用於動態綁定服務所需的機敏資料。
Schema
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
type | ”connections” | V | | 特徵型別名稱。稱。 |
connections | []Connection | V | | 連線資訊。 |
Connection
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
supplierName | string | V | | 提供服務的元件名稱。 |
envRefs | EnvRef | | | 指定特定連線資訊為應用的環境變數 |
volume | Volume | | | 將連線資訊以檔案方式掛載到應用裡 |
EnvRef
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
secretKey | string | V | | 對應到Secret data的鍵值。 |
envName | string | V | | 環境變數名稱。 |
Volume
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
mountPath | string | V | | 掛載目錄位置。 |
subPath | string | V | | |
Rollout-Rolling
Rolling update 部署策略。 此策略在部署過程中,新舊版本並存,不同使用者可能同時存取到新舊版本。舊版本的元件副本會慢慢被刪除,同樣數量的新版本會被建立直到所有舊版本的副本都被置換為止。
Compatible Component Types
適用於 Webservice 類型元件。
Example
apiVersion: po.rapd.app/v1beta1
name: rollout-rolling-example
- type: webservice.container
- type: “rollout-rolling”
Schema
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
type | ”rollout-rolling” | V | | 特徵型別名稱。稱。 |
maxSurge | string | | 20% | 最大超出容忍量,當新舊版本共存時,最大容忍多少 Pod 可超出的數量,可為數字或是百分比 ( ex: 2 or 10% ) |
maxUnavailable | string | | 20% | 最大不可用容忍量,可為數字或是百分比 ( ex: 2 or 10% ) |
- 總部署時間: Ceil( 100/stepWeight ) * interval 秒
- 總部署 rollout steps:Ceil( 100/stepWeight )
Rollout-Recreate
此特徵描述 Recreate 部署策略。對於 Cluster Type 為 Kubenetets 的 Cluster 來說,此部署策略會先將舊版本的 Deployment 刪除後才開始建立新的 Deployment。
Example
apiVersion: po.rapd.app/v1beta1
name: rollout-recreate-example
- type: webservice.container
- type: “rollout-recreate”
Schema
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
type | ”rollout-recreate” | V | | 特徵型別名稱。稱。 |
Rollout-Canary
使用 K8s Gateway Api 作為底層實作分流的服務,應確認 K8s Gateway API 資源已安裝。此策略部署新版本與舊版本並存,但使用者的流量會逐漸地導到新版本的副本。如果沒有問題,此過程會持續直到所有流量都使用新版本為止。如果出現問題,可以將全部流量導回原先版本。
Example
apiVersion: po.rapd.app/v1beta1
name: rollout-canary-example
- type: webservice.container
Schema
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
type | ”rollout-canary” | V | | 特徵型別名稱。稱。 |
interval | int | | 10 | 每N秒後會進行下一次的 rollout deployment。 |
stepPercentage | int | | 20 | 每次 Rollout Deployment 時會將多少%的流量轉移到新版本服務中。 |
- 總部署時間: Ceil( 100/stepPercentage ) * interval 秒
- 總部署 rollout steps:Ceil( 100/stepPercentage )
Rollout-BlueGreen
用於描述元件的藍綠部署策略。
Example
apiVersion: po.rapd.app/v1beta1
name: rollout-blue-green-example
- type: webservice.container
- type: “rollout-blue-green”
名稱 | 型別 | 必填 | 預設值 | 說明 |
---|
type | ”rollout-blue-green” | V | | 特徵型別名稱。稱。 |