Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes: Cannot convert int64 to string. Kubernetes fails to interpret integer value in helmchart values.yaml file

I have a values.yaml file in which I have given spring_datasource_hikari_maximum_pool_size: "10"

In deployment yaml I have used this value as

 - name: SPRING_DATASOURCE_HIKARI_MAXIMUM-POOL-SIZE
    value: {{ .Values.spring_datasource_hikari_maximum_pool_size }}

However, when used inside the deployment.yaml file it fails with the below error.


Deploy failed: The request is invalid: patch: Invalid value: "map[metadata:map[annotations:map[kubectl.kubernetes.io/last-applied-configuration:{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":
{
(helm values etc)
`{"name":"SPRING_DATASOURCE_HIKARI_MAXIMUM-POOL-SIZE","value":10}]` **(this is the incorrect value)** 
}
cannot convert int64 to string

What is the correct format of using an integer value from values.yaml file in a deployment.yaml file?

I have also tried multiple combinations with quotes "" but nothing seems to be working.

Any help is appreciated, Thanks in advance.

like image 794
Mohammed Idris Avatar asked Jan 21 '26 14:01

Mohammed Idris


1 Answers

I was able to resolve this by using double quotes on the value itself in deployment.yaml file

- name: SPRING_DATASOURCE_HIKARI_MAXIMUM-POOL-SIZE
  value: "{{ .Values.spring_datasource_hikari_maximum_pool_size }}"

Since this was a production instance I could not check with @David Maze and Vit's solution.

Edit:

Tried with quote option and it worked too.

 - name: SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE 
   value: {{ quote .Values.spring_datasource_hikari_maximum_pool_size }}
like image 59
Mohammed Idris Avatar answered Jan 24 '26 09:01

Mohammed Idris