0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

helm templateの結果をファイル分割して保存するTIPS

Posted at

helm templateの出力結果が大きい問題

helm templateコマンドでレンダリングを行いますと、
以下のように---区切りの膨大な行数が標準出力されることがあるかと思います。

イングレスのレンダリング行数
$ helm template ingress-nginx/ingress-nginx | wc -l
738

対応策

以下のようにyqコマンドでファイル毎に保存します。
分割後のファイル名がカインド名-連番.ymlとなるようにしています。

$ helm template ingress-nginx/ingress-nginx | yq -s '.kind + "-" + $index'
$ ls
ClusterRole-12.yml                      ConfigMap-1.yml                         Job-17.yml                              RoleBinding-5.yml                       ServiceAccount-11.yml
ClusterRole-2.yml                       Deployment-8.yml                        Role-14.yml                             Service-6.yml                           ValidatingWebhookConfiguration-10.yml
ClusterRoleBinding-13.yml               IngressClass-9.yml                      Role-4.yml                              Service-7.yml
ClusterRoleBinding-3.yml                Job-16.yml 

参考

yqコマンド: https://mikefarah.gitbook.io/yq/
元ネタ: https://github.com/helm/helm/issues/4680#issuecomment-1468229115

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?