helmfile syn c против применения helmfile - PullRequest
2 голосов
/ 12 января 2020
sync      sync all resources from state file (repos, releases and chart deps)
apply     apply all resources from state file only when there are changes

син c

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 Readme, чтобы выяснить разницу между helmfile sync и helmfile apply. Кажется, что в отличие от команды apply, команда syn c не выполняет diff и helm upgrade чертовски из всех выпусков ?. Но от слова sync можно ожидать, что команда будет применять те выпуски, которые были изменены. Также упоминается о возможном применении helmfile apply для периодической синхронизации выпусков. Почему бы не использовать helmfile sync для этой цели? В целом, разница не стала кристально ясной, и я, вероятно, мог бы быть к ней больше. Итак, я спрашиваю.

1 Ответ

3 голосов
/ 13 февраля 2020

Рассмотрим вариант использования, когда у вас есть задание Jenkins, которое запускается каждые 5 минут, и в этом задании вы хотите обновить свою таблицу управления, но только при наличии изменений.

Если вы используете helmfile sync который вызывает helm upgrade --install каждые пять минут, вы в конечном итоге увеличиваете ревизию диаграммы каждые пять минут.

$ 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, этого не произойдет.

...