-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jsonnet for running loki using boltdb-shipper #2547
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
local pvc = $.core.v1.persistentVolumeClaim, | ||
local volumeMount = $.core.v1.volumeMount, | ||
local container = $.core.v1.container, | ||
local statefulSet = $.apps.v1.statefulSet, | ||
local service = $.core.v1.service, | ||
local containerPort = $.core.v1.containerPort, | ||
|
||
_config+:: { | ||
// run ingesters and queriers as statefulsets when using boltdb-shipper to avoid using node disk for storing the index. | ||
stateful_ingesters: if self.using_boltdb_shipper then true else super.stateful_ingesters, | ||
stateful_queriers: if self.using_boltdb_shipper then true else super.stateful_queriers, | ||
|
||
boltdb_shipper_shared_store: error 'must define boltdb_shipper_shared_store', | ||
compactor_pvc_size: '10Gi', | ||
index_period_hours: if self.using_boltdb_shipper then 24 else super.index_period_hours, | ||
loki+: if self.using_boltdb_shipper then { | ||
chunk_store_config+: { | ||
write_dedupe_cache_config:: {}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why the dedupe cache is an empty config here. We should be able to leave it out. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or do you mean we actually should not care because it will automatically disabled ? https://grafana.com/docs/loki/latest/operations/storage/boltdb-shipper/#write-deduplication-disabled There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do not use that config so it was better to remove it instead of using the default which would have some values set. It avoids setting a wrong expectation who doesn't know much about it. |
||
}, | ||
storage_config+: { | ||
boltdb_shipper: { | ||
shared_store: $._config.boltdb_shipper_shared_store, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also be guarded by an |
||
}, | ||
}, | ||
} else {}, | ||
}, | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For cleanliness i ended up removing some options from the
not sure if it make sense or , since there is no bigtable enabled, it does not really matter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Someone cloud be using both(moving to or away from bigtable) and would have to add an override again. It is safe to have those extra flags even if you are not using bigtable. We can take care of it by refactoring the jsonnet to include them only when bigtable is one of the stores but it is time-consuming so it would not happen anytime soon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sense. thanks |
||
ingester_args+:: if $._config.using_boltdb_shipper then { | ||
// Persist index in pvc | ||
'boltdb.shipper.active-index-directory': '/data/index', | ||
|
||
// Use PVC for caching | ||
'boltdb.shipper.cache-location': '/data/boltdb-cache', | ||
} else {}, | ||
|
||
querier_args+:: if $._config.using_boltdb_shipper then { | ||
// Use PVC for caching | ||
'boltdb.shipper.cache-location': '/data/boltdb-cache', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be in the config file behind an |
||
} else {}, | ||
|
||
// we don't dedupe index writes when using boltdb-shipper so don't deploy a cache for it. | ||
memcached_index_writes:: if $._config.using_boltdb_shipper then {} else self.memcached_index_writes, | ||
|
||
// Use PVC for compactor instead of node disk. | ||
compactor_data_pvc:: if $._config.using_boltdb_shipper then | ||
pvc.new('compactor-data') + | ||
pvc.mixin.spec.resources.withRequests({ storage: $._config.compactor_pvc_size }) + | ||
pvc.mixin.spec.withAccessModes(['ReadWriteOnce']) + | ||
pvc.mixin.spec.withStorageClassName('fast') | ||
else {}, | ||
|
||
compactor_args:: if $._config.using_boltdb_shipper then { | ||
'config.file': '/etc/loki/config/config.yaml', | ||
'boltdb.shipper.compactor.working-directory': '/data/compactor', | ||
'boltdb.shipper.compactor.shared-store': $._config.boltdb_shipper_shared_store, | ||
target: 'compactor', | ||
} else {}, | ||
|
||
local compactor_ports = | ||
[ | ||
containerPort.new(name='http-metrics', port=$._config.http_listen_port), | ||
], | ||
|
||
compactor_container:: if $._config.using_boltdb_shipper then | ||
container.new('compactor', $._images.compactor) + | ||
container.withPorts(compactor_ports) + | ||
container.withArgsMixin($.util.mapToFlags($.compactor_args)) + | ||
container.withVolumeMountsMixin([volumeMount.new('compactor-data', '/data')]) + | ||
container.mixin.readinessProbe.httpGet.withPath('/ready') + | ||
container.mixin.readinessProbe.httpGet.withPort($._config.http_listen_port) + | ||
container.mixin.readinessProbe.withTimeoutSeconds(1) + | ||
$.util.resourcesRequests('4', '2Gi') | ||
else {}, | ||
|
||
compactor_statefulset: if $._config.using_boltdb_shipper then | ||
statefulSet.new('compactor', 1, [$.compactor_container], $.compactor_data_pvc) + | ||
statefulSet.mixin.spec.withServiceName('compactor') + | ||
$.config_hash_mixin + | ||
$.util.configVolumeMount('loki', '/etc/loki/config') + | ||
statefulSet.mixin.spec.updateStrategy.withType('RollingUpdate') + | ||
statefulSet.mixin.spec.template.spec.securityContext.withFsGroup(10001) // 10001 is the group ID assigned to Loki in the Dockerfile | ||
else {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,6 @@ | |
tableManager: self.loki, | ||
query_frontend: self.loki, | ||
ruler: self.loki, | ||
compactor: self.loki, | ||
}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be hidden behind a
boltdb_shipper_enabled
variable inside_config
so that we can do things liketo avoid clutter in our configs