sync sync all resources from state file (repos, releases and chart deps) apply apply all resources from state file only when there are changes
sync
The helmfile sync sub-command sync your cluster state as described in your helmfile ... Under the covers, Helmfile executes helm upgrade --install for each release declared in the manifest, by optionally decrypting secrets to be consumed as helm chart values. It also updates specified chart repositories and updates the dependencies of any referenced local charts. For Helm 2.9+ you can use a username and password to authenticate to a remote repository.
应用
The helmfile apply sub-command begins by executing diff. If diff finds that there is any changes sync is executed. Adding --interactive instructs Helmfile to request your confirmation before sync. An expected use-case of apply is to schedule it to run periodically, so that you can auto-fix skews between the desired and the current state of your apps running on Kubernetes clusters.
我浏览了Helmfile repo Readme
以找出helmfile sync
和helmfile apply
之间的差异。似乎与apply命令不同,sync命令没有执行diff
,并且在所有发行版out中都没有执行helm upgrade
。但是,从sync
一词开始,您希望该命令将应用那些已更改的发行版。还提到了helmfile apply
在定期同步发行中的潜在应用。为什么不为此目的使用helmfile sync
?总体而言,这种差异并没有变得十分明确,尽管我可能还会做更多。所以,我问。
如果使用每五分钟调用一次helmfile sync
的helm upgrade --install
,您将最终每隔五分钟递增一次图表修订。
$ helm list
$
$ helm upgrade --install httpd bitnami/apache > /dev/null
$ helm list
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
httpd 1 Thu Feb 13 11:27:14 2020 DEPLOYED apache-7.3.5 2.4.41 default
$ helm upgrade --install httpd bitnami/apache > /dev/null
$ helm list
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
httpd 2 Thu Feb 13 11:28:39 2020 DEPLOYED apache-7.3.5 2.4.41 default
因此每个helmfile sync
将产生新的修订。现在,如果您要运行helmfile apply
,它将首先检查差异,然后(如果找到)将调用helmfile sync
,而后者又将调用helm upgrade --install
,这将不会发生。