Syntixi 支持多租戶命名空間管理,意味著企業內部不同團隊或部門可以在各自管理的命名空間創建和管理 Syntixi 資源。

建立獨立命名空間內的物件 (CRDs)

Syntixi CLI 預設使用 $HOME/.kube/configcurrent-context 所對應的命名空間對 Kubernetes API Server 發起操作請求

  # View current context
kubectl config view --minify

# Set namespace for CLI operations
kubectl config set-context --current --namespace=<namespace>

# View current namespace
kubectl config view --minify --output 'jsonpath={..namespace}'
  

假設當前命名空間為 default,則下面指令將會在該命名空間建立 Bundle 物件:

  syntixi bundle create --name hello --code hello.js
  

你也可以在執行 CLI 操作時加上 --namespace (-n) 來更改當次操作所對應的命名空間

  syntixi --namespace <namespace> bundle create --name hello --code hello.js
  

不支援跨命名空間物件引用

命名空間內的物件不能被位於不同命名空間內的物件所引用。

假設在命名空間 foobar 中創建了一個 Function,並嘗試引用命名空間 default 中的一個 Bundle 時,
由於兩個資源不在同一個命名空間中,系統無法在命名空間 foobar 中找到名為 hello 的 Bundle, 因此 CLI 會顯示 resource not found 錯誤。

  syntixi -n foobar function create --name hello --bundle hello --image nginx
Error: Bundle needs to be present in the same namespace 'foobar' as function 'hello': 
bundles.core.syntixi.dev "hello" not found
  
Was this page helpful?