Skip to content

Commit

Permalink
OCPBUGS-43625: azure: use separate /var to avoid growfs timeouts
Browse files Browse the repository at this point in the history
Using the workaround of a separate /var partition until the issue is
fixed in RHCOS.
  • Loading branch information
r4f4 committed Dec 17, 2024
1 parent be8603b commit a10520c
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/asset/ignition/bootstrap/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
"github.com/openshift/installer/pkg/asset/tls"
"github.com/openshift/installer/pkg/types"
awstypes "github.com/openshift/installer/pkg/types/aws"
aztypes "github.com/openshift/installer/pkg/types/azure"
baremetaltypes "github.com/openshift/installer/pkg/types/baremetal"
gcptypes "github.com/openshift/installer/pkg/types/gcp"
nutanixtypes "github.com/openshift/installer/pkg/types/nutanix"
Expand Down Expand Up @@ -229,7 +230,8 @@ func (a *Common) generateConfig(dependencies asset.Parents, templateData *bootst
}},
)

if platform == nutanixtypes.Name {
switch platform {
case nutanixtypes.Name:
// Inserts the file "/etc/hostname" with the bootstrap machine name to the bootstrap ignition data
hostname := fmt.Sprintf("%s-bootstrap", clusterID.InfraID)
hostnameFile := igntypes.File{
Expand All @@ -245,6 +247,9 @@ func (a *Common) generateConfig(dependencies asset.Parents, templateData *bootst
},
}
a.Config.Storage.Files = append(a.Config.Storage.Files, hostnameFile)
case aztypes.Name:
// See https://issues.redhat.com/browse/OCPBUGS-43625
ignition.AppendVarPartition(a.Config)
}

return nil
Expand Down
8 changes: 8 additions & 0 deletions pkg/asset/ignition/machine/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import (

igntypes "github.com/coreos/ignition/v2/config/v3_2/types"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/asset/ignition"
"github.com/openshift/installer/pkg/asset/installconfig"
"github.com/openshift/installer/pkg/asset/tls"
"github.com/openshift/installer/pkg/types/azure"
)

const (
Expand Down Expand Up @@ -42,6 +44,12 @@ func (a *Master) Generate(_ context.Context, dependencies asset.Parents) error {

a.Config = pointerIgnitionConfig(installConfig.Config, rootCA.Cert(), "master")

if installConfig.Config.Platform.Name() == azure.Name {
logrus.Debugf("Adding /var partition to skip CoreOS growfs step")
// See https://issues.redhat.com/browse/OCPBUGS-43625
ignition.AppendVarPartition(a.Config)
}

data, err := ignition.Marshal(a.Config)
if err != nil {
return errors.Wrap(err, "failed to marshal Ignition config")
Expand Down
42 changes: 42 additions & 0 deletions pkg/asset/ignition/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
igntypes "github.com/coreos/ignition/v2/config/v3_2/types"
"github.com/vincent-petithory/dataurl"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/utils/ptr"

"github.com/openshift/installer/pkg/asset"
)
Expand Down Expand Up @@ -91,3 +92,44 @@ func ConvertToAppendix(file *igntypes.File) {
file.Contents = igntypes.Resource{}
file.Overwrite = ignutil.BoolToPtr(false)
}

// AppendVarPartition appends a /var partition to the ignition configuration to avoid growfs.
func AppendVarPartition(config *igntypes.Config) {
// https://docs.openshift.com/container-platform/4.17/installing/installing_platform_agnostic/installing-platform-agnostic.html#installation-user-infra-machines-advanced_vardisk_installing-platform-agnostic
config.Storage.Disks = append(config.Storage.Disks, igntypes.Disk{
Device: "/dev/disk/by-id/coreos-boot-disk",
Partitions: []igntypes.Partition{
{
Label: ptr.To("var"),
Number: 5,
StartMiB: ptr.To(50000),
SizeMiB: ptr.To(0),
},
},
})
config.Storage.Filesystems = append(config.Storage.Filesystems, igntypes.Filesystem{
Path: ptr.To("/var"),
Device: "/dev/disk/by-partlabel/var",
Format: ptr.To("xfs"),
MountOptions: []igntypes.MountOption{"defaults", "prjquota"},
})
// generate a mount unit so that this filesystem gets mounted in the real root.
config.Systemd.Units = append(config.Systemd.Units, igntypes.Unit{
Name: "var.mount",
Enabled: ptr.To(true),
Contents: ptr.To(`
[Unit]
Requires=systemd-fsck@dev-disk-by\x2dpartlabel-var.service
After=systemd-fsck@dev-disk-by\x2dpartlabel-var.service
[Mount]
Where=/var
What=/dev/disk/by-partlabel/var
Type=xfs
Options=defaults,prjquota
[Install]
RequiredBy=local-fs.target
`),
})
}

0 comments on commit a10520c

Please sign in to comment.