kubernetes: fix runtime init error caused by git shallow tarball
PATCH 1/1 kubernetes: fix runtime init error caused by git shallow tarball
From: Chen Qi <[email protected]>
k8s uses 'git describe' to determine its version and passes it to go ldflags at build time. This value is actually very important, because 'kubeadm init' will use it.
In case of shallow tarball, the git history is not complete and the command 'git describe' not succeed, resulting in a default version, v0.0.0-master+$Format:%H$. This causes 'kubeadm init' failure like below:
[init] Using Kubernetes version: v1.0.0-placeholder-version [preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR KubeletVersion]: couldn't get kubelet version: Unable to parse output from Kubelet: "Kubernetes v0.0.0-master+$Format:%H$"
Fix this by exporting KUBE_GIT_VERSION explicitly. This export line is deliberately put right under the PV & SRCREV settings so that when people upgrade k8s, they don't forget to update this value too.
--- recipes-containers/kubernetes/kubernetes_git.bb | 5 +++++ 1 file changed, 5 insertions(+)
recipes-containers/kubernetes/kubernetes_git.bb +5 -0
@@ -10,6 +10,11 @@ CVE_VERSION = "1.29.1" SRCREV_kubernetes = "a02da633101bd7919153dd56412b09221c0139bf" SRCREV_kubernetes-release = "21382abdbfa8e6a43fd417306fa649cb651cc06e" PE = "1" +# NOTE: update the following value when upgrading k8s +# The value is derived from the following command in k8s repo: +# git describe --tags --match='v*' --abbrev=14 "a02da633101bd7919153dd56412b09221c0139bf^{commit}" +# This following setting is needed in case, otherwise there'll be runtime error in case of shallow tarball. +export KUBE_GIT_VERSION="v1.29.1-1-ga02da633101bd7" BBCLASSEXTEND = "devupstream:target" LIC_FILES_CHKSUM:class-devupstream = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
Signature · 1 line
2.25.1
Quoted 18 lines · Chen Qi via lists.yoctoproject.org
From: Chen Qi <[email protected]>
k8s uses 'git describe' to determine its version and passes it to go ldflags at build time. This value is actually very important, because 'kubeadm init' will use it.
In case of shallow tarball, the git history is not complete and the command 'git describe' not succeed, resulting in a default version, v0.0.0-master+$Format:%H$. This causes 'kubeadm init' failure like below:
[init] Using Kubernetes version: v1.0.0-placeholder-version [preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR KubeletVersion]: couldn't get kubelet version: Unable to parse output from Kubelet: "Kubernetes v0.0.0-master+$Format:%H$"
Quoted 4 lines
Fix this by exporting
KUBE_GIT_VERSIONexplicitly. This export line is deliberately put right under the PV & SRCREV settings so that when people upgrade k8s, they don't forget to update this value too.
This is something that either needs to be carried in your layers .. or ..
If it is to merge to meta-virt, it should just use our existing PV and SRCREV values
and be conditional on shallow clones being enabled, since it is working around a limitation of those that choose to use shallow clones.
Cheers,
Bruce
Quoted 34 lines
Signed-off-by Chen Qi <[email protected]>--- recipes-containers/kubernetes/kubernetes_git.bb | 5 +++++ 1 file changed, 5 insertions(+)recipes-containers/kubernetes/kubernetes_git.bb +5
-1@@ -10,6 +10,11 @@ CVE_VERSION = "1.29.1" SRCREV_kubernetes = "a02da633101bd7919153dd56412b09221c0139bf" SRCREV_kubernetes-release = "21382abdbfa8e6a43fd417306fa649cb651cc06e" PE = "1" +# NOTE: update the following value when upgrading k8s +# The value is derived from the following command in k8s repo: +# git describe --tags --match='v*' --abbrev=14 "a02da633101bd7919153dd56412b09221c0139bf^{commit}" +# This following setting is needed in case, otherwise there'll be runtime error in case of shallow tarball. +export KUBE_GIT_VERSION="v1.29.1-1-ga02da633101bd7" BBCLASSEXTEND = "devupstream:target" LIC_FILES_CHKSUM:class-devupstream = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" --2.25.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8850): https://lists.yoctoproject.org/g/meta-virtualization/message/8850
Mute This Topic: https://lists.yoctoproject.org/mt/107661203/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II