[[Argo Workflowのtemplate名の変数展開]] ができないようなので、[[CUE]]を使用して、異種実験ごとに重複した処理を重複なしで書き換える。 まずは、 cue importでargoのマニフェストをcueへ変換する。 ```shell-session $ cue import experiments/argowf.yaml -o experiments/argowf.cue ``` 次に、 litmusの`chaosengine.yaml`をcueで記述して、置換する。 [[CUEでYAMLの埋め込み]]を使う。 [[Sock Shop]] では、以下のようなCUEで記述された設定へ移行した。 [add more chaos type litmus by yuuki · Pull Request #6 · ai4sre/microservices-demo · GitHub](https://github.com/ai4sre/microservices-demo/pull/6/commits/2e5ac9f454aed3a0379a75d7a376460d353afca6) 実験タイプごとに重複する記述を排除するために、[[CUEで隠された変数定義]] を使って、実験タイプのリストを定義してループで展開していく。 さらに、同じような変数定義を使って、kubectl用のコンテナ定義を共通化した。 [argo: make duplicate 'container's common · ai4sre/microservices-demo@e4d1242 · GitHub](https://github.com/ai4sre/microservices-demo/commit/e4d12429e2ed77b6a5a8b07bc00192f86444bc53) [[CUEのTemplates]] を使用しようとしたが、テンプレートに渡せる引数は、1つのみのようだった。引数を2つ与えなかったため、今回はテンプレートを使わずに、可変要素をマップとして定義して、マップに対してforループにより展開することにした。 [argo: make duplicate 'ChapsEngine' in litmus common in cuelang · ai4sre/microservices-demo@b03c09c · GitHub](https://github.com/ai4sre/microservices-demo/commit/b03c09c47d30e3af226489c0431f8151f1c65418)