diff --git a/CHANGELOG.md b/CHANGELOG.md index cb0eb029..4a60dcc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ We use *breaking* word for marking changes that are not backward compatible (rel - [#237](https://github.com/thanos-io/kube-thanos/pull/237) Add new bucket replicate component. - [#245](https://github.com/thanos-io/kube-thanos/pull/245) Support scraping config reloader sidecar for ruler. +- [#251](https://github.com/thanos-io/kube-thanos/pull/251) Add support for extraEnv (custom environment variables) to all components. ### Fixed diff --git a/jsonnet/kube-thanos/kube-thanos-bucket-replicate.libsonnet b/jsonnet/kube-thanos/kube-thanos-bucket-replicate.libsonnet index 3c05c9ce..50e84f1f 100644 --- a/jsonnet/kube-thanos/kube-thanos-bucket-replicate.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-bucket-replicate.libsonnet @@ -20,6 +20,7 @@ local defaults = { maxTime: '', compactionLevels: [], resolutions: [], + extraEnv: [], commonLabels:: { 'app.kubernetes.io/name': 'thanos-bucket-replicate', @@ -138,7 +139,9 @@ function(params) { }, }, }, - ], + ] + ( + if std.length(tbr.config.extraEnv) > 0 then tbr.config.extraEnv else [] + ), ports: [ { name: name, containerPort: tbr.config.ports[name] } for name in std.objectFields(tbr.config.ports) diff --git a/jsonnet/kube-thanos/kube-thanos-bucket.libsonnet b/jsonnet/kube-thanos/kube-thanos-bucket.libsonnet index 600b036a..549176b2 100644 --- a/jsonnet/kube-thanos/kube-thanos-bucket.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-bucket.libsonnet @@ -15,6 +15,7 @@ local defaults = { http: 10902, }, tracing: {}, + extraEnv: [], commonLabels:: { 'app.kubernetes.io/name': 'thanos-bucket', @@ -118,7 +119,9 @@ function(params) { }, }, }, - ], + ] + ( + if std.length(tb.config.extraEnv) > 0 then tb.config.extraEnv else [] + ), ports: [ { name: name, containerPort: tb.config.ports[name] } for name in std.objectFields(tb.config.ports) diff --git a/jsonnet/kube-thanos/kube-thanos-compact-default-params.libsonnet b/jsonnet/kube-thanos/kube-thanos-compact-default-params.libsonnet index 07705727..6d7fbf9f 100644 --- a/jsonnet/kube-thanos/kube-thanos-compact-default-params.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-compact-default-params.libsonnet @@ -23,6 +23,7 @@ http: 10902, }, tracing: {}, + extraEnv: [], commonLabels:: { 'app.kubernetes.io/name': 'thanos-compact', diff --git a/jsonnet/kube-thanos/kube-thanos-compact.libsonnet b/jsonnet/kube-thanos/kube-thanos-compact.libsonnet index 78c7e0ef..cdc14b13 100644 --- a/jsonnet/kube-thanos/kube-thanos-compact.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-compact.libsonnet @@ -93,7 +93,9 @@ function(params) { }, }, }, - ], + ] + ( + if std.length(tc.config.extraEnv) > 0 then tc.config.extraEnv else [] + ), ports: [ { name: name, containerPort: tc.config.ports[name] } for name in std.objectFields(tc.config.ports) diff --git a/jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet b/jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet index be655e4f..9bcb4ae1 100644 --- a/jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet @@ -29,6 +29,7 @@ local defaults = { http: 9090, }, tracing: {}, + extraEnv: [], memcachedDefaults+:: { config+: { @@ -179,7 +180,9 @@ function(params) { }, }, }, - ], + ] + ( + if std.length(tqf.config.extraEnv) > 0 then tqf.config.extraEnv else [] + ), ports: [ { name: name, containerPort: tqf.config.ports[name] } for name in std.objectFields(tqf.config.ports) diff --git a/jsonnet/kube-thanos/kube-thanos-query.libsonnet b/jsonnet/kube-thanos/kube-thanos-query.libsonnet index db1d3b87..f00b9602 100644 --- a/jsonnet/kube-thanos/kube-thanos-query.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-query.libsonnet @@ -24,6 +24,7 @@ local defaults = { logLevel: 'info', logFormat: 'logfmt', tracing: {}, + extraEnv: [], commonLabels:: { 'app.kubernetes.io/name': 'thanos-query', @@ -150,7 +151,9 @@ function(params) { }, }, }, - ], + ] + ( + if std.length(tq.config.extraEnv) > 0 then tq.config.extraEnv else [] + ), ports: [ { name: port.name, containerPort: port.port } for port in tq.service.spec.ports diff --git a/jsonnet/kube-thanos/kube-thanos-receive-default-params.libsonnet b/jsonnet/kube-thanos/kube-thanos-receive-default-params.libsonnet index baa94506..200abd59 100644 --- a/jsonnet/kube-thanos/kube-thanos-receive-default-params.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-receive-default-params.libsonnet @@ -30,6 +30,7 @@ 'receive="true"', ], tenantLabelName: null, + extraEnv: [], commonLabels:: { 'app.kubernetes.io/name': 'thanos-receive', diff --git a/jsonnet/kube-thanos/kube-thanos-receive-router.libsonnet b/jsonnet/kube-thanos/kube-thanos-receive-router.libsonnet index cc65db6e..9a6edbd2 100644 --- a/jsonnet/kube-thanos/kube-thanos-receive-router.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-receive-router.libsonnet @@ -111,7 +111,9 @@ function(params) { }, }, }, - ], + ] + ( + if std.length(tr.config.extraEnv) > 0 then tr.config.extraEnv else [] + ), ports: [{ name: name, containerPort: tr.config.ports[name] } for name in std.objectFields(tr.config.ports)], volumeMounts: [{ name: 'hashring-config', mountPath: '/var/lib/thanos-receive' }], livenessProbe: { failureThreshold: 8, periodSeconds: 30, httpGet: { diff --git a/jsonnet/kube-thanos/kube-thanos-receive.libsonnet b/jsonnet/kube-thanos/kube-thanos-receive.libsonnet index 3ec6ccd7..eca57b4e 100644 --- a/jsonnet/kube-thanos/kube-thanos-receive.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-receive.libsonnet @@ -113,6 +113,8 @@ function(params) { name: tr.config.objectStorageConfig.name, } }, }] else [] + ) + ( + if std.length(tr.config.extraEnv) > 0 then tr.config.extraEnv else [] ), ports: [ { name: name, containerPort: tr.config.ports[name] } diff --git a/jsonnet/kube-thanos/kube-thanos-rule.libsonnet b/jsonnet/kube-thanos/kube-thanos-rule.libsonnet index 50402844..b3fc6960 100644 --- a/jsonnet/kube-thanos/kube-thanos-rule.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-rule.libsonnet @@ -26,6 +26,7 @@ local defaults = { reloader: 9533, }, tracing: {}, + extraEnv: [], commonLabels:: { 'app.kubernetes.io/name': 'thanos-rule', @@ -146,7 +147,9 @@ function(params) { }, }, }, - ], + ] + ( + if std.length(tr.config.extraEnv) > 0 then tr.config.extraEnv else [] + ), ports: [ { name: name, containerPort: tr.config.ports[name] } for name in std.objectFields(tr.config.ports) diff --git a/jsonnet/kube-thanos/kube-thanos-store-default-params.libsonnet b/jsonnet/kube-thanos/kube-thanos-store-default-params.libsonnet index caaa9046..b5fc7138 100644 --- a/jsonnet/kube-thanos/kube-thanos-store-default-params.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-store-default-params.libsonnet @@ -24,6 +24,7 @@ tracing: {}, minTime: '', maxTime: '', + extraEnv: [], memcachedDefaults+:: { config+: { diff --git a/jsonnet/kube-thanos/kube-thanos-store.libsonnet b/jsonnet/kube-thanos/kube-thanos-store.libsonnet index fbff3768..d1d51368 100644 --- a/jsonnet/kube-thanos/kube-thanos-store.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-store.libsonnet @@ -99,10 +99,15 @@ function(params) { ] else [] ), env: [ - { name: 'OBJSTORE_CONFIG', valueFrom: { secretKeyRef: { - key: ts.config.objectStorageConfig.key, - name: ts.config.objectStorageConfig.name, - } } }, + { + name: 'OBJSTORE_CONFIG', + valueFrom: { + secretKeyRef: { + key: ts.config.objectStorageConfig.key, + name: ts.config.objectStorageConfig.name, + }, + }, + }, { // Inject the host IP to make configuring tracing convenient. name: 'HOST_IP_ADDRESS', @@ -112,7 +117,9 @@ function(params) { }, }, }, - ], + ] + ( + if std.length(ts.config.extraEnv) > 0 then ts.config.extraEnv else [] + ), ports: [ { name: name, containerPort: ts.config.ports[name] } for name in std.objectFields(ts.config.ports)