Helm getting into year 2038 issue
lbs.set("modifiedAt", strconv.Itoa(int(time.Now().Unix()))) this line is getting to the unix 2038 issue resulting failure of secret creation with below error. Error: INSTALLATION FAILED: create: failed to create: Secret "sh.helm.release.v1.operator.v1" is invalid: metadata.labels: Invalid value: "-2147255893": a valid label must be an empty string or consist of alphanumeric characters, '-', '' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9.])?[A-Za-z0-9])?') helm.go:84: [debug] Secret "sh.helm.release.v1.operator.v1" is invalid: metadata.labels: Invalid value: "-2147255893": a valid label must be an empty string or consist of alphanumeric characters, '-', '' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9.])?[A-Za-z0-9])?')
https://github.com/helm/helm/blob/e81f6140ddb22bc99a08f7409522a8dbe5338ee3/pkg/storage/driver/secrets.go#L180C2-L180C61
lbs.set("modifiedAt", strconv.Itoa(int(time.Now().Unix())))
interesting looks like its casting Int (32bit) in an int64 (which is what is returned by time.Now().Unix()). I suspect the reason is that Itoa requires a int as a param...
I think the best method is to use strconv.FormatInt() instead of strconv.itoa() - but I'm very open to being wrong about this: I tested here: https://play.golang.com/p/y4HMAegdQ_r but I would apprechiate a call out if there is a better way to do this :)
Another option https://play.golang.com/p/944m5DvpxD-
// Format it as a string
str := fmt.Sprintf("%v", t.Unix())
That is a fantastic approach too. I know the input is only the unix time so it shouldn't be much of a concern but trying to think about safety and validations of inputs wont cause the program to crash with edge cases. I don't think that's too much of a concern - I'll update the PR with the recommendation!
Hello! Is Kubernetes or Helm in this case running on a 32bit system? Thanks!
Is Kubernetes or Helm in this case running on a 32bit system?
I'm not sure directly. But I think it is expected that 32-bit systems are affected by the 2028 problem. So even if Helm, or Kubernetes could be compiled for a 32-architecture, it would be expected they would not be able to handle epoch offsets for 2038 and beyond.
ie. a solution should not try and work on 32-bit architectures.