k3s kubectl version reports
$ k3s kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6-k3s.1", GitCommit:"4cd85f14854d942e9016cc15f399785c103242e9", GitTreeState:"clean", BuildDate:"2019-08-19T16:12+00:00Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6-k3s.1", GitCommit:"4cd85f14854d942e9016cc15f399785c103242e9", GitTreeState:"clean", BuildDate:"2019-08-19T16:12+00:00Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
When that version is being read by kubernetes client from fabric8 (io.fabric8.kubernetes.client.VersionInfo) it causes an Unparseable date Exception: java.text.ParseException: Unparseable date: "2019-08-19T16:12+00:00Z"
Describe the bug
The BuildDate should be written/set in a ISO 8601 compliant format.
error message / stack trace:
ERROR PlatformFeaturesAvailability:76 - Detection of Kuberetes version failed.
io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:64) ~[io.fabric8.kubernetes-client-4.3.0.jar:?]
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:53) ~[io.fabric8.kubernetes-client-4.3.0.jar:?]
at io.fabric8.kubernetes.client.dsl.internal.ClusterOperationsImpl.fetchVersion(ClusterOperationsImpl.java:51) ~[io.fabric8.kubernetes-client-4.3.0.jar:?]
at io.fabric8.kubernetes.client.DefaultKubernetesClient.getVersion(DefaultKubernetesClient.java:283) ~[io.fabric8.kubernetes-client-4.3.0.jar:?]
at io.strimzi.operator.PlatformFeaturesAvailability.lambda$getVersionInfo$5(PlatformFeaturesAvailability.java:74) ~[io.strimzi.operator-common-0.13.0.jar:0.13.0]
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:272) ~[io.vertx.vertx-core-3.7.1.jar:3.7.1]
at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76) ~[io.vertx.vertx-core-3.7.1.jar:3.7.1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [io.netty.netty-common-4.1.34.Final.jar:4.1.34.Final]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
Caused by: java.text.ParseException: Unparseable date: "2019-08-19T16:12+00:00Z"
at java.text.DateFormat.parse(DateFormat.java:366) ~[?:1.8.0_222]
at io.fabric8.kubernetes.client.VersionInfo.<init>(VersionInfo.java:86) ~[io.fabric8.kubernetes-client-4.3.0.jar:?]
at io.fabric8.kubernetes.client.dsl.internal.ClusterOperationsImpl.fetchVersion(ClusterOperationsImpl.java:49) ~[io.fabric8.kubernetes-client-4.3.0.jar:?]
To Reproduce
for example try to install strimzi apache kafka operator through operatorhub.io (simplest way). The installation will fail with above exception.
Expected behavior
Any Kubernetes Client trying to read the kubernetes version should be able to successfully read the k3s kubernetes version. Thus the date should be parseable.
Currently the build date is $(date -u -Iminutes)Z which I thought was ISO8601 compliant.... @meierale do you know specifically what part of the date is wrong?
I wonder if +00:00Z is wrong and it's just supposed to be Z
date -u -Iminute | sed 's/+00:00/Z/' might be better
I wonder if
+00:00Zis wrong and it's just supposed to beZ
That would be my guess as well. 鉀筹笍 date -u '+%FT%RZ'
https://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators explains it pretty well. It should be either 2019-08-19T16:12+00:00 or 2019-08-19T16:12Z.
yes @tombentley - this is my understanding as well, either +00:00 or Z
I've just run into this issue trying to install the NetApp trident driver.
kubernetes itself uses the following to set the builddate
$(date ${SOURCE_DATE_EPOCH:+"--date=@${SOURCE_DATE_EPOCH}"} -u +'%Y-%m-%dT%H:%M:%SZ')
I have also run into this trying to install the NetApp Trident CSI plug-in.
Trident seems to use the go library function "json.Unmarshal" (see here), which apparently expects an RFC3339 style date. That means the time needs to have 3 parts, hours, minutes and seconds (see section 5.6 on page 7 in the RFC)
"buildDate": "2019-09-19T22:36Z" is missing the seconds and thus cannot be parsed by json.Unmarshal.
+1 for @shadowkrusha 's fix
@erikwilson has addressed in https://github.com/rancher/k3s/issues/808
Fix will be in v1.0.0-rc4
@darkstar @meierale this is fixed in v1.0.0-rc4 would you be able to give that a try?
Thanks, I鈥檒l test it out in a couple of hours.
@davidnuzik I have now been able to get past the installation error with the NetApp Trident driver.
INFO Trident installation succeeded.
Thank you
Thanks for reporting back!
Most helpful comment
I've just run into this issue trying to install the NetApp trident driver.
kubernetes itself uses the following to set the builddate
$(date ${SOURCE_DATE_EPOCH:+"--date=@${SOURCE_DATE_EPOCH}"} -u +'%Y-%m-%dT%H:%M:%SZ')