diff --git a/production/ksonnet/loki/common.libsonnet b/production/ksonnet/loki/common.libsonnet index 78bf19db7a1c..69aa58b2b7f2 100644 --- a/production/ksonnet/loki/common.libsonnet +++ b/production/ksonnet/loki/common.libsonnet @@ -44,45 +44,6 @@ local k = import 'ksonnet-util/kausal.libsonnet'; container.mixin.readinessProbe.httpGet.withPort($._config.http_listen_port) + container.mixin.readinessProbe.withInitialDelaySeconds(15) + container.mixin.readinessProbe.withTimeoutSeconds(1), - - // parseCPU is used for conversion of Kubernetes CPU units to the corresponding float value of CPU cores. - // Moreover, the function assumes the input is in a correct Kubernetes format, i.e., an integer, a float, - // a string representation of an integer or a float, or a string containing a number ending with 'm' - // representing a number of millicores. - // Examples: - // parseCPU(10) = parseCPU("10") = 10 - // parseCPU(4.5) = parse("4.5") = 4.5 - // parseCPU("3000m") = 3000 / 1000 - // parseCPU("3580m") = 3580 / 1000 - // parseCPU("3980.7m") = 3980.7 / 1000 - // parseCPU(0.5) = parse("0.5") = parse("500m") = 0.5 - parseCPU(v):: - if std.isString(v) && std.endsWith(v, 'm') then std.parseJson(std.rstripChars(v, 'm')) / 1000 - else if std.isString(v) then std.parseJson(v) - else if std.isNumber(v) then v - else 0, - - // siToBytes is used to convert Kubernetes byte units to bytes. - // Only works for limited set of SI prefixes: Ki, Mi, Gi, Ti. - siToBytes(str):: ( - // Utility converting the input to a (potentially decimal) number of bytes - local siToBytesDecimal(str) = ( - if std.endsWith(str, 'Ki') then ( - std.parseJson(std.rstripChars(str, 'Ki')) * std.pow(2, 10) - ) else if std.endsWith(str, 'Mi') then ( - std.parseJson(std.rstripChars(str, 'Mi')) * std.pow(2, 20) - ) else if std.endsWith(str, 'Gi') then ( - std.parseJson(std.rstripChars(str, 'Gi')) * std.pow(2, 30) - ) else if std.endsWith(str, 'Ti') then ( - std.parseJson(std.rstripChars(str, 'Ti')) * std.pow(2, 40) - ) else ( - std.parseJson(str) - ) - ); - - // Round down to nearest integer - std.floor(siToBytesDecimal(str)) - ), }, // functions for k8s objects