mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
kubeadm: detect runtime socket as URL format
- Update defaults for v1beta2 and 3 to have URL scheme - Raname DefaultUrlScheme to DefaultContainerRuntimeURLScheme - Prepend a missing URL scheme to user sockets and warn them that this might not be supported in the future - Update socket validation to exclude IsAbs() testing (This is broken on Windows). Assume the path is not empty and has URL scheme at this point (validation happens after defaulting). - Use net.Dial to open Unix sockets - Update all related unit tests Signed-off-by: pacoxu <paco.xu@daocloud.io> Signed-off-by: Lubomir I. Ivanov <lubomirivanov@vmware.com>
This commit is contained in:
committed by
Lubomir I. Ivanov
parent
7c013c3f64
commit
7594f0ef90
@@ -41,20 +41,20 @@ func TestAnnotateCRISocket(t *testing.T) {
|
||||
{
|
||||
name: "CRI-socket annotation missing",
|
||||
currentCRISocketAnnotation: "",
|
||||
newCRISocketAnnotation: "/run/containerd/containerd.sock",
|
||||
expectedPatch: `{"metadata":{"annotations":{"kubeadm.alpha.kubernetes.io/cri-socket":"/run/containerd/containerd.sock"}}}`,
|
||||
newCRISocketAnnotation: "unix:///run/containerd/containerd.sock",
|
||||
expectedPatch: `{"metadata":{"annotations":{"kubeadm.alpha.kubernetes.io/cri-socket":"unix:///run/containerd/containerd.sock"}}}`,
|
||||
},
|
||||
{
|
||||
name: "CRI-socket annotation already exists",
|
||||
currentCRISocketAnnotation: "/run/containerd/containerd.sock",
|
||||
newCRISocketAnnotation: "/run/containerd/containerd.sock",
|
||||
currentCRISocketAnnotation: "unix:///run/containerd/containerd.sock",
|
||||
newCRISocketAnnotation: "unix:///run/containerd/containerd.sock",
|
||||
expectedPatch: `{}`,
|
||||
},
|
||||
{
|
||||
name: "CRI-socket annotation needs to be updated",
|
||||
currentCRISocketAnnotation: "/var/run/dockershim.sock",
|
||||
newCRISocketAnnotation: "/run/containerd/containerd.sock",
|
||||
expectedPatch: `{"metadata":{"annotations":{"kubeadm.alpha.kubernetes.io/cri-socket":"/run/containerd/containerd.sock"}}}`,
|
||||
currentCRISocketAnnotation: "unix:///var/run/dockershim.sock",
|
||||
newCRISocketAnnotation: "unix:///run/containerd/containerd.sock",
|
||||
expectedPatch: `{"metadata":{"annotations":{"kubeadm.alpha.kubernetes.io/cri-socket":"unix:///run/containerd/containerd.sock"}}}`,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user