Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPBUGS-30266: fix: introduce minimum allocation sizes #603

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion cmd/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
topolvmcontrollers "github.com/topolvm/topolvm/pkg/controller"
"github.com/topolvm/topolvm/pkg/driver"
"google.golang.org/grpc"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/utils/ptr"

appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -260,7 +261,15 @@ func run(cmd *cobra.Command, _ []string, opts *Options) error {
return true, nil
})
csi.RegisterIdentityServer(grpcServer, identityServer)
controllerSever, err := driver.NewControllerServer(mgr)
controllerSever, err := driver.NewControllerServer(mgr, driver.ControllerServerSettings{
MinimumAllocationSettings: driver.MinimumAllocationSettings{
Filesystem: map[string]driver.Quantity{
string(lvmv1alpha1.FilesystemTypeExt4): driver.Quantity(resource.MustParse(constants.DefaultMinimumAllocationSizeExt4)),
string(lvmv1alpha1.FilesystemTypeXFS): driver.Quantity(resource.MustParse(constants.DefaultMinimumAllocationSizeXFS)),
},
Block: driver.Quantity(resource.MustParse(constants.DefaultMinimumAllocationSizeBlock)),
},
})
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
github.com/topolvm/topolvm v0.27.1-0.20240306010159-8c6c91dc8b7f
github.com/topolvm/topolvm v0.28.1-0.20240410004534-b0a2229dc10d
go.uber.org/zap v1.27.0
google.golang.org/grpc v1.62.1
gotest.tools/v3 v3.5.1
Expand All @@ -45,7 +45,7 @@ require (
sigs.k8s.io/yaml v1.4.0
)

replace github.com/topolvm/topolvm => github.com/openshift/topolvm v0.15.3-0.20240321104545-ab31b05c1b85
replace github.com/topolvm/topolvm => github.com/openshift/topolvm v0.15.3-0.20240410085813-a5c797a83619

require (
github.com/Masterminds/goutils v1.1.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ github.com/openshift/client-go v0.0.0-20240312121557-60dd5f9fbf8d h1:vdrC3QYkFcs
github.com/openshift/client-go v0.0.0-20240312121557-60dd5f9fbf8d/go.mod h1:Y5Hp789dTrF6Fq8cA5YQlpwffmlLy8mc2un/CY0cg7Q=
github.com/openshift/library-go v0.0.0-20240312152318-4109a9e7a437 h1:xMflL80gT2cXxnmDkR8QLZCbfh/x38jV5XOfLiNlsLE=
github.com/openshift/library-go v0.0.0-20240312152318-4109a9e7a437/go.mod h1:ePlaOqUiPplRc++6aYdMe+2FmXb2xTNS9Nz5laG2YmI=
github.com/openshift/topolvm v0.15.3-0.20240321104545-ab31b05c1b85 h1:LdqfViDjjcIIgidKm+7lIRlpA49XZh9Qfjym4ab4CH8=
github.com/openshift/topolvm v0.15.3-0.20240321104545-ab31b05c1b85/go.mod h1:sp/P6O6+7is1dnV6am+yk+djRxxfcOPyzW4Bi2CfEyU=
github.com/openshift/topolvm v0.15.3-0.20240410085813-a5c797a83619 h1:hZodEfjqhRhC4iIdcfSYBjGU6X6jL6ibhAyI/iASpKU=
github.com/openshift/topolvm v0.15.3-0.20240410085813-a5c797a83619/go.mod h1:2sDyRQ8hxqneC1d/usDasSZECKSCHP77zcIEK6422EM=
github.com/operator-framework/api v0.22.0 h1:UZSn+iaQih4rCReezOnWTTJkMyawwV5iLnIItaOzytY=
github.com/operator-framework/api v0.22.0/go.mod h1:p/7YDbr+n4fmESfZ47yLAV1SvkfE6NU2aX8KhcfI0GA=
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
Expand Down
15 changes: 15 additions & 0 deletions internal/controllers/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,18 @@ const (
PriorityClassNameUserCritical = "openshift-user-critical"
PriorityClassNameClusterCritical = "system-cluster-critical"
)

// these constants are derived from the TopoLVM recommendations but maintained separately to allow easy override.
// see https://github.com/topolvm/topolvm/blob/a967c95da14f80955332a00ebb258e319c6c39ac/cmd/topolvm-controller/app/root.go#L17-L28
const (
// DefaultMinimumAllocationSizeBlock is the default minimum size for a block volume.
// Derived from the usual physical extent size of 4Mi * 2 (for accommodating metadata)
DefaultMinimumAllocationSizeBlock = "8Mi"
// DefaultMinimumAllocationSizeXFS is the default minimum size for a filesystem volume with XFS formatting.
// Derived from the hard XFS minimum size of 300Mi that is enforced by the XFS filesystem.
DefaultMinimumAllocationSizeXFS = "300Mi"
// DefaultMinimumAllocationSizeExt4 is the default minimum size for a filesystem volume with ext4 formatting.
// Derived from the usual 4096K blocks, 1024 inode default and journaling overhead,
// Allows for more than 80% free space after formatting, anything lower significantly reduces this percentage.
DefaultMinimumAllocationSizeExt4 = "32Mi"
)
3 changes: 1 addition & 2 deletions vendor/github.com/topolvm/topolvm/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 38 additions & 13 deletions vendor/github.com/topolvm/topolvm/internal/driver/controller.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 5 additions & 13 deletions vendor/github.com/topolvm/topolvm/internal/driver/node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading