|
|
|
@ -1,8 +1,9 @@ |
|
|
|
|
local k = import 'ksonnet-util/kausal.libsonnet'; |
|
|
|
|
{ |
|
|
|
|
local container = $.core.v1.container, |
|
|
|
|
local pvc = $.core.v1.persistentVolumeClaim, |
|
|
|
|
local volumeMount = $.core.v1.volumeMount, |
|
|
|
|
local statefulSet = $.apps.v1.statefulSet, |
|
|
|
|
local container = k.core.v1.container, |
|
|
|
|
local pvc = k.core.v1.persistentVolumeClaim, |
|
|
|
|
local volumeMount = k.core.v1.volumeMount, |
|
|
|
|
local statefulSet = k.apps.v1.statefulSet, |
|
|
|
|
|
|
|
|
|
ingester_args:: |
|
|
|
|
$._config.commonArgs { |
|
|
|
@ -17,31 +18,31 @@ |
|
|
|
|
ingester_container:: |
|
|
|
|
container.new('ingester', $._images.ingester) + |
|
|
|
|
container.withPorts($.util.defaultPorts) + |
|
|
|
|
container.withArgsMixin($.util.mapToFlags($.ingester_args)) + |
|
|
|
|
container.withArgsMixin(k.util.mapToFlags($.ingester_args)) + |
|
|
|
|
container.mixin.readinessProbe.httpGet.withPath('/ready') + |
|
|
|
|
container.mixin.readinessProbe.httpGet.withPort($._config.http_listen_port) + |
|
|
|
|
container.mixin.readinessProbe.withInitialDelaySeconds(15) + |
|
|
|
|
container.mixin.readinessProbe.withTimeoutSeconds(1) + |
|
|
|
|
$.util.resourcesRequests('1', '5Gi') + |
|
|
|
|
$.util.resourcesLimits('2', '10Gi') + |
|
|
|
|
k.util.resourcesRequests('1', '5Gi') + |
|
|
|
|
k.util.resourcesLimits('2', '10Gi') + |
|
|
|
|
if $._config.stateful_ingesters then |
|
|
|
|
container.withVolumeMountsMixin([ |
|
|
|
|
volumeMount.new('ingester-data', '/data'), |
|
|
|
|
]) else {}, |
|
|
|
|
|
|
|
|
|
local deployment = $.apps.v1.deployment, |
|
|
|
|
local deployment = k.apps.v1.deployment, |
|
|
|
|
|
|
|
|
|
local name = 'ingester', |
|
|
|
|
|
|
|
|
|
ingester_deployment: if !$._config.stateful_ingesters then |
|
|
|
|
deployment.new(name, 3, [$.ingester_container]) + |
|
|
|
|
$.config_hash_mixin + |
|
|
|
|
$.util.configVolumeMount('loki', '/etc/loki/config') + |
|
|
|
|
$.util.configVolumeMount( |
|
|
|
|
k.util.configVolumeMount('loki', '/etc/loki/config') + |
|
|
|
|
k.util.configVolumeMount( |
|
|
|
|
$._config.overrides_configmap_mount_name, |
|
|
|
|
$._config.overrides_configmap_mount_path, |
|
|
|
|
) + |
|
|
|
|
$.util.antiAffinity + |
|
|
|
|
k.util.antiAffinity + |
|
|
|
|
deployment.mixin.spec.withMinReadySeconds(60) + |
|
|
|
|
deployment.mixin.spec.strategy.rollingUpdate.withMaxSurge(0) + |
|
|
|
|
deployment.mixin.spec.strategy.rollingUpdate.withMaxUnavailable(1) + |
|
|
|
@ -60,12 +61,12 @@ |
|
|
|
|
statefulSet.mixin.spec.withServiceName('ingester') + |
|
|
|
|
statefulSet.mixin.spec.withPodManagementPolicy('Parallel') + |
|
|
|
|
$.config_hash_mixin + |
|
|
|
|
$.util.configVolumeMount('loki', '/etc/loki/config') + |
|
|
|
|
$.util.configVolumeMount( |
|
|
|
|
k.util.configVolumeMount('loki', '/etc/loki/config') + |
|
|
|
|
k.util.configVolumeMount( |
|
|
|
|
$._config.overrides_configmap_mount_name, |
|
|
|
|
$._config.overrides_configmap_mount_path, |
|
|
|
|
) + |
|
|
|
|
$.util.antiAffinity + |
|
|
|
|
k.util.antiAffinity + |
|
|
|
|
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 |
|
|
|
|
statefulSet.mixin.spec.template.spec.withTerminationGracePeriodSeconds(4800) |
|
|
|
@ -73,11 +74,11 @@ |
|
|
|
|
|
|
|
|
|
ingester_service: |
|
|
|
|
if !$._config.stateful_ingesters then |
|
|
|
|
$.util.serviceFor($.ingester_deployment) |
|
|
|
|
k.util.serviceFor($.ingester_deployment) |
|
|
|
|
else |
|
|
|
|
$.util.serviceFor($.ingester_statefulset), |
|
|
|
|
k.util.serviceFor($.ingester_statefulset), |
|
|
|
|
|
|
|
|
|
local podDisruptionBudget = $.policy.v1beta1.podDisruptionBudget, |
|
|
|
|
local podDisruptionBudget = k.policy.v1beta1.podDisruptionBudget, |
|
|
|
|
|
|
|
|
|
ingester_pdb: |
|
|
|
|
podDisruptionBudget.new() + |
|
|
|
|