Skip to content

Commit 3f5d217

Browse files
committed
nodeup: drop containerized mounter and Archive task
mounter.tar (kubernetes-release/gci-mounter, frozen since Jan 2017) was the sole caller of nodetasks.Archive and the only consumer of kubelet's --experimental-mounter-path flag, which has been deprecated upstream since k8s 1.19 with three stalled removal attempts in k/k. The last real consumer was in-tree NFS PVs resolving cluster-internal Service DNS names on COS; affected users should migrate to kubernetes-csi/csi-driver-nfs.
1 parent 959c84e commit 3f5d217

8 files changed

Lines changed: 3 additions & 416 deletions

File tree

nodeup/pkg/model/kubelet.go

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"io"
2424
"net"
2525
"os"
26-
"path"
2726
"path/filepath"
2827
"strings"
2928
"time"
@@ -50,9 +49,6 @@ import (
5049
)
5150

5251
const (
53-
// containerizedMounterHome is the path where we install the containerized mounter (on ContainerOS)
54-
containerizedMounterHome = "/home/kubernetes/containerized_mounter"
55-
5652
// kubeletService is the name of the kubelet service
5753
kubeletService = "kubelet.service"
5854

@@ -183,10 +179,6 @@ func (b *KubeletBuilder) Build(c *fi.NodeupModelBuilderContext) error {
183179
})
184180
}
185181

