Skip to content

install/kubernetes: change mapDynamicSizeRatio from number to string #39834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025

Conversation

aanm
Copy link
Member

@aanm aanm commented Jun 2, 2025

Reverts type change from "number" to "string" for bpf.mapDynamicSizeRatio, which caused Helm schema validation to fail when setting it as a float.

This restores compatibility with the expected numeric input:
--set bpf.mapDynamicSizeRatio=0.08

Fixes: 79733d2 ("helm: Introduce values.schema.json and tooling")

Fixes #39823

@aanm aanm requested review from a team as code owners June 2, 2025 12:46
@aanm aanm added kind/bug This is a bug in the Cilium logic. area/misc Impacts miscellaneous areas of the code not otherwise owned by another area. labels Jun 2, 2025
@aanm aanm requested a review from youngnick June 2, 2025 12:46
@aanm aanm added release-note/bug This PR fixes an issue in a previous release of Cilium. area/helm Impacts helm charts and user deployment experience labels Jun 2, 2025
@aanm aanm requested a review from squeed June 2, 2025 12:46
@aanm aanm added needs-backport/1.17 This PR / issue needs backporting to the v1.17 branch affects/v1.16 This issue affects v1.16 branch affects/v1.17 This issue affects v1.17 branch labels Jun 2, 2025
@aanm aanm enabled auto-merge June 2, 2025 12:55
@aanm
Copy link
Member Author

aanm commented Jun 2, 2025

/test

Copy link
Member

@gandro gandro left a comment

Choose a reason for hiding this comment

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

number is a valid schema type. Changing it to string breaks users who have set this field via a values.yaml file as you yourself suggested here (and which was confirmed to work): #39823 (comment)

Note that it possible to set the number via --set-json in Helm:

helm template cilium/cilium --set-json bpf.mapDynamicSizeRatio=0.08

Ultimately, I think the linked issue here is an issue with Cilium CLI and the fact that it has no option to pass number values.

Also note that changing the type to a string breaks this comparision here, as 0.0 is not equal "0.0":

{{- else if ne $defaultBpfMapDynamicSizeRatio 0.0 }}

@aanm
Copy link
Member Author

aanm commented Jun 2, 2025

@gandro thanks for the review. What if, instead of replacing number with string, I add string. This will make both modes to work.

WRT the comparison part, be aware that $defaultBpfMapDynamicSizeRatio != bpf.mapDynamicSizeRatio

@aanm aanm requested a review from gandro June 2, 2025 15:08
@gandro
Copy link
Member

gandro commented Jun 2, 2025

I think adding a string should indeed work. Good point with the comparison, I didn't realize the variable was not derived from the Helm value.

There is one oddity with regards to making a string work though: I think using 0.0 (as a number) will make the chart fallback to $defaultBpfMapDynamicSizeRatio, where as using "0.0" (as a string) will not. You probably want to adjust the if guard here (e.g. using float64 to convert the string to a float)

{{- if .Values.bpf.mapDynamicSizeRatio }}

@gandro gandro removed their request for review June 3, 2025 07:25
Add type "string" for bpf.mapDynamicSizeRatio, which caused Helm schema
validation to fail when setting it as a float.

This restores compatibility with the expected numeric input:
  --set bpf.mapDynamicSizeRatio=0.08

Fixes: 79733d2 ("helm: Introduce values.schema.json and tooling")
Signed-off-by: André Martins <andre@cilium.io>
@aanm aanm requested a review from gandro June 3, 2025 10:45
@aanm aanm force-pushed the pr/fix-helm-dynamic branch from 4776b5e to 8ed5598 Compare June 3, 2025 10:45
@aanm
Copy link
Member Author

aanm commented Jun 3, 2025

/test

Copy link
Member

@gandro gandro left a comment

Choose a reason for hiding this comment

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

Thanks!

@aanm aanm added this pull request to the merge queue Jun 3, 2025
Merged via the queue into cilium:main with commit f6ac7fb Jun 3, 2025
68 checks passed
@aanm aanm deleted the pr/fix-helm-dynamic branch June 3, 2025 13:19
@rastislavs rastislavs mentioned this pull request Jun 9, 2025
2 tasks
@rastislavs rastislavs added backport-pending/1.17 The backport for Cilium 1.17.x for this PR is in progress. and removed needs-backport/1.17 This PR / issue needs backporting to the v1.17 branch labels Jun 9, 2025
@github-actions github-actions bot added backport-done/1.17 The backport for Cilium 1.17.x for this PR is done. and removed backport-pending/1.17 The backport for Cilium 1.17.x for this PR is in progress. labels Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects/v1.16 This issue affects v1.16 branch affects/v1.17 This issue affects v1.17 branch area/helm Impacts helm charts and user deployment experience area/misc Impacts miscellaneous areas of the code not otherwise owned by another area. backport-done/1.17 The backport for Cilium 1.17.x for this PR is done. kind/bug This is a bug in the Cilium logic. release-note/bug This PR fixes an issue in a previous release of Cilium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bpf.mapDynamicSizeRatio: Invalid type. Expected: [null,number], given: string
3 participants