@@ -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
5251const (
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
463440func (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.
0 commit comments