mirror of https://github.com/kubernetes/kops.git
Workaround for overlay2 vs rhel-family docker bug
Docker 17.x with rhel-family fails to detect overlay2 correctly, and need us to pass overlay2.override_kernel_check=true for docker to correctly detect overlay2 support.
This commit is contained in:
parent
36ea1610dd
commit
ea4e57145c
|
@ -675,6 +675,18 @@ func (d *dockerVersion) matches(arch Architecture, dockerVersion string, distro
|
|||
return true
|
||||
}
|
||||
|
||||
func (b *DockerBuilder) dockerVersion() string {
|
||||
dockerVersion := ""
|
||||
if b.Cluster.Spec.Docker != nil {
|
||||
dockerVersion = fi.StringValue(b.Cluster.Spec.Docker.Version)
|
||||
}
|
||||
if dockerVersion == "" {
|
||||
dockerVersion = DefaultDockerVersion
|
||||
glog.Warningf("DockerVersion not specified; using default %q", dockerVersion)
|
||||
}
|
||||
return dockerVersion
|
||||
}
|
||||
|
||||
// Build is responsible for configuring the docker daemon
|
||||
func (b *DockerBuilder) Build(c *fi.ModelBuilderContext) error {
|
||||
|
||||
|
@ -705,14 +717,7 @@ func (b *DockerBuilder) Build(c *fi.ModelBuilderContext) error {
|
|||
c.AddTask(t)
|
||||
}
|
||||
|
||||
dockerVersion := ""
|
||||
if b.Cluster.Spec.Docker != nil {
|
||||
dockerVersion = fi.StringValue(b.Cluster.Spec.Docker.Version)
|
||||
}
|
||||
if dockerVersion == "" {
|
||||
dockerVersion = DefaultDockerVersion
|
||||
glog.Warningf("DockerVersion not specified; using default %q", dockerVersion)
|
||||
}
|
||||
dockerVersion := b.dockerVersion()
|
||||
|
||||
// Add packages
|
||||
{
|
||||
|
@ -990,6 +995,21 @@ func (b *DockerBuilder) buildSysconfig(c *fi.ModelBuilderContext) error {
|
|||
}
|
||||
}
|
||||
|
||||
// RHEL-family / docker has a bug with 17.x where it fails to use overlay2 because it does a broken kernel check
|
||||
if b.Distribution.IsRHELFamily() {
|
||||
dockerVersion := b.dockerVersion()
|
||||
if strings.HasPrefix(dockerVersion, "17.") {
|
||||
storageOpts := strings.Join(docker.StorageOpts, ",")
|
||||
if strings.Contains(storageOpts, "overlay2.override_kernel_check=1") {
|
||||
// Already there
|
||||
} else if !strings.Contains(storageOpts, "overlay2.override_kernel_check") {
|
||||
docker.StorageOpts = append(docker.StorageOpts, "overlay2.override_kernel_check=1")
|
||||
} else {
|
||||
glog.Infof("detected image was RHEL and overlay2.override_kernel_check=1 was probably needed, but overlay2.override_kernel_check was already set (%q) so won't set", storageOpts)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flagsString, err := flagbuilder.BuildFlags(&docker)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error building docker flags: %v", err)
|
||||
|
|
Loading…
Reference in New Issue