mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* Introduce PDB for several components * Include pod-disruption-budget.libsonnet * Allow configuration of maxUnavailable * Adhere to config standard * Add pdb configuration to compiled jsonnet extras
98 lines
3.8 KiB
Jsonnet
98 lines
3.8 KiB
Jsonnet
{
|
|
local k = import 'ksonnet-util/kausal.libsonnet',
|
|
local container = k.core.v1.container,
|
|
local containerPort = k.core.v1.containerPort,
|
|
local volumeMount = k.core.v1.volumeMount,
|
|
local deployment = k.apps.v1.deployment,
|
|
local volume = k.core.v1.volume,
|
|
local service = k.core.v1.service,
|
|
local servicePort = k.core.v1.servicePort,
|
|
|
|
local target_name = 'query-frontend',
|
|
local tempo_config_volume = 'tempo-conf',
|
|
local tempo_query_config_volume = 'tempo-query-conf',
|
|
local tempo_data_volume = 'tempo-data',
|
|
local tempo_overrides_config_volume = 'overrides',
|
|
|
|
tempo_query_frontend_ports:: [containerPort.new('prom-metrics', $._config.port)],
|
|
tempo_query_frontend_args:: {
|
|
target: target_name,
|
|
'config.file': '/conf/tempo.yaml',
|
|
'mem-ballast-size-mbs': $._config.ballast_size_mbs,
|
|
},
|
|
|
|
tempo_query_frontend_container::
|
|
container.new(target_name, $._images.tempo_query_frontend) +
|
|
container.withPorts($.tempo_query_frontend_ports) +
|
|
container.withArgs($.util.mapToFlags($.tempo_query_frontend_args)) +
|
|
(if $._config.variables_expansion then container.withEnvMixin($._config.variables_expansion_env_mixin) else {}) +
|
|
container.withVolumeMounts([
|
|
volumeMount.new(tempo_config_volume, '/conf'),
|
|
volumeMount.new(tempo_overrides_config_volume, '/overrides'),
|
|
]) +
|
|
$.util.withResources($._config.query_frontend.resources) +
|
|
$.util.readinessProbe +
|
|
(if $._config.variables_expansion then container.withArgsMixin(['-config.expand-env=true']) else {}),
|
|
|
|
tempo_query_container::
|
|
container.new('tempo-query', $._images.tempo_query) +
|
|
container.withPorts([
|
|
containerPort.new('jaeger-ui', 16686),
|
|
containerPort.new('jaeger-metrics', 16687),
|
|
]) +
|
|
container.withArgs([
|
|
'--query.base-path=' + $._config.jaeger_ui.base_path,
|
|
'--grpc-storage-plugin.configuration-file=/conf/tempo-query.yaml',
|
|
'--query.bearer-token-propagation=true',
|
|
]) +
|
|
container.withVolumeMounts([
|
|
volumeMount.new(tempo_query_config_volume, '/conf'),
|
|
]),
|
|
|
|
tempo_query_frontend_deployment:
|
|
deployment.new(
|
|
target_name,
|
|
$._config.query_frontend.replicas,
|
|
std.prune([
|
|
$.tempo_query_frontend_container,
|
|
if $._config.tempo_query.enabled then $.tempo_query_container,
|
|
]),
|
|
{
|
|
app: target_name,
|
|
}
|
|
) +
|
|
deployment.mixin.spec.strategy.rollingUpdate.withMaxSurge(0) +
|
|
deployment.mixin.spec.strategy.rollingUpdate.withMaxUnavailable(1) +
|
|
deployment.mixin.spec.template.metadata.withAnnotations({
|
|
config_hash: std.md5(std.toString($.tempo_query_frontend_configmap.data['tempo.yaml'])),
|
|
}) +
|
|
deployment.mixin.spec.template.spec.withVolumes(std.prune([
|
|
if $._config.tempo_query.enabled then volume.fromConfigMap(tempo_query_config_volume, $.tempo_query_configmap.metadata.name),
|
|
volume.fromConfigMap(tempo_config_volume, $.tempo_query_frontend_configmap.metadata.name),
|
|
volume.fromConfigMap(tempo_overrides_config_volume, $._config.overrides_configmap_name),
|
|
])),
|
|
|
|
tempo_query_frontend_service:
|
|
k.util.serviceFor($.tempo_query_frontend_deployment)
|
|
+ service.mixin.spec.withPortsMixin([
|
|
servicePort.withName('http')
|
|
+ servicePort.withPort(80)
|
|
+ servicePort.withTargetPort($._config.port),
|
|
]),
|
|
|
|
tempo_query_frontend_discovery_service:
|
|
k.util.serviceFor($.tempo_query_frontend_deployment)
|
|
+ service.mixin.spec.withPortsMixin([
|
|
servicePort.withName('grpc')
|
|
+ servicePort.withPort(9095)
|
|
+ servicePort.withTargetPort(9095),
|
|
])
|
|
+ service.mixin.spec.withPublishNotReadyAddresses(true)
|
|
+ service.mixin.spec.withClusterIp('None')
|
|
+ service.mixin.metadata.withName('query-frontend-discovery'),
|
|
|
|
// Pod Disruption Budget
|
|
tempo_query_frontend_pdb: $.pdbForController($.tempo_query_frontend_deployment, 'query_frontend'),
|
|
|
|
}
|