Skip to content
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
2 changes: 1 addition & 1 deletion app/controller/server/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (c *Controller) Init(ctx context.Context) (*types.Server, error) {
MaxConcurrentBuilds: 3,
MaxCPUPerBuild: 1,
MaxMemoryPerBuild: 2,
VolumeMinSize: 1,
VolumeMinSize: 1024,
}

manager, err := c.resolveServerManager(server)
Expand Down
4 changes: 2 additions & 2 deletions app/controller/volume/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ func (c *Controller) sanitizeCreateInput(in *types.VolumeCreateInput) error {
func (c *Controller) validateRestrictions(in *types.VolumeCreateInput, restrictions *types.VolumeRestriction) error {
err := check.NewValidationErrors()
if in.Size < restrictions.MinVolumeSize {
err.AddValidationError("size", check.NewValidationErrorf("Volume is below min allowed limit of %dGB", restrictions.MinVolumeSize))
err.AddValidationError("size", check.NewValidationErrorf("Volume is below min allowed limit of %dMiB", restrictions.MinVolumeSize))
}
if in.Size > restrictions.MaxVolumeSize {
err.AddValidationError("size", check.NewValidationErrorf("Volume is above max allowed limit of %dGB", restrictions.MaxVolumeSize))
err.AddValidationError("size", check.NewValidationErrorf("Volume is above max allowed limit of %dMiB", restrictions.MaxVolumeSize))
}

if err.HasError() {
Expand Down
2 changes: 1 addition & 1 deletion app/pipeline/convert/deploy_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func getTemplateInput(image string, input *pipeline.RunnerContextInput, spec *ty
for _, v := range input.Volumes {
in.Volumes = append(in.Volumes, &templates.Volume{
VolumeName: v.GetIdentifierStr(),
Storage: fmt.Sprintf("%dGi", v.Size),
Storage: fmt.Sprintf("%dMi", v.Size),
MountPath: v.MountPath,
})
}
Expand Down
2 changes: 1 addition & 1 deletion app/services/config/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
func (s *Service) GetVolumeRestrictions(server *types.Server, tenant *types.Tenant) *types.VolumeRestriction {
return &types.VolumeRestriction{
MaxVolumes: tenant.MaxVolumes,
MinVolumeSize: helpers.Max(tenant.MinVolumeSize, server.VolumeMinSize),
MinVolumeSize: helpers.Min(tenant.MinVolumeSize, server.VolumeMinSize),
MaxVolumeSize: tenant.MaxVolumeSize,
}
}
2 changes: 1 addition & 1 deletion app/services/spec/input_mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const (
defaultTCPPort = 8000
defaultMountName = "Storage"
defaultMountPath = "/data"
defaultMountSize = 1
defaultMountSize = 1024
defaultReplicas = 1
defaultMemory = 0.5
defaultCPU = 1
Expand Down
3 changes: 2 additions & 1 deletion app/web/views/components/vserver/limits.templ
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ templ limits(server *types.Server) {
@shared.Input(&shared.InputProps{
Name: "min_volume_size",
Label: "Min Volume Size",
Tooltip: `Minimum size of the volume in GB, this is to handle the limitations of the underlying cloud
Tooltip: `Minimum size of the volume in MiB, this is to handle the limitations of the underlying cloud
providers if any. E.g. linode cannot have volumes less than 10GB.`,
Description: "Volume size is in MiB",
Type: "number",
Placeholder: "1",
Required: true,
Expand Down
33 changes: 18 additions & 15 deletions app/web/views/components/vtenant/limits.templ
Original file line number Diff line number Diff line change
Expand Up @@ -106,35 +106,38 @@ templ Limits(tenant *types.Tenant, restrictions *types.TenantRestrictions, canEd
<h3>Volume Limits</h3>
<div class="flex flex-wrap gap-1 sm:gap-2 md:gap-4">
@shared.Input(&shared.InputProps{
Name: "max_volumes",
Label: "Max Volumes",
Type: "number",
Tooltip: "Maximum number of volumes allowed to be created in this team.",
Disabled: !canEdit,
Name: "max_volumes",
Label: "Max Volumes",
Type: "number",
Tooltip: "Maximum number of volumes allowed to be created in this team.",
Description: "Volume size is in MiB",
Disabled: !canEdit,
Attrs: templ.Attributes{
"x-model.number": "form.max_volumes",
"x-bind:min": "1",
"x-bind:max": "100",
},
})
@shared.Input(&shared.InputProps{
Name: "min_volume_size",
Label: "Min Volume Size",
Type: "number",
Tooltip: "Minimum size allowed per volume in this team.",
Disabled: !canEdit,
Name: "min_volume_size",
Label: "Min Volume Size",
Type: "number",
Tooltip: "Minimum size allowed per volume in this team.",
Description: "Volume size is in MiB",
Disabled: !canEdit,
Attrs: templ.Attributes{
"x-model.number": "form.min_volume_size",
"x-bind:min": "1",
"x-bind:max": "100",
},
})
@shared.Input(&shared.InputProps{
Name: "max_volume_size",
Label: "Max Volume Size",
Type: "number",
Tooltip: "Maximum size allowed per volume in this team.",
Disabled: !canEdit,
Name: "max_volume_size",
Label: "Max Volume Size",
Type: "number",
Tooltip: "Maximum size allowed per volume in this team.",
Description: "Volume size is in MiB",
Disabled: !canEdit,
Attrs: templ.Attributes{
"x-model.number": "form.max_volume_size",
"x-bind:min": "1",
Expand Down
5 changes: 3 additions & 2 deletions app/web/views/components/vvolume/form.templ
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ templ form(action enum.VolumeFormAction, in *types.VolumeCreateInput, uid int64)
})
@shared.Input(&shared.InputProps{
Label: "Size",
Tooltip: "Size of the volume in GB, cannot be downsized",
Tooltip: "Size of the volume in MiB, cannot be downsized",
Description: "Volume size is in MiB",
Name: "size",
Type: "number",
Placeholder: "1",
Placeholder: "1024",
Required: true,
Readonly: action == enum.VolumeFormActionDelete || action == enum.VolumeFormActionAttach,
Attrs: templ.Attributes{
Expand Down
2 changes: 1 addition & 1 deletion app/web/views/components/vvolume/tile.templ
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ templ tile(volume *types.Volume, action enum.VolumeFormAction) {
<div class="flex items-center justify-between gap-1">
<p class="font-medium truncate">{ volume.Name }</p>
<p class="text-tx-secondary">{ volume.MountPath }</p>
<p class="text-tx-secondary text-xs">{ fmt.Sprintf("%d",volume.Size) } GB</p>
<p class="text-tx-secondary text-xs">{ fmt.Sprintf("%d",volume.Size) } MiB</p>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ type TenantConfig struct {
DefaultMaxCPUPerApplication int64 `envconfig:"CLOUDNESS_TENANT_MAX_CPU" default:"2"`
DefaultMaxMemoryPerApplication float64 `envconfig:"CLOUDNESS_TENANT_MAX_MEMORY" default:"2"`
DefaultMaxVolumeCount int64 `envconfig:"CLOUDNESS_TENANT_MAX_VOLUME_COUNT" default:"10"`
DefaultMinVolumeSize int64 `envconfig:"CLOUDNESS_TENANT_MIN_VOLUME_SIZE" default:"1"`
DefaultMaxVolumeSize int64 `envconfig:"CLOUDNESS_TENANT_MAX_VOLUME_SIZE" default:"10"`
DefaultMinVolumeSize int64 `envconfig:"CLOUDNESS_TENANT_MIN_VOLUME_SIZE" default:"1024"`
DefaultMaxVolumeSize int64 `envconfig:"CLOUDNESS_TENANT_MAX_VOLUME_SIZE" default:"10240"`
}

type KubeServerConfig struct {
Expand Down
Loading