GoogleCloudPlatform / elcarro-oracle-operator

El Carro is a new project that offers a way to run Oracle databases in Kubernetes as a portable, open source, community driven, no vendor lock-in container orchestration system. El Carro provides a powerful declarative API for comprehensive and consistent configuration and deployment as well as for real-time operations and monitoring.
Apache License 2.0
209 stars 55 forks source link

Specified size of additional disks on Instance is ignored #371

Closed M-Schiefer closed 6 months ago

M-Schiefer commented 8 months ago

Describe the bug When defining an additional disk in the Instance spec, e.g. like this:

  disks:
    - name: DataDisk
      size: 200Gi
      storageClass: "standard-rwo"
    - name: LogDisk
      size: 100Gi
      storageClass: "standard-rwo"
    - name: DataDisk2
      size: 64Ti
      storageClass: standard-rwo

The disk will get a default size of 100Gi instead of the desired disk size of e.g. 64Ti.

Expected behavior The disk should be created with the specified size, the same way the size of the default disks can be specified.

Proposed solution This is the change I did in our fork and it has fixed the problem in our tests. image => Because the new disk does not exist in the defaultDiskSpecs, the default size of 100Gi is used instead of the specified size.

common/pkg/utils/utils.go

func FindDiskSize(diskSpec *commonv1alpha1.DiskSpec, configSpec *commonv1alpha1.ConfigSpec, defaultDiskSpecs map[string]commonv1alpha1.DiskSpec, defaultDiskSize resource.Quantity) resource.Quantity {
    spec, exists := defaultDiskSpecs[diskSpec.Name]

    if !diskSpec.Size.IsZero() {
        return diskSpec.Size
    }

    if configSpec != nil {
        for _, d := range configSpec.Disks {
            if d.Name == diskSpec.Name {
                if !d.Size.IsZero() {
                    return d.Size
                }
                break
            }
        }
    }

    if exists {
        return spec.Size
    }
    return defaultDiskSize
}
akinfermo commented 6 months ago

Fixed by https://github.com/GoogleCloudPlatform/elcarro-oracle-operator/pull/376