mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Revert "Merge pull request #35821 from vishh/gci-mounter-scope"
This reverts commit973fa6b334, reversing changes made to41b5fe86b6.
This commit is contained in:
		@@ -473,7 +473,6 @@ function start-kubelet {
 | 
			
		||||
  flags+=" --cluster-dns=${DNS_SERVER_IP}"
 | 
			
		||||
  flags+=" --cluster-domain=${DNS_DOMAIN}"
 | 
			
		||||
  flags+=" --config=/etc/kubernetes/manifests"
 | 
			
		||||
  flags+=" --experimental-mounter-path=${KUBE_HOME}/bin/mounter"
 | 
			
		||||
 | 
			
		||||
  if [[ -n "${KUBELET_PORT:-}" ]]; then
 | 
			
		||||
    flags+=" --port=${KUBELET_PORT}"
 | 
			
		||||
@@ -1169,15 +1168,9 @@ EOF
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function override-kubectl {
 | 
			
		||||
    echo "overriding kubectl"
 | 
			
		||||
    echo "export PATH=${KUBE_HOME}/bin:\$PATH" > /etc/profile.d/kube_env.sh
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function pre-warm-mounter {
 | 
			
		||||
    echo "prewarming mounter"
 | 
			
		||||
    ${KUBE_HOME}/bin/mounter &> /dev/null
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
########### Main Function ###########
 | 
			
		||||
echo "Start to configure instance for kubernetes"
 | 
			
		||||
 | 
			
		||||
@@ -1212,8 +1205,6 @@ else
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
override-kubectl
 | 
			
		||||
# Run the containerized mounter once to pre-cache the container image.
 | 
			
		||||
pre-warm-mounter
 | 
			
		||||
assemble-docker-flags
 | 
			
		||||
load-docker-images
 | 
			
		||||
start-kubelet
 | 
			
		||||
 
 | 
			
		||||
@@ -23,25 +23,14 @@ MOUNTER_USER=root
 | 
			
		||||
RKT_BINARY=/home/kubernetes/bin/rkt
 | 
			
		||||
 | 
			
		||||
function gc {
 | 
			
		||||
    # Attempt to garbage collect rkt pods with 5 retries.
 | 
			
		||||
    # Rkt pods end up creating new copies of mounts on the host. Hence it is ideal to clean them up right away.
 | 
			
		||||
    attempt=0
 | 
			
		||||
    until [ $attempt -ge 5 ]; do
 | 
			
		||||
	${RKT_BINARY} gc --grace-period=0s && break
 | 
			
		||||
	attempt=$[$attempt+1]
 | 
			
		||||
	sleep 1
 | 
			
		||||
    done
 | 
			
		||||
    ${RKT_BINARY} gc --grace-period=0s &> /dev/null
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Garbage collect old rkt containers on exit
 | 
			
		||||
trap gc EXIT
 | 
			
		||||
 | 
			
		||||
echo "Running mount using a rkt fly container"
 | 
			
		||||
 | 
			
		||||
${RKT_BINARY} run --stage1-name="coreos.com/rkt/stage1-fly:1.18.0" \
 | 
			
		||||
	--insecure-options=image \
 | 
			
		||||
	--volume=kubelet,kind=host,source=/var/lib/kubelet,readOnly=false,recursive=true \
 | 
			
		||||
	--mount volume=kubelet,target=/var/lib/kubelet \
 | 
			
		||||
	--volume=rootfs,kind=host,source=/,readOnly=false,recursive=true \
 | 
			
		||||
	--mount volume=rootfs,target=/media/root \
 | 
			
		||||
	docker://${MOUNTER_DOCKER_IMAGE}:${MOUNTER_DOCKER_VERSION} --user=${MOUNTER_USER} --exec /bin/mount -- "$@"
 | 
			
		||||
 | 
			
		||||
echo "Successfully ran mount using a rkt fly container"
 | 
			
		||||
@@ -67,7 +67,7 @@ func (realConntracker) SetTCPEstablishedTimeout(seconds int) error {
 | 
			
		||||
func isSysFSWritable() (bool, error) {
 | 
			
		||||
	const permWritable = "rw"
 | 
			
		||||
	const sysfsDevice = "sysfs"
 | 
			
		||||
	m := mount.New("" /* default mount path */)
 | 
			
		||||
	m := mount.New()
 | 
			
		||||
	mountPoints, err := m.List()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		glog.Errorf("failed to list mount points: %v", err)
 | 
			
		||||
 
 | 
			
		||||
@@ -200,6 +200,7 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
 | 
			
		||||
	fs.BoolVar(&s.ExitOnLockContention, "exit-on-lock-contention", s.ExitOnLockContention, "Whether kubelet should exit upon lock-file contention.")
 | 
			
		||||
	fs.StringVar(&s.RktPath, "rkt-path", s.RktPath, "Path of rkt binary. Leave empty to use the first rkt in $PATH.  Only used if --container-runtime='rkt'.")
 | 
			
		||||
	fs.StringVar(&s.ExperimentalMounterPath, "experimental-mounter-path", s.ExperimentalMounterPath, "[Experimental] Path of mounter binary. Leave empty to use the default mount.")
 | 
			
		||||
	fs.StringVar(&s.ExperimentalMounterRootfsPath, "experimental-mounter-rootfs-path", s.ExperimentalMounterRootfsPath, "[Experimental] Absolute path to the root filesystem for the mounter binary.")
 | 
			
		||||
	fs.StringVar(&s.RktAPIEndpoint, "rkt-api-endpoint", s.RktAPIEndpoint, "The endpoint of the rkt API service to communicate with. Only used if --container-runtime='rkt'.")
 | 
			
		||||
	fs.StringVar(&s.RktStage1Image, "rkt-stage1-image", s.RktStage1Image, "image to use as stage1. Local paths and http/https URLs are supported. If empty, the 'stage1.aci' in the same directory as '--rkt-path' will be used.")
 | 
			
		||||
	fs.MarkDeprecated("rkt-stage1-image", "Will be removed in a future version. The default stage1 image will be specified by the rkt configurations, see https://github.com/coreos/rkt/blob/master/Documentation/configuration.md for more details.")
 | 
			
		||||
 
 | 
			
		||||
@@ -118,7 +118,7 @@ func UnsecuredKubeletDeps(s *options.KubeletServer) (*kubelet.KubeletDeps, error
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	mounter := mount.New(s.ExperimentalMounterPath)
 | 
			
		||||
	mounter := mount.NewCustomMounter(s.ExperimentalMounterPath, s.ExperimentalMounterRootfsPath)
 | 
			
		||||
	var writer kubeio.Writer = &kubeio.StdWriter{}
 | 
			
		||||
	if s.Containerized {
 | 
			
		||||
		glog.V(2).Info("Running kubelet in containerized mode (experimental)")
 | 
			
		||||
 
 | 
			
		||||
@@ -189,6 +189,7 @@ experimental-allowed-unsafe-sysctls
 | 
			
		||||
experimental-bootstrap-kubeconfig
 | 
			
		||||
experimental-keystone-url
 | 
			
		||||
experimental-mounter-path
 | 
			
		||||
experimental-mounter-rootfs-path
 | 
			
		||||
experimental-nvidia-gpus
 | 
			
		||||
experimental-prefix
 | 
			
		||||
experimental-runtime-integration-type
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -319,6 +319,8 @@ type KubeletConfiguration struct {
 | 
			
		||||
	RktPath string `json:"rktPath,omitempty"`
 | 
			
		||||
	// experimentalMounterPath is the path of mounter binary. Leave empty to use the default mount path
 | 
			
		||||
	ExperimentalMounterPath string `json:"experimentalMounterPath,omitempty"`
 | 
			
		||||
	// experimentalMounterRootfsPath is the absolute path to root filesystem for the mounter binary.
 | 
			
		||||
	ExperimentalMounterRootfsPath string `json:"experimentalMounterRootfsPath,omitempty"`
 | 
			
		||||
	// rktApiEndpoint is the endpoint of the rkt API service to communicate with.
 | 
			
		||||
	// +optional
 | 
			
		||||
	RktAPIEndpoint string `json:"rktAPIEndpoint,omitempty"`
 | 
			
		||||
 
 | 
			
		||||
@@ -367,6 +367,8 @@ type KubeletConfiguration struct {
 | 
			
		||||
	// experimentalMounterPath is the path to mounter binary. If not set, kubelet will attempt to use mount
 | 
			
		||||
	// binary that is available via $PATH,
 | 
			
		||||
	ExperimentalMounterPath string `json:"experimentalMounterPath,omitempty"`
 | 
			
		||||
	// experimentalMounterRootfsPath is the absolute path to root filesystem for the mounter binary.
 | 
			
		||||
	ExperimentalMounterRootfsPath string `json:"experimentalMounterRootfsPath,omitempty"`
 | 
			
		||||
	// rktApiEndpoint is the endpoint of the rkt API service to communicate with.
 | 
			
		||||
	RktAPIEndpoint string `json:"rktAPIEndpoint"`
 | 
			
		||||
	// rktStage1Image is the image to use as stage1. Local paths and
 | 
			
		||||
 
 | 
			
		||||
@@ -336,6 +336,7 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_componentconfig_KubeletConfigu
 | 
			
		||||
	out.RuntimeRequestTimeout = in.RuntimeRequestTimeout
 | 
			
		||||
	out.RktPath = in.RktPath
 | 
			
		||||
	out.ExperimentalMounterPath = in.ExperimentalMounterPath
 | 
			
		||||
	out.ExperimentalMounterRootfsPath = in.ExperimentalMounterRootfsPath
 | 
			
		||||
	out.RktAPIEndpoint = in.RktAPIEndpoint
 | 
			
		||||
	out.RktStage1Image = in.RktStage1Image
 | 
			
		||||
	if err := api.Convert_Pointer_string_To_string(&in.LockFilePath, &out.LockFilePath, s); err != nil {
 | 
			
		||||
@@ -503,6 +504,7 @@ func autoConvert_componentconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigu
 | 
			
		||||
	out.RuntimeRequestTimeout = in.RuntimeRequestTimeout
 | 
			
		||||
	out.RktPath = in.RktPath
 | 
			
		||||
	out.ExperimentalMounterPath = in.ExperimentalMounterPath
 | 
			
		||||
	out.ExperimentalMounterRootfsPath = in.ExperimentalMounterRootfsPath
 | 
			
		||||
	out.RktAPIEndpoint = in.RktAPIEndpoint
 | 
			
		||||
	out.RktStage1Image = in.RktStage1Image
 | 
			
		||||
	if err := api.Convert_string_To_Pointer_string(&in.LockFilePath, &out.LockFilePath, s); err != nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -314,6 +314,7 @@ func DeepCopy_v1alpha1_KubeletConfiguration(in interface{}, out interface{}, c *
 | 
			
		||||
		out.RuntimeRequestTimeout = in.RuntimeRequestTimeout
 | 
			
		||||
		out.RktPath = in.RktPath
 | 
			
		||||
		out.ExperimentalMounterPath = in.ExperimentalMounterPath
 | 
			
		||||
		out.ExperimentalMounterRootfsPath = in.ExperimentalMounterRootfsPath
 | 
			
		||||
		out.RktAPIEndpoint = in.RktAPIEndpoint
 | 
			
		||||
		out.RktStage1Image = in.RktStage1Image
 | 
			
		||||
		if in.LockFilePath != nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -316,6 +316,7 @@ func DeepCopy_componentconfig_KubeletConfiguration(in interface{}, out interface
 | 
			
		||||
		out.RuntimeRequestTimeout = in.RuntimeRequestTimeout
 | 
			
		||||
		out.RktPath = in.RktPath
 | 
			
		||||
		out.ExperimentalMounterPath = in.ExperimentalMounterPath
 | 
			
		||||
		out.ExperimentalMounterRootfsPath = in.ExperimentalMounterRootfsPath
 | 
			
		||||
		out.RktAPIEndpoint = in.RktAPIEndpoint
 | 
			
		||||
		out.RktStage1Image = in.RktStage1Image
 | 
			
		||||
		out.LockFilePath = in.LockFilePath
 | 
			
		||||
 
 | 
			
		||||
@@ -95,7 +95,7 @@ func getMetadataFromConfigDrive() (*Metadata, error) {
 | 
			
		||||
 | 
			
		||||
	glog.V(4).Infof("Attempting to mount configdrive %s on %s", dev, mntdir)
 | 
			
		||||
 | 
			
		||||
	mounter := mount.New("" /* default mount path */)
 | 
			
		||||
	mounter := mount.New()
 | 
			
		||||
	err = mounter.Mount(dev, mntdir, "iso9660", []string{"ro"})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = mounter.Mount(dev, mntdir, "vfat", []string{"ro"})
 | 
			
		||||
 
 | 
			
		||||
@@ -2657,6 +2657,13 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
 | 
			
		||||
							Format:      "",
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
					"experimentalMounterRootfsPath": {
 | 
			
		||||
						SchemaProps: spec.SchemaProps{
 | 
			
		||||
							Description: "experimentalMounterRootfsPath is the absolute path to root filesystem for the mounter binary.",
 | 
			
		||||
							Type:        []string{"string"},
 | 
			
		||||
							Format:      "",
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
					"rktAPIEndpoint": {
 | 
			
		||||
						SchemaProps: spec.SchemaProps{
 | 
			
		||||
							Description: "rktApiEndpoint is the endpoint of the rkt API service to communicate with.",
 | 
			
		||||
@@ -2978,7 +2985,7 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Required: []string{"TypeMeta", "podManifestPath", "syncFrequency", "fileCheckFrequency", "httpCheckFrequency", "manifestURL", "manifestURLHeader", "enableServer", "address", "port", "readOnlyPort", "tlsCertFile", "tlsPrivateKeyFile", "certDirectory", "authentication", "authorization", "hostnameOverride", "podInfraContainerImage", "dockerEndpoint", "rootDirectory", "seccompProfileRoot", "allowPrivileged", "hostNetworkSources", "hostPIDSources", "hostIPCSources", "registryPullQPS", "registryBurst", "eventRecordQPS", "eventBurst", "enableDebuggingHandlers", "minimumGCAge", "maxPerPodContainerCount", "maxContainerCount", "cAdvisorPort", "healthzPort", "healthzBindAddress", "oomScoreAdj", "registerNode", "clusterDomain", "masterServiceNamespace", "clusterDNS", "streamingConnectionIdleTimeout", "nodeStatusUpdateFrequency", "imageMinimumGCAge", "imageGCHighThresholdPercent", "imageGCLowThresholdPercent", "lowDiskSpaceThresholdMB", "volumeStatsAggPeriod", "networkPluginName", "networkPluginMTU", "networkPluginDir", "cniConfDir", "cniBinDir", "volumePluginDir", "containerRuntime", "remoteRuntimeEndpoint", "remoteImageEndpoint", "experimentalMounterPath", "lockFilePath", "exitOnLockContention", "hairpinMode", "babysitDaemons", "maxPods", "nvidiaGPUs", "dockerExecHandlerName", "podCIDR", "resolvConf", "cpuCFSQuota", "containerized", "maxOpenFiles", "reconcileCIDR", "registerSchedulable", "contentType", "kubeAPIQPS", "kubeAPIBurst", "serializeImagePulls", "nodeLabels", "nonMasqueradeCIDR", "enableCustomMetrics", "podsPerCore", "enableControllerAttachDetach", "systemReserved", "kubeReserved", "protectKernelDefaults", "makeIPTablesUtilChains", "iptablesMasqueradeBit", "iptablesDropBit", "featureGates"},
 | 
			
		||||
				Required: []string{"TypeMeta", "podManifestPath", "syncFrequency", "fileCheckFrequency", "httpCheckFrequency", "manifestURL", "manifestURLHeader", "enableServer", "address", "port", "readOnlyPort", "tlsCertFile", "tlsPrivateKeyFile", "certDirectory", "authentication", "authorization", "hostnameOverride", "podInfraContainerImage", "dockerEndpoint", "rootDirectory", "seccompProfileRoot", "allowPrivileged", "hostNetworkSources", "hostPIDSources", "hostIPCSources", "registryPullQPS", "registryBurst", "eventRecordQPS", "eventBurst", "enableDebuggingHandlers", "minimumGCAge", "maxPerPodContainerCount", "maxContainerCount", "cAdvisorPort", "healthzPort", "healthzBindAddress", "oomScoreAdj", "registerNode", "clusterDomain", "masterServiceNamespace", "clusterDNS", "streamingConnectionIdleTimeout", "nodeStatusUpdateFrequency", "imageMinimumGCAge", "imageGCHighThresholdPercent", "imageGCLowThresholdPercent", "lowDiskSpaceThresholdMB", "volumeStatsAggPeriod", "networkPluginName", "networkPluginMTU", "networkPluginDir", "cniConfDir", "cniBinDir", "volumePluginDir", "containerRuntime", "remoteRuntimeEndpoint", "remoteImageEndpoint", "experimentalMounterPath", "experimentalMounterRootfsPath", "lockFilePath", "exitOnLockContention", "hairpinMode", "babysitDaemons", "maxPods", "nvidiaGPUs", "dockerExecHandlerName", "podCIDR", "resolvConf", "cpuCFSQuota", "containerized", "maxOpenFiles", "reconcileCIDR", "registerSchedulable", "contentType", "kubeAPIQPS", "kubeAPIBurst", "serializeImagePulls", "nodeLabels", "nonMasqueradeCIDR", "enableCustomMetrics", "podsPerCore", "enableControllerAttachDetach", "systemReserved", "kubeReserved", "protectKernelDefaults", "makeIPTablesUtilChains", "iptablesMasqueradeBit", "iptablesDropBit", "featureGates"},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		Dependencies: []string{
 | 
			
		||||
@@ -14378,6 +14385,13 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
 | 
			
		||||
							Format:      "",
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
					"experimentalMounterRootfsPath": {
 | 
			
		||||
						SchemaProps: spec.SchemaProps{
 | 
			
		||||
							Description: "experimentalMounterRootfsPath is the absolute path to root filesystem for the mounter binary.",
 | 
			
		||||
							Type:        []string{"string"},
 | 
			
		||||
							Format:      "",
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
					"rktAPIEndpoint": {
 | 
			
		||||
						SchemaProps: spec.SchemaProps{
 | 
			
		||||
							Description: "rktApiEndpoint is the endpoint of the rkt API service to communicate with.",
 | 
			
		||||
@@ -14699,7 +14713,7 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Required: []string{"TypeMeta", "podManifestPath", "syncFrequency", "fileCheckFrequency", "httpCheckFrequency", "manifestURL", "manifestURLHeader", "enableServer", "address", "port", "readOnlyPort", "tlsCertFile", "tlsPrivateKeyFile", "certDirectory", "authentication", "authorization", "hostnameOverride", "podInfraContainerImage", "dockerEndpoint", "rootDirectory", "seccompProfileRoot", "allowPrivileged", "hostNetworkSources", "hostPIDSources", "hostIPCSources", "registryPullQPS", "registryBurst", "eventRecordQPS", "eventBurst", "enableDebuggingHandlers", "minimumGCAge", "maxPerPodContainerCount", "maxContainerCount", "cAdvisorPort", "healthzPort", "healthzBindAddress", "oomScoreAdj", "registerNode", "clusterDomain", "masterServiceNamespace", "clusterDNS", "streamingConnectionIdleTimeout", "nodeStatusUpdateFrequency", "imageMinimumGCAge", "imageGCHighThresholdPercent", "imageGCLowThresholdPercent", "lowDiskSpaceThresholdMB", "volumeStatsAggPeriod", "networkPluginName", "networkPluginDir", "cniConfDir", "cniBinDir", "networkPluginMTU", "volumePluginDir", "cloudProvider", "cloudConfigFile", "kubeletCgroups", "runtimeCgroups", "systemCgroups", "cgroupRoot", "containerRuntime", "remoteRuntimeEndpoint", "remoteImageEndpoint", "runtimeRequestTimeout", "rktPath", "experimentalMounterPath", "rktAPIEndpoint", "rktStage1Image", "lockFilePath", "exitOnLockContention", "hairpinMode", "babysitDaemons", "maxPods", "nvidiaGPUs", "dockerExecHandlerName", "podCIDR", "resolvConf", "cpuCFSQuota", "containerized", "maxOpenFiles", "reconcileCIDR", "registerSchedulable", "contentType", "kubeAPIQPS", "kubeAPIBurst", "serializeImagePulls", "outOfDiskTransitionFrequency", "nodeIP", "nodeLabels", "nonMasqueradeCIDR", "enableCustomMetrics", "evictionHard", "evictionSoft", "evictionSoftGracePeriod", "evictionPressureTransitionPeriod", "evictionMaxPodGracePeriod", "evictionMinimumReclaim", "podsPerCore", "enableControllerAttachDetach", "systemReserved", "kubeReserved", "protectKernelDefaults", "makeIPTablesUtilChains", "iptablesMasqueradeBit", "iptablesDropBit", "featureGates"},
 | 
			
		||||
				Required: []string{"TypeMeta", "podManifestPath", "syncFrequency", "fileCheckFrequency", "httpCheckFrequency", "manifestURL", "manifestURLHeader", "enableServer", "address", "port", "readOnlyPort", "tlsCertFile", "tlsPrivateKeyFile", "certDirectory", "authentication", "authorization", "hostnameOverride", "podInfraContainerImage", "dockerEndpoint", "rootDirectory", "seccompProfileRoot", "allowPrivileged", "hostNetworkSources", "hostPIDSources", "hostIPCSources", "registryPullQPS", "registryBurst", "eventRecordQPS", "eventBurst", "enableDebuggingHandlers", "minimumGCAge", "maxPerPodContainerCount", "maxContainerCount", "cAdvisorPort", "healthzPort", "healthzBindAddress", "oomScoreAdj", "registerNode", "clusterDomain", "masterServiceNamespace", "clusterDNS", "streamingConnectionIdleTimeout", "nodeStatusUpdateFrequency", "imageMinimumGCAge", "imageGCHighThresholdPercent", "imageGCLowThresholdPercent", "lowDiskSpaceThresholdMB", "volumeStatsAggPeriod", "networkPluginName", "networkPluginDir", "cniConfDir", "cniBinDir", "networkPluginMTU", "volumePluginDir", "cloudProvider", "cloudConfigFile", "kubeletCgroups", "runtimeCgroups", "systemCgroups", "cgroupRoot", "containerRuntime", "remoteRuntimeEndpoint", "remoteImageEndpoint", "runtimeRequestTimeout", "rktPath", "experimentalMounterPath", "experimentalMounterRootfsPath", "rktAPIEndpoint", "rktStage1Image", "lockFilePath", "exitOnLockContention", "hairpinMode", "babysitDaemons", "maxPods", "nvidiaGPUs", "dockerExecHandlerName", "podCIDR", "resolvConf", "cpuCFSQuota", "containerized", "maxOpenFiles", "reconcileCIDR", "registerSchedulable", "contentType", "kubeAPIQPS", "kubeAPIBurst", "serializeImagePulls", "outOfDiskTransitionFrequency", "nodeIP", "nodeLabels", "nonMasqueradeCIDR", "enableCustomMetrics", "evictionHard", "evictionSoft", "evictionSoftGracePeriod", "evictionPressureTransitionPeriod", "evictionMaxPodGracePeriod", "evictionMinimumReclaim", "podsPerCore", "enableControllerAttachDetach", "systemReserved", "kubeReserved", "protectKernelDefaults", "makeIPTablesUtilChains", "iptablesMasqueradeBit", "iptablesDropBit", "featureGates"},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		Dependencies: []string{
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,7 @@ func NewHollowKubelet(
 | 
			
		||||
		TLSOptions:        nil,
 | 
			
		||||
		OOMAdjuster:       oom.NewFakeOOMAdjuster(),
 | 
			
		||||
		Writer:            &kubeio.StdWriter{},
 | 
			
		||||
		Mounter:           mount.New("" /* default mount path */),
 | 
			
		||||
		Mounter:           mount.New(),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &HollowKubelet{
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,6 @@ go_library(
 | 
			
		||||
    tags = ["automanaged"],
 | 
			
		||||
    deps = [
 | 
			
		||||
        "//pkg/util/exec:go_default_library",
 | 
			
		||||
        "//pkg/util/sets:go_default_library",
 | 
			
		||||
        "//vendor:github.com/golang/glog",
 | 
			
		||||
    ],
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ import (
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// Default mount command if mounter path is not specified
 | 
			
		||||
	defaultMountCommand = "mount"
 | 
			
		||||
	mount = "mount"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Interface interface {
 | 
			
		||||
@@ -94,16 +94,25 @@ func (mounter *SafeFormatAndMount) FormatAndMount(source string, target string,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// New returns a mount.Interface for the current system.
 | 
			
		||||
func New() Interface {
 | 
			
		||||
	return &Mounter{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewCustomMounter returns a mount.Interface for the current system.
 | 
			
		||||
// It provides options to override the default mounter behavior.
 | 
			
		||||
// mounterPath allows using an alternative to `/bin/mount` for mounting.
 | 
			
		||||
func New(mounterPath string) Interface {
 | 
			
		||||
// mounterRootfsPath allows specifying a custom root filesystem path for non default `mounterPath`.
 | 
			
		||||
func NewCustomMounter(mounterPath, mounterRootfsPath string) Interface {
 | 
			
		||||
	// If mounter-path flag is not set, use default mount path
 | 
			
		||||
	if mounterPath == "" {
 | 
			
		||||
		mounterPath = defaultMountCommand
 | 
			
		||||
		mounterPath = mount
 | 
			
		||||
	}
 | 
			
		||||
	if mounterRootfsPath == "" {
 | 
			
		||||
		mounterRootfsPath = "/"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &Mounter{
 | 
			
		||||
		mounterPath: mounterPath,
 | 
			
		||||
		mounterPath:       mounterPath,
 | 
			
		||||
		mounterRootfsPath: mounterRootfsPath,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -25,13 +25,13 @@ import (
 | 
			
		||||
	"io"
 | 
			
		||||
	"os"
 | 
			
		||||
	"os/exec"
 | 
			
		||||
	"path"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"syscall"
 | 
			
		||||
 | 
			
		||||
	"github.com/golang/glog"
 | 
			
		||||
	utilExec "k8s.io/kubernetes/pkg/util/exec"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/util/sets"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
@@ -54,7 +54,8 @@ const (
 | 
			
		||||
// for the linux platform.  This implementation assumes that the
 | 
			
		||||
// kubelet is running in the host's root mount namespace.
 | 
			
		||||
type Mounter struct {
 | 
			
		||||
	mounterPath string
 | 
			
		||||
	mounterPath       string
 | 
			
		||||
	mounterRootfsPath string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Mount mounts source to target as fstype with given options. 'source' and 'fstype' must
 | 
			
		||||
@@ -62,24 +63,18 @@ type Mounter struct {
 | 
			
		||||
// type, where kernel handles fs type for you. The mount 'options' is a list of options,
 | 
			
		||||
// currently come from mount(8), e.g. "ro", "remount", "bind", etc. If no more option is
 | 
			
		||||
// required, call Mount with an empty string list or nil.
 | 
			
		||||
// Update source path to include a root filesystem override to make a containerized mounter (specified via `mounterPath`) work.
 | 
			
		||||
func (mounter *Mounter) Mount(source string, target string, fstype string, options []string) error {
 | 
			
		||||
	// Path to mounter binary. Set to mount accessible via $PATH by default.
 | 
			
		||||
	// All Linux distros are expected to be shipped with a mount utility that an support bind mounts.
 | 
			
		||||
	mounterPath := defaultMountCommand
 | 
			
		||||
	bind, bindRemountOpts := isBind(options)
 | 
			
		||||
	if bind {
 | 
			
		||||
		err := doMount(mounterPath, source, target, fstype, []string{"bind"})
 | 
			
		||||
		err := doMount(mounter.mounterPath, path.Join(mounter.mounterRootfsPath, source), path.Join(mounter.mounterRootfsPath, target), fstype, []string{"bind"})
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		return doMount(mounterPath, source, target, fstype, bindRemountOpts)
 | 
			
		||||
		return doMount(mounter.mounterPath, path.Join(mounter.mounterRootfsPath, source), path.Join(mounter.mounterRootfsPath, target), fstype, bindRemountOpts)
 | 
			
		||||
	} else {
 | 
			
		||||
		return doMount(mounter.mounterPath, source, path.Join(mounter.mounterRootfsPath, target), fstype, options)
 | 
			
		||||
	}
 | 
			
		||||
	// These filesystem types are expected to be supported by the mount utility on the host across all Linux distros.
 | 
			
		||||
	var defaultMounterFsTypes = sets.NewString("tmpfs", "ext4", "ext3", "ext2")
 | 
			
		||||
	if !defaultMounterFsTypes.Has(fstype) {
 | 
			
		||||
		mounterPath = mounter.mounterPath
 | 
			
		||||
	}
 | 
			
		||||
	return doMount(mounterPath, source, target, fstype, options)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// isBind detects whether a bind mount is being requested and makes the remount options to
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,8 @@ limitations under the License.
 | 
			
		||||
package mount
 | 
			
		||||
 | 
			
		||||
type Mounter struct {
 | 
			
		||||
	mounterPath string
 | 
			
		||||
	mounterPath       string
 | 
			
		||||
	mounterRootfsPath string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (mounter *Mounter) Mount(source string, target string, fstype string, options []string) error {
 | 
			
		||||
 
 | 
			
		||||
@@ -121,6 +121,8 @@ type NodeTestContextType struct {
 | 
			
		||||
	ContainerRuntimeEndpoint string
 | 
			
		||||
	// MounterPath is the path to the program to run to perform a mount
 | 
			
		||||
	MounterPath string
 | 
			
		||||
	// MounterRootfsPath is the path to the root filesystem for the program used to perform a mount in kubelet
 | 
			
		||||
	MounterRootfsPath string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type CloudConfig struct {
 | 
			
		||||
@@ -218,6 +220,7 @@ func RegisterNodeFlags() {
 | 
			
		||||
	flag.StringVar(&TestContext.RuntimeIntegrationType, "runtime-integration-type", "", "Choose the integration path for the container runtime, mainly used for CRI validation.")
 | 
			
		||||
	flag.StringVar(&TestContext.ContainerRuntimeEndpoint, "container-runtime-endpoint", "", "The endpoint of remote container runtime grpc server, mainly used for Remote CRI validation.")
 | 
			
		||||
	flag.StringVar(&TestContext.MounterPath, "experimental-mounter-path", "", "Path of mounter binary. Leave empty to use the default mount.")
 | 
			
		||||
	flag.StringVar(&TestContext.MounterRootfsPath, "experimental-mounter-rootfs-path", "", "Absolute path to root filesystem for the mounter binary.")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// overwriteFlagsWithViperConfig finds and writes values to flags using viper as input.
 | 
			
		||||
 
 | 
			
		||||
@@ -45,6 +45,8 @@ const (
 | 
			
		||||
	archiveName  = "e2e_node_test.tar.gz"
 | 
			
		||||
	CNIRelease   = "07a8a28637e97b22eb8dfe710eeae1344f69d16e"
 | 
			
		||||
	CNIDirectory = "cni"
 | 
			
		||||
	// Note: This path needs to be in sync with the "target" path for `/` in cluster/gce/gci/mounter/mounter
 | 
			
		||||
	mounterRootfsPath string = "/media/root"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var CNIURL = fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/network-plugins/cni-%s.tar.gz", CNIRelease)
 | 
			
		||||
@@ -265,7 +267,6 @@ func RunRemote(archive string, host string, cleanup bool, junitFilePrefix string
 | 
			
		||||
		return "", false, fmt.Errorf("Issue detecting node's OS via node's /etc/os-release. Err: %v, Output:\n%s", err, output)
 | 
			
		||||
	}
 | 
			
		||||
	if strings.Contains(output, "ID=gci") {
 | 
			
		||||
		glog.Infof("GCI node and GCI mounter both detected, modifying --experimental-mounter-path accordingly")
 | 
			
		||||
		// Note this implicitly requires the script to be where we expect in the tarball, so if that location changes the error
 | 
			
		||||
		// here will tell us to update the remote test runner.
 | 
			
		||||
		mounterPath := filepath.Join(tmp, "cluster/gce/gci/mounter/mounter")
 | 
			
		||||
@@ -275,7 +276,9 @@ func RunRemote(archive string, host string, cleanup bool, junitFilePrefix string
 | 
			
		||||
			return "", false, err
 | 
			
		||||
		}
 | 
			
		||||
		// Insert args at beginning of testArgs, so any values from command line take precedence
 | 
			
		||||
		testArgs = fmt.Sprintf("--experimental-mounter-rootfs-path=%s ", mounterRootfsPath) + testArgs
 | 
			
		||||
		testArgs = fmt.Sprintf("--experimental-mounter-path=%s ", mounterPath) + testArgs
 | 
			
		||||
		glog.Infof("GCI node and GCI mounter both detected, setting --experimental-mounter-path=%q and --experimental-mounter-rootfs-path=%q accordingly", mounterPath, mounterRootfsPath)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Run the tests
 | 
			
		||||
 
 | 
			
		||||
@@ -212,6 +212,7 @@ func (e *E2EServices) startKubelet() (*server, error) {
 | 
			
		||||
		"--feature-gates", framework.TestContext.FeatureGates,
 | 
			
		||||
		"--v", LOG_VERBOSITY_LEVEL, "--logtostderr",
 | 
			
		||||
		"--experimental-mounter-path", framework.TestContext.MounterPath,
 | 
			
		||||
		"--experimental-mounter-rootfs-path", framework.TestContext.MounterRootfsPath,
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	if framework.TestContext.RuntimeIntegrationType != "" {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user