Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

helm 3 .Release.time.Seconds does not exist

I am now working in the migration from helm 2 to 3.

I am using the value of .Release.time.Seconds in my charts. I have seen that in helm 3 .Release.time does not exists. Trying to use now as it is explained in this stackoverflow question, I can do the instalation, but I do not get the expected value.

For example, with the following code:

 template:
    metadata:
      labels:
        dateInSeconds: "{{ .Release.Time.Seconds }}" 

The label gets the value dateInSeconds: 1611923156

If I use the now function:

 template:
    metadata:
      labels:
        dateInSeconds: {{ now | quote }}  

The label gets the value dateInSeconds: "2021-02-01 12:05:28.6116854 +0100 CET m=+2.394553701"

like image 842
pcampana Avatar asked Oct 12 '25 00:10

pcampana


2 Answers

I have found the solution in sprig. For getting the epoch time I can use unixEpoch.

So the solution is:

template:
    metadata:
      labels:
        dateInSeconds: {{ now | unixEpoch | quote}}   
like image 65
pcampana Avatar answered Oct 14 '25 21:10

pcampana


You can use the below instead.

{{ now | unixEpoch }}
like image 42
Shuo Avatar answered Oct 14 '25 22:10

Shuo