You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wi...@apache.org on 2023/07/14 09:55:25 UTC
[couchdb-helm] 01/01: fix: convert float64s to integers
This is an automated email from the ASF dual-hosted git repository.
willholley pushed a commit to branch fix-float64-values
in repository https://gitbox.apache.org/repos/asf/couchdb-helm.git
commit 7a9fce25f3eef88f951403fa6f12b23e4014a6a5
Author: Will Holley <wi...@uk.ibm.com>
AuthorDate: Fri Jul 14 10:47:51 2023 +0100
fix: convert float64s to integers
If a large integer is specifed in values.yaml, it is parsed by Helm
as a float64. For example:
```
couchdbConfig:
chttpd:
timeout: 5184000
```
If this is converted to a string, it produces `5.184e+06` instead of
the expected `5184000`.
Given we never expect floats to be specified as configuration values
to CouchDB, we can workaround this erroneus type conversion by
casting the float64 back to an integer when rendering the ini file.
This then correctly outputs:
```
inifile: |
[chttpd]
timeout = 5184000
```
Note this will break any genuine uses of float64 types in the
configuration, though I can't think of any cases where this would be
valid.
---
couchdb/Chart.yaml | 2 +-
couchdb/templates/configmap.yaml | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/couchdb/Chart.yaml b/couchdb/Chart.yaml
index aeb3551..fb81f90 100644
--- a/couchdb/Chart.yaml
+++ b/couchdb/Chart.yaml
@@ -1,6 +1,6 @@
apiVersion: v1
name: couchdb
-version: 4.4.1
+version: 4.4.2
appVersion: 3.3.2
description: A database featuring seamless multi-master sync, that scales from
big data to mobile, with an intuitive HTTP/JSON API and designed for
diff --git a/couchdb/templates/configmap.yaml b/couchdb/templates/configmap.yaml
index 55bbf3b..9084223 100644
--- a/couchdb/templates/configmap.yaml
+++ b/couchdb/templates/configmap.yaml
@@ -14,9 +14,12 @@ data:
{{- range $section, $settings := $couchdbConfig -}}
{{ printf "[%s]" $section }}
{{ range $key, $value := $settings -}}
- {{ printf "%s = %s" $key ($value | toString) }}
- {{ end }}
+ {{- if kindIs "float64" $value }}
+ {{- $value = (int $value) }}
+ {{- end }}
+ {{- printf "%s = %v" $key $value }}
{{ end }}
+ {{ end -}}
seedlistinifile: |
[cluster]