splunk / qbec

configure kubernetes objects on multiple clusters using jsonnet
https://qbec.io
Apache License 2.0
171 stars 37 forks source link

Support for hooks and Helm hooks #149

Open kvaps opened 4 years ago

kvaps commented 4 years ago

It would be nice to expand qbec directives with hooks similar to which helm already has:

https://helm.sh/docs/topics/charts_hooks/#the-available-hooks

Also to translate helm hooks the same way in expandHelmTemplate

kvaps commented 4 years ago

Good news, I just found that ArgoCD support helm hooks natively. Thus it will just run qbec show <env> to generate YAML, and consider the output as the rendered Helm-chart. So all the helm hooks will be working even if chart rendered via expandHelmTemplate

gotwarlost commented 4 years ago

@kvaps I'm curious about what hooks need to be supported in qbec with some examples.

kvaps commented 4 years ago

Sure! Most of the examples can be found in helm charts/stable

61 chart of 282 are using helm hooks:

ambassador                    anchore-engine                ark                           atlantis
burrow                        centrifugo                    cloudserver                   cockroachdb
collabora-code                consul                        contour                       dex
elasticsearch                 elasticsearch-curator         etcd-operator                 falco
fluent-bit                    gocd                          grafana                       hazelcast
hazelcast-jet                 inbucket                      influxdb                      jaeger-operator
jenkins                       keycloak                      kibana                        kong
mariadb                       mattermost-team-edition       memcached                     mercure
metrics-server                minio                         mission-control               mongodb-replicaset
mysql                         neo4j                         nginx-ingress                 openldap
percona-xtradb-cluster        pgadmin                       pomerium                      prestashop
prometheus-mongodb-exporter   prometheus-operator           redis-ha                      sentry
sonarqube                     spark                         spark-history-server          spinnaker
stolon                        sumokube                      sumologic-fluentd             tensorflow-notebook
tensorflow-serving            traefik                       velero                        weave-scope
wordpress                    

Let's take stolon (high available postgress cluster):

Another good example is wire-server charts:

kvaps commented 4 years ago

I'm so sad that Kubernetes API does not allow to overwrite the Job manifests and execute the jobs according the changed hash of podTemplate for them, that's why all these hooks are needed for. They are quite useful to provide the database migrations, cluster initialization or uploading initial configuration to the application.

kvaps commented 4 years ago

@gotwarlost it seems all the needed code for hooks is already implemented in gitops-engine project: https://github.com/argoproj/gitops-engine/tree/master/pkg/sync/hook

This project combines the best from Argo CD and Flux CD. Not sure, if we can simple use it, but I would be very glad to see qbec as a platform application in argocd.

The only problem of ArgoCD is no opportunity to apply changes locally (in case if something has gonna wrong). Except these few issues QBEC is fully solves that.