Plugin

各資源的設定 · Kind/name · when · dependsOn

apiVersion: plugin.routerd.net/v1alpha1 · metadata.name

註冊實作routerd外掛協定的執行檔,由明確操作或EventSubscription等使用端呼叫。

指定條件與參照關係

設定語法

這是說明用語法,不是可直接複製的YAML。未加括號的欄位在父項目內必填;[ ... ]表示依條件可省略,<型別>為替換值,(a | b)表示選項。選填父項目內仍可能有必填子項目。條件必填、互斥與實際預設值請見下表;一般YAML請使用連結範例。

- apiVersion: plugin.routerd.net/v1alpha1
  kind: Plugin
  metadata:
    name: "<name>"
  spec:
    [ capabilities:
        - ("observe.cloud" | "observe.providerPrivateIPs" | "propose.dynamicConfig" | "propose.providerAction" | "execute.providerAction")
    ]
    [ context:
        [ resources:
            -
              apiVersion: <string>
              kind: <string>
              name: <string>
        ]
    ]
    [ env:
        [ <name>: <string> ]
    ]
    executable: <string>
    [ timeout: <string> ]
    [ triggers:
        -
          [ every: <string> ]
          [ topic: <string> ]
          type: ("interval" | "event")
    ]

欄位意義與預設值

選填父項目的必填子項目僅在使用父項目時需要。其他具體條件列於說明;[ ... ]選項仍可能需要擇一。

YAML 指定要求 型別與限制 欄位意義與預設值
spec.executable 必填 string 外部程式的絕對路徑;必填,無預設值。
spec.timeout 選填 string 單次執行時間上限。預設10s;明確指定時須為正的Go duration,例如30s。
spec.env 選填 object 以變數名稱為鍵的額外環境變數,預設空。runner先設定自身PATH,缺少時使用內建路徑,再套用這些值;不繼承其他父程序變數。忽略空鍵及含=的鍵。
spec.capabilities 選填 array 能力宣告,預設空。接受observe.cloud、observe.providerPrivateIPs、propose.dynamicConfig、propose.providerAction、execute.providerAction。清查執行須有observe.providerPrivateIPs;供應商操作執行須有execute.providerAction;此清單本身不會啟動執行。
spec.context 選填 object 控制透過標準輸入傳入哪些設定資源的允許清單;預設空,不傳入設定。
spec.context.resources 選填 array 允許的資源識別清單,預設空;不展開萬用字元。
spec.context.resources[].apiVersion 條件必填 string 參照設定資源的API群組與版本;每項必填。
spec.context.resources[].kind 條件必填 string 參照設定資源的種類;每項必填。
spec.context.resources[].name 條件必填 string 參照設定資源的metadata.name;每項必填。
spec.triggers 選填 array 觸發宣告清單,預設空;目前runtime僅驗證與顯示,請參照上方限制。
spec.triggers[].type 條件必填 string; enum=["interval", "event"] 觸發類型;必須指定interval或event,無預設值。
spec.triggers[].every 選填 string interval時必填,須為正的Go duration;event時此欄位不產生週期排程,無預設值。
spec.triggers[].topic 選填 string 事件主題宣告;選填,預設空,event時驗證器也不強制要求。這不是資源名稱。

實作: pkg/api/specs.go · pkg/config/validate_plugin.go · pkg/plugin/runner.go · pkg/plugin/context.go · pkg/providerinventory/executor.go · pkg/provideraction/executor.go

可參照的狀態欄位

一般狀態參照驗證接受此 Kind 的下列欄位名稱。列於允許清單不保證目前有值,請檢查實際狀態。這些是輸出,不是 YAML spec 設定。

此 Kind 未登錄一般狀態參照的允許欄位。