bitnami/zipkin Remove quote for the host#31374
Conversation
fmulero
left a comment
There was a problem hiding this comment.
Thanks a lot @ptrekels for your contribution.
I don't have clear the error your are trying to fix. If I understood well the issue is here:
So it should be fixed there with something like this (not tested):
CASSANDRA_CONTACT_POINTS: {{ printf "%s:%d" ( include "zipkin.cassandra.host" . ) ( include "zipkin.cassandra.port" . ) }}Could you share more details about your issue and how to reproduce it?
|
@fmulero indeed the error is in that line 16 of the configmap template. As the host string would be quoted there this would introduce something like "aa.bb.com":1234 This of course is no legal yaml syntax and so my helm complained about it. Steps to reproduce it was simply trying to use an external cassandra db.. And printf fix is indeed also possible and maybe a better fix. |
Got it. Could you go ahead with the proposed change? |
This is needed because it will later be combined with the port in the configmap. Signed-off-by: Peter Trekels <[email protected]>
Signed-off-by: Bitnami Containers <[email protected]> Signed-off-by: Peter Trekels <[email protected]>
This reverts commit 5f00e02. Signed-off-by: Peter Trekels <[email protected]>
Signed-off-by: Peter Trekels <[email protected]>
Signed-off-by: Peter Trekels <[email protected]>
Signed-off-by: Bitnami Containers <[email protected]> Signed-off-by: Peter Trekels <[email protected]>
ee938ef to
b256a6c
Compare
Signed-off-by: Bitnami Containers <[email protected]>
Signed-off-by: Fran Mulero <[email protected]>
fmulero
left a comment
There was a problem hiding this comment.
I've just added a little change. As I said I didn't the test my suggested change and there was a little failure.
|
I did not used this fix correctly until now it seems. And it seems there is still an issue. The zipkin.cassandra.host is quoted and so introduces the issue I think. CASSANDRA_CONTACT_POINTS: {{ printf "%s:%d" ( include "zipkin.cassandra.host" . | replace """ "" ) ( include "zipkin.cassandra.port" . | int ) }} 'unquoting' it seems to fix the issue for me, but don't now if this is the best solution? @fmulero : what would you propose? |
|
Sorry @ptrekelsseg I don't fully understand, What issue are you facing now? Could you share how to reproduce it? |
|
I'm simply using a values file like this: storageType: cassandra3
externalDatabase:
host: cascluster-dev-service
port: 9042
user: cassandra-zipkin
existingSecret: cascluster-user-zipkin
existingSecretPasswordKey: password
cluster:
datacenter: dev
keyspace: bitnami_zipkin
cassandra:
enabled: falseI checked out the bitnami charts locally and I'm able to reproduce the issue with: Here the external db host value is quoted: https://github.com/bitnami/charts/blob/main/bitnami/zipkin/templates/_helpers.tpl#L32 And like I said, I tested your change. But was wrong and I was still using my old fix.. So I did not notice your fix still gives an issue. |
|
and to give you all the info, the output of the command is: ---
# Source: zipkin/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: test-zipkin
namespace: "segdev"
labels:
app.kubernetes.io/instance: test
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: zipkin
app.kubernetes.io/version: 3.4.4
helm.sh/chart: zipkin-1.1.3
app.kubernetes.io/component: zipkin
app.kubernetes.io/part-of: zipkin
data:
Error: 'error converting YAML to JSON: yaml: line 5: did not find expected key' |
|
2 possible solutions I tested: CASSANDRA_CONTACT_POINTS: {{ printf "%s:%d" ( trimAll "\"" (include "zipkin.cassandra.host" .) ) ( include "zipkin.cassandra.port" . | int ) }}
CASSANDRA_CONTACT_POINTS2: {{ printf "%s:%d" ( include "zipkin.cassandra.host" . | replace "\"" "" ) ( include "zipkin.cassandra.port" . | int ) }}Or the 3e solution of course removing the quote in the helpers template: diff --git a/bitnami/zipkin/templates/_helpers.tpl b/bitnami/zipkin/templates/_helpers.tpl
index ab0cd9534e..dcf39107d9 100644
--- a/bitnami/zipkin/templates/_helpers.tpl
+++ b/bitnami/zipkin/templates/_helpers.tpl
@@ -29,7 +29,7 @@ Create the cassandra host
*/}}
{{- define "zipkin.cassandra.host" -}}
{{- if not .Values.cassandra.enabled -}}
- {{- .Values.externalDatabase.host | quote -}}
+ {{- .Values.externalDatabase.host -}}
{{- else -}}
{{- include "common.names.dependency.fullname" (dict "chartName" "cassandra" "chartValues" .Values.cassandra "context" $) -}}
{{- end }}zipkin.cassandra.host is also used in ./zipkin/templates/_init_containers.tpl so it will now be unquoted there also, or we can re-add the quote call there. |
This is needed because it will later be combined with the port in the configmap.
Description of the change
Removed the quote from the host value so it can be combined in configmap with the port.
Benefits
Now it is possible to use external database.
Possible drawbacks
None
Applicable issues
None
Additional information
Nothing.
Checklist
Chart.yamlaccording to semver. This is not necessary when the changes only affect README.md files.README.mdusing readme-generator-for-helm