Skip to content

Commit

Permalink
Add annotation with hash of config, to trigger re-deployments when co…
Browse files Browse the repository at this point in the history
…nfig changes. (grafana#178)

Signed-off-by: Tom Wilkie <[email protected]>
tomwilkie authored Dec 20, 2018

Verified

This commit was signed with the committer’s verified signature.
EtiennePelletier Étienne Pelletier
1 parent 211d454 commit f66d9e9
Showing 4 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion production/ksonnet/loki/config.libsonnet
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@

// December 11 is when we first launched to the public.
// Assume we can ingest logs that are 5months old.
schema_start_date: '2018-07-11',
schema_start_date: '2018-07-11',

commonArgs: {
'config.file': '/etc/loki/config.yaml',
@@ -84,4 +84,11 @@
configMap.withData({
'config.yaml': $.util.manifestYaml($._config.loki),
}),

local deployment = $.apps.v1beta1.deployment,

config_hash_mixin::
deployment.mixin.spec.template.metadata.withAnnotationsMixin({
config_hash: std.md5(std.toString($._config.loki)),
}),
}
1 change: 1 addition & 0 deletions production/ksonnet/loki/distributor.libsonnet
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@

distributor_deployment:
deployment.new('distributor', 3, [$.distributor_container]) +
$.config_hash_mixin +
$.util.configVolumeMount('loki', '/etc/loki') +
$.util.antiAffinity,

1 change: 1 addition & 0 deletions production/ksonnet/loki/ingester.libsonnet
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@

ingester_deployment:
deployment.new('ingester', 3, [$.ingester_container]) +
$.config_hash_mixin +
$.util.configVolumeMount('loki', '/etc/loki') +
$.util.antiAffinity +
deployment.mixin.spec.withMinReadySeconds(60) +
1 change: 1 addition & 0 deletions production/ksonnet/loki/querier.libsonnet
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@

querier_deployment:
deployment.new('querier', 3, [$.querier_container]) +
$.config_hash_mixin +
$.util.configVolumeMount('loki', '/etc/loki') +
$.util.antiAffinity,

0 comments on commit f66d9e9

Please sign in to comment.