186-
if err := b.addContainerizedMounter(c); err != nil {
187-
return err
188-
}
189-
190182
if b.UseExternalKubeletCredentialProvider() {
191183
switch b.CloudProvider() {
192184
case kops.CloudProviderGCE:
@@ -363,11 +355,6 @@ func (b *KubeletBuilder) buildSystemdEnvironmentFile(ctx context.Context, kubele
363355
}
364356
}
365357

366-
if b.usesContainerizedMounter() {
367-
// We don't want to expose this in the model while it is experimental, but it is needed on COS
368-
flags += " --experimental-mounter-path=" + path.Join(containerizedMounterHome, "mounter")
369-
}
370-
371358
// Add container runtime spcific flags
372359
flags += " --runtime-request-timeout=15m"
373360
if b.NodeupConfig.ContainerdConfig.Address == nil {
@@ -449,16 +436,6 @@ func (b *KubeletBuilder) buildSystemdService() *nodetasks.Service {
449436
return service
450437
}
451438

452-
// usesContainerizedMounter returns true if we use the containerized mounter
453-
func (b *KubeletBuilder) usesContainerizedMounter() bool {
454-
switch b.Distribution {
455-
case distributions.DistributionContainerOS:
456-
return true
457-
default:
458-
return false
459-
}
460-
}
461-
462439
// addECRCredentialProvider installs the ECR Kubelet Credential Provider
463440
func (b *KubeletBuilder) addECRCredentialProvider(c *fi.NodeupModelBuilderContext) error {
464441
{
@@ -599,93 +576,6 @@ providers:
599576
return nil
600577
}
601578

602-
// addContainerizedMounter downloads and installs the containerized mounter, that we need on ContainerOS
603-
func (b *KubeletBuilder) addContainerizedMounter(c *fi.NodeupModelBuilderContext) error {
604-
if !b.usesContainerizedMounter() {
605-
return nil
606-
}
607-
608-
// This is not a race because /etc is ephemeral on COS, and we start kubelet (also in /etc on COS)
609-
610-
// So what we do here is we download a tarred container image, expand it to containerizedMounterHome, then
611-
// set up bind mounts so that the script is executable (most of containeros is noexec),
612-
// and set up some bind mounts of proc and dev so that mounting can take place inside that container
613-
// - it isn't a full docker container.
614-
615-
{
616-
// @TODO Extract to common function?
617-
assetName := "mounter"
618-
assetPath := ""
619-
asset, err := b.Assets.Find(assetName, assetPath)
620-
if err != nil {
621-
return fmt.Errorf("trying to locate asset %q: %v", assetName, err)
622-
}
623-
if asset == nil {
624-
return fmt.Errorf("unable to locate asset %q", assetName)
625-
}
626-
627-
t := &nodetasks.File{
628-
Path: path.Join(containerizedMounterHome, "mounter"),
629-
Contents: asset,
630-
Type: nodetasks.FileType_File,
631-
Mode: s("0755"),
632-
}
633-
c.AddTask(t)
634-
}
635-
636-
c.AddTask(&nodetasks.File{
637-
Path: containerizedMounterHome,
638-
Type: nodetasks.FileType_Directory,
639-
})
640-
641-
// TODO: leverage assets for this tar file (but we want to avoid expansion of the archive)
642-
c.AddTask(&nodetasks.Archive{
643-
Name: "containerized_mounter",
644-
Source: "https://storage.googleapis.com/kubernetes-release/gci-mounter/mounter.tar",
645-
Hash: "6a9f5f52e0b066183e6b90a3820b8c2c660d30f6ac7aeafb5064355bf0a5b6dd",
646-
TargetDir: path.Join(containerizedMounterHome, "rootfs"),
647-
})
648-
649-
c.AddTask(&nodetasks.File{
650-
Path: path.Join(containerizedMounterHome, "rootfs/var/lib/kubelet"),
651-
Type: nodetasks.FileType_Directory,
652-
})
653-
654-
c.AddTask(&nodetasks.BindMount{
655-
Source: containerizedMounterHome,
656-
Mountpoint: containerizedMounterHome,
657-
Options: []string{"exec"},
658-
})
659-
660-
c.AddTask(&nodetasks.BindMount{
661-
Source: "/var/lib/kubelet/",
662-
Mountpoint: path.Join(containerizedMounterHome, "rootfs/var/lib/kubelet"),
663-
Options: []string{"rshared"},
664-
Recursive: true,
665-
})
666-
667-
c.AddTask(&nodetasks.BindMount{
668-
Source: "/proc",
669-
Mountpoint: path.Join(containerizedMounterHome, "rootfs/proc"),
670-
Options: []string{"ro"},
671-
})
672-
673-
c.AddTask(&nodetasks.BindMount{
674-
Source: "/dev",
675-
Mountpoint: path.Join(containerizedMounterHome, "rootfs/dev"),
676-
Options: []string{"ro"},
677-
})
678-
679-
// kube-up does a file cp, but we probably want to make changes visible (e.g. for gossip DNS)
680-
c.AddTask(&nodetasks.BindMount{
681-
Source: "/etc/resolv.conf",
682-
Mountpoint: path.Join(containerizedMounterHome, "rootfs/etc/resolv.conf"),
683-
Options: []string{"ro"},
684-
})
685-
686-
return nil
687-
}
688-
689579
// NodeLabels are defined in the InstanceGroup, but set flags on the kubelet config.
690580
// We have a conflict here: on the one hand we want an easy to use abstract specification
691581
// for the cluster, on the other hand we don't want two fields that do the same thing.

pkg/nodemodel/fileassets.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ func BuildKubernetesFileAssets(ig model.InstanceGroup, assetBuilder *assets.Asse
5656
fmt.Sprintf("/bin/linux/%s/kubectl", arch),
5757
}
5858

59-
if needsMounterAsset(ig) {
60-
k8sAssetsNames = append(k8sAssetsNames, fmt.Sprintf("/bin/linux/%s/mounter", arch))
61-
}
62-
6359
for _, an := range k8sAssetsNames {
6460
k, err := url.Parse(baseURL)
6561
if err != nil {
@@ -178,15 +174,3 @@ func BuildNodeUpAssets(ctx context.Context, assetBuilder *assets.AssetBuilder) (
178174
NodeUpAssets: nodeUpAssets,
179175
}, nil
180176
}
181-
182-
// needsMounterAsset checks if we need the mounter program
183-
// This is only needed currently on ContainerOS i.e. GCE, but we don't have a nice way to detect it yet
184-
func needsMounterAsset(ig model.InstanceGroup) bool {
185-
// TODO: Do real detection of ContainerOS (but this has to work with image names, and maybe even forked images)
186-
switch ig.GetCloudProvider() {
187-
case kops.CloudProviderGCE:
188-
return true
189-
default:
190-
return false
191-
}
192-
}

upup/pkg/fi/nodeup/nodetasks/archive.go

Lines changed: 0 additions & 212 deletions
This file was deleted.

0 commit comments

Comments
 (0)