mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
Make system container name configurable.
(cherry picked from commit 9a2630ac6e
)
This commit is contained in:
parent
39c308012a
commit
220570dfc1
@ -108,6 +108,7 @@ type KubeletServer struct {
|
|||||||
CgroupRoot string
|
CgroupRoot string
|
||||||
ContainerRuntime string
|
ContainerRuntime string
|
||||||
DockerDaemonContainer string
|
DockerDaemonContainer string
|
||||||
|
SystemContainer string
|
||||||
ConfigureCBR0 bool
|
ConfigureCBR0 bool
|
||||||
MaxPods int
|
MaxPods int
|
||||||
|
|
||||||
@ -170,6 +171,7 @@ func NewKubeletServer() *KubeletServer {
|
|||||||
CgroupRoot: "",
|
CgroupRoot: "",
|
||||||
ContainerRuntime: "docker",
|
ContainerRuntime: "docker",
|
||||||
DockerDaemonContainer: "/docker-daemon",
|
DockerDaemonContainer: "/docker-daemon",
|
||||||
|
SystemContainer: "",
|
||||||
ConfigureCBR0: false,
|
ConfigureCBR0: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,7 +230,7 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
|
|||||||
fs.StringVar(&s.ResourceContainer, "resource-container", s.ResourceContainer, "Absolute name of the resource-only container to create and run the Kubelet in (Default: /kubelet).")
|
fs.StringVar(&s.ResourceContainer, "resource-container", s.ResourceContainer, "Absolute name of the resource-only container to create and run the Kubelet in (Default: /kubelet).")
|
||||||
fs.StringVar(&s.CgroupRoot, "cgroup_root", s.CgroupRoot, "Optional root cgroup to use for pods. This is handled by the container runtime on a best effort basis. Default: '', which means use the container runtime default.")
|
fs.StringVar(&s.CgroupRoot, "cgroup_root", s.CgroupRoot, "Optional root cgroup to use for pods. This is handled by the container runtime on a best effort basis. Default: '', which means use the container runtime default.")
|
||||||
fs.StringVar(&s.ContainerRuntime, "container_runtime", s.ContainerRuntime, "The container runtime to use. Possible values: 'docker', 'rkt'. Default: 'docker'.")
|
fs.StringVar(&s.ContainerRuntime, "container_runtime", s.ContainerRuntime, "The container runtime to use. Possible values: 'docker', 'rkt'. Default: 'docker'.")
|
||||||
fs.StringVar(&s.DockerDaemonContainer, "docker-daemon-container", s.DockerDaemonContainer, "Optional resource-only container in which to place the Docker Daemon. Empty for no container (Default: /docker-daemon).")
|
fs.StringVar(&s.SystemContainer, "system-container", s.SystemContainer, "Optional resource-only container in which to place all non-kernel processes that are not already in a container. Empty for no container. Rolling back the flag requires a reboot. (Default: \"\").")
|
||||||
fs.BoolVar(&s.ConfigureCBR0, "configure-cbr0", s.ConfigureCBR0, "If true, kubelet will configure cbr0 based on Node.Spec.PodCIDR.")
|
fs.BoolVar(&s.ConfigureCBR0, "configure-cbr0", s.ConfigureCBR0, "If true, kubelet will configure cbr0 based on Node.Spec.PodCIDR.")
|
||||||
fs.IntVar(&s.MaxPods, "max-pods", 100, "Number of Pods that can run on this Kubelet.")
|
fs.IntVar(&s.MaxPods, "max-pods", 100, "Number of Pods that can run on this Kubelet.")
|
||||||
|
|
||||||
@ -347,6 +349,7 @@ func (s *KubeletServer) Run(_ []string) error {
|
|||||||
ContainerRuntime: s.ContainerRuntime,
|
ContainerRuntime: s.ContainerRuntime,
|
||||||
Mounter: mounter,
|
Mounter: mounter,
|
||||||
DockerDaemonContainer: s.DockerDaemonContainer,
|
DockerDaemonContainer: s.DockerDaemonContainer,
|
||||||
|
SystemContainer: s.SystemContainer,
|
||||||
ConfigureCBR0: s.ConfigureCBR0,
|
ConfigureCBR0: s.ConfigureCBR0,
|
||||||
MaxPods: s.MaxPods,
|
MaxPods: s.MaxPods,
|
||||||
}
|
}
|
||||||
@ -513,6 +516,7 @@ func SimpleKubelet(client *client.Client,
|
|||||||
ContainerRuntime: "docker",
|
ContainerRuntime: "docker",
|
||||||
Mounter: mount.New(),
|
Mounter: mount.New(),
|
||||||
DockerDaemonContainer: "/docker-daemon",
|
DockerDaemonContainer: "/docker-daemon",
|
||||||
|
SystemContainer: "",
|
||||||
MaxPods: 32,
|
MaxPods: 32,
|
||||||
}
|
}
|
||||||
return &kcfg
|
return &kcfg
|
||||||
@ -648,6 +652,7 @@ type KubeletConfig struct {
|
|||||||
ContainerRuntime string
|
ContainerRuntime string
|
||||||
Mounter mount.Interface
|
Mounter mount.Interface
|
||||||
DockerDaemonContainer string
|
DockerDaemonContainer string
|
||||||
|
SystemContainer string
|
||||||
ConfigureCBR0 bool
|
ConfigureCBR0 bool
|
||||||
MaxPods int
|
MaxPods int
|
||||||
}
|
}
|
||||||
@ -701,6 +706,7 @@ func createAndInitKubelet(kc *KubeletConfig) (k KubeletBootstrap, pc *config.Pod
|
|||||||
kc.ContainerRuntime,
|
kc.ContainerRuntime,
|
||||||
kc.Mounter,
|
kc.Mounter,
|
||||||
kc.DockerDaemonContainer,
|
kc.DockerDaemonContainer,
|
||||||
|
kc.SystemContainer,
|
||||||
kc.ConfigureCBR0,
|
kc.ConfigureCBR0,
|
||||||
kc.MaxPods)
|
kc.MaxPods)
|
||||||
|
|
||||||
|
@ -139,6 +139,7 @@ func NewMainKubelet(
|
|||||||
containerRuntime string,
|
containerRuntime string,
|
||||||
mounter mount.Interface,
|
mounter mount.Interface,
|
||||||
dockerDaemonContainer string,
|
dockerDaemonContainer string,
|
||||||
|
systemContainer string,
|
||||||
configureCBR0 bool,
|
configureCBR0 bool,
|
||||||
pods int) (*Kubelet, error) {
|
pods int) (*Kubelet, error) {
|
||||||
if rootDirectory == "" {
|
if rootDirectory == "" {
|
||||||
@ -298,10 +299,9 @@ func NewMainKubelet(
|
|||||||
return nil, fmt.Errorf("unsupported container runtime %q specified", containerRuntime)
|
return nil, fmt.Errorf("unsupported container runtime %q specified", containerRuntime)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(vmarmol): Make configurable.
|
|
||||||
// Setup container manager, can fail if the devices hierarchy is not mounted
|
// Setup container manager, can fail if the devices hierarchy is not mounted
|
||||||
// (it is required by Docker however).
|
// (it is required by Docker however).
|
||||||
containerManager, err := newContainerManager(dockerDaemonContainer, "/system")
|
containerManager, err := newContainerManager(dockerDaemonContainer, systemContainer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to create the Container Manager: %v", err)
|
return nil, fmt.Errorf("failed to create the Container Manager: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user