From 11ed80121a3858b63527b8be61cb42655c5e8725 Mon Sep 17 00:00:00 2001 From: Craig Furman Date: Mon, 14 Dec 2020 15:28:29 +0000 Subject: [PATCH] Make cache types case insensitive This appears to be the case in thanos itself (https://github.com/thanos-io/thanos/blob/master/pkg/queryfrontend/config.go#L81 and https://github.com/thanos-io/thanos/blob/master/pkg/store/cache/factory.go#L45). The thanos docs use upper-case cache types. Signed-off-by: Craig Furman --- CHANGELOG.md | 2 +- jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet | 8 ++++---- jsonnet/kube-thanos/kube-thanos-store.libsonnet | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d9b7f15..666b762b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ We use *breaking* word for marking changes that are not backward compatible (rel ### Fixed -- +- [#185](https://github.com/thanos-io/kube-thanos/pull/185)A query-frontend, store: make cache types case insensitive ## [v0.17.0](https://github.com/thanos-io/kube-thanos/tree/v0.17.0) (2020-12-08) diff --git a/jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet b/jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet index c2e798e9..e30792d1 100644 --- a/jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet @@ -67,24 +67,24 @@ function(params) { queryRangeCache+: if std.objectHas(params, 'queryRangeCache') && std.objectHas(params.queryRangeCache, 'type') - && params.queryRangeCache.type == 'memcached' then + && std.asciiUpper(params.queryRangeCache.type) == 'MEMCACHED' then defaults.memcachedDefaults + params.queryRangeCache else if std.objectHas(params, 'queryRangeCache') && std.objectHas(params.queryRangeCache, 'type') - && params.queryRangeCache.type == 'in-memory' then + && std.asciiUpper(params.queryRangeCache.type) == 'IN-MEMORY' then defaults.fifoCache + params.queryRangeCache else {}, labelsCache+: if std.objectHas(params, 'labelsCache') && std.objectHas(params.labelsCache, 'type') - && params.labelsCache.type == 'memcached' then + && std.asciiUpper(params.labelsCache.type) == 'MEMCACHED' then defaults.memcachedDefaults + params.labelsCache else if std.objectHas(params, 'labelsCache') && std.objectHas(params.labelsCache, 'type') - && params.labelsCache.type == 'in-memory' then + && std.asciiUpper(params.labelsCache.type) == 'IN-MEMORY' then defaults.fifoCache + params.labelsCache else {}, diff --git a/jsonnet/kube-thanos/kube-thanos-store.libsonnet b/jsonnet/kube-thanos/kube-thanos-store.libsonnet index 01516fa0..cc2b236e 100644 --- a/jsonnet/kube-thanos/kube-thanos-store.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-store.libsonnet @@ -9,13 +9,13 @@ function(params) { indexCache+: if std.objectHas(params, 'indexCache') && std.objectHas(params.indexCache, 'type') - && params.indexCache.type == 'memcached' then + && std.asciiUpper(params.indexCache.type) == 'MEMCACHED' then defaults.memcachedDefaults + defaults.indexCacheDefaults + params.indexCache else {}, bucketCache+: if std.objectHas(params, 'bucketCache') && std.objectHas(params.bucketCache, 'type') - && params.bucketCache.type == 'memcached' then + && std.asciiUpper(params.bucketCache.type) == 'MEMCACHED' then defaults.memcachedDefaults + defaults.bucketCacheMemcachedDefaults + params.bucketCache else {}, },