Skip to content

bitnami/zipkin Remove quote for the host#31374

Merged
fmulero merged 8 commits intobitnami:mainfrom
ptrekelsseg:zipkin-fix
Jan 21, 2025
Merged

bitnami/zipkin Remove quote for the host#31374
fmulero merged 8 commits intobitnami:mainfrom
ptrekelsseg:zipkin-fix

Conversation

@ptrekelsseg
Copy link
Copy Markdown
Contributor

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 version bumped in Chart.yaml according to semver. This is not necessary when the changes only affect README.md files.
  • Variables are documented in the values.yaml and added to the README.md using readme-generator-for-helm
  • Title of the pull request follows this pattern [bitnami/<name_of_the_chart>] Descriptive title
  • All commits signed off and in agreement of Developer Certificate of Origin (DCO)

@github-actions github-actions bot added zipkin triage Triage is needed labels Jan 15, 2025
@github-actions github-actions bot requested a review from javsalgar January 15, 2025 09:40
@carrodher carrodher added verify Execute verification workflow for these changes in-progress labels Jan 15, 2025
@github-actions github-actions bot removed the triage Triage is needed label Jan 15, 2025
@github-actions github-actions bot removed the request for review from javsalgar January 15, 2025 09:58
@github-actions github-actions bot requested a review from fmulero January 15, 2025 09:58
Copy link
Copy Markdown
Collaborator

@fmulero fmulero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

CASSANDRA_CONTACT_POINTS: {{ include "zipkin.cassandra.host" . }}:{{ include "zipkin.cassandra.port" . }}

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?

@ptrekels
Copy link
Copy Markdown
Contributor

@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.

@fmulero
Copy link
Copy Markdown
Collaborator

fmulero commented Jan 20, 2025

@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?

ptrekels and others added 6 commits January 21, 2025 08:17
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]>
Bitnami Containers and others added 2 commits January 21, 2025 07:19
Signed-off-by: Bitnami Containers <[email protected]>
Copy link
Copy Markdown
Collaborator

@fmulero fmulero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just added a little change. As I said I didn't the test my suggested change and there was a little failure.

@fmulero fmulero enabled auto-merge (squash) January 21, 2025 10:45
@fmulero fmulero merged commit 5955255 into bitnami:main Jan 21, 2025
@ptrekelsseg
Copy link
Copy Markdown
Contributor Author

ptrekelsseg commented Feb 10, 2025

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?

@fmulero
Copy link
Copy Markdown
Collaborator

fmulero commented Feb 10, 2025

Sorry @ptrekelsseg I don't fully understand, What issue are you facing now? Could you share how to reproduce it?

@ptrekelsseg
Copy link
Copy Markdown
Contributor Author

ptrekelsseg commented Feb 10, 2025

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: false

I checked out the bitnami charts locally and I'm able to reproduce the issue with:

helm template test bitnami/charts/bitnami/zipkin/ --values testoverlays/dev/zipkin-values.yaml --show-only templates/configmap.yaml

Here the external db host value is quoted: https://github.com/bitnami/charts/blob/main/bitnami/zipkin/templates/_helpers.tpl#L32
And here it is used: https://github.com/bitnami/charts/blob/main/bitnami/zipkin/templates/configmap.yaml#L16

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.

@ptrekelsseg ptrekelsseg deleted the zipkin-fix branch February 10, 2025 13:13
@ptrekelsseg
Copy link
Copy Markdown
Contributor Author

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'

@ptrekelsseg
Copy link
Copy Markdown
Contributor Author

ptrekelsseg commented Feb 10, 2025

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.

@ptrekelsseg
Copy link
Copy Markdown
Contributor Author

@fmulero : I pushed a proposal in #31866

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

solved verify Execute verification workflow for these changes zipkin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants