diff --git a/pkg/apis/elasticsearch/v1beta1/validations_test.go b/pkg/apis/elasticsearch/v1beta1/validations_test.go index f8cddb3edb5..d4e12593562 100644 --- a/pkg/apis/elasticsearch/v1beta1/validations_test.go +++ b/pkg/apis/elasticsearch/v1beta1/validations_test.go @@ -352,7 +352,7 @@ func Test_pvcModified(t *testing.T) { Name: "elasticsearch-data", }, Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("10Gi"), }, @@ -382,7 +382,7 @@ func Test_pvcModified(t *testing.T) { Name: "elasticsearch-data", }, Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("5Gi"), }, @@ -412,7 +412,7 @@ func Test_pvcModified(t *testing.T) { Name: "elasticsearch-data", }, Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("5Gi"), }, @@ -424,7 +424,7 @@ func Test_pvcModified(t *testing.T) { Name: "elasticsearch-data1", }, Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("5Gi"), }, @@ -454,7 +454,7 @@ func Test_pvcModified(t *testing.T) { Name: "elasticsearch-data1", }, Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("5Gi"), }, @@ -484,7 +484,7 @@ func Test_pvcModified(t *testing.T) { Name: "elasticsearch-data", }, Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("5Gi"), }, @@ -501,7 +501,7 @@ func Test_pvcModified(t *testing.T) { Name: "elasticsearch-data", }, Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("10Gi"), }, @@ -645,7 +645,7 @@ func getEsCluster() *Elasticsearch { Name: "elasticsearch-data", }, Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("5Gi"), }, diff --git a/pkg/controller/autoscaling/elasticsearch/resources/resources_test.go b/pkg/controller/autoscaling/elasticsearch/resources/resources_test.go index 7f603deb9fe..cdd23aba21b 100644 --- a/pkg/controller/autoscaling/elasticsearch/resources/resources_test.go +++ b/pkg/controller/autoscaling/elasticsearch/resources/resources_test.go @@ -256,7 +256,7 @@ func (nsb *nodeSetBuilder) build() esv1.NodeSet { Name: volume.ElasticsearchDataVolumeName, }, Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: *nsb.storageRequest, }, diff --git a/pkg/controller/elasticsearch/driver/desired_nodes_test.go b/pkg/controller/elasticsearch/driver/desired_nodes_test.go index 91dd1b3d8be..976dbbbfbc0 100644 --- a/pkg/controller/elasticsearch/driver/desired_nodes_test.go +++ b/pkg/controller/elasticsearch/driver/desired_nodes_test.go @@ -616,7 +616,7 @@ func (esb esBuilder) toExpectedResources() nodespec.ResourcesList { { ObjectMeta: metav1.ObjectMeta{Name: "elasticsearch-data"}, Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: fns.claimedStorage.DeepCopy(), }, @@ -673,7 +673,7 @@ func (esb esBuilder) toResources() []crclient.Object { Generation: 1, }, Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{corev1.ResourceStorage: nodeSet.claimedStorage.DeepCopy()}, }, }, diff --git a/pkg/controller/elasticsearch/driver/pvc_expansion_test.go b/pkg/controller/elasticsearch/driver/pvc_expansion_test.go index 5c2f98139f6..f60833119d8 100644 --- a/pkg/controller/elasticsearch/driver/pvc_expansion_test.go +++ b/pkg/controller/elasticsearch/driver/pvc_expansion_test.go @@ -36,14 +36,14 @@ var ( ObjectMeta: metav1.ObjectMeta{Name: "sample-claim"}, Spec: corev1.PersistentVolumeClaimSpec{ StorageClassName: pointer.String(sampleStorageClass.Name), - Resources: corev1.ResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ + Resources: corev1.VolumeResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceStorage: resource.MustParse("1Gi"), }}}} sampleClaim2 = corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{Name: "sample-claim-2"}, Spec: corev1.PersistentVolumeClaimSpec{ StorageClassName: pointer.String(sampleStorageClass.Name), - Resources: corev1.ResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ + Resources: corev1.VolumeResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceStorage: resource.MustParse("1Gi"), }}}} diff --git a/pkg/controller/elasticsearch/driver/upscale_test.go b/pkg/controller/elasticsearch/driver/upscale_test.go index 55f315e5cc9..963562e119b 100644 --- a/pkg/controller/elasticsearch/driver/upscale_test.go +++ b/pkg/controller/elasticsearch/driver/upscale_test.go @@ -267,7 +267,7 @@ func TestHandleUpscaleAndSpecChanges_PVCResize(t *testing.T) { VolumeClaimTemplates: []corev1.PersistentVolumeClaim{ {ObjectMeta: metav1.ObjectMeta{Name: "elasticsearch-data"}, Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("1Gi"), }, diff --git a/pkg/controller/elasticsearch/nodespec/volumes_test.go b/pkg/controller/elasticsearch/nodespec/volumes_test.go index 0f42fcec2c7..58b7392786f 100644 --- a/pkg/controller/elasticsearch/nodespec/volumes_test.go +++ b/pkg/controller/elasticsearch/nodespec/volumes_test.go @@ -44,7 +44,7 @@ func Test_BuildVolumes_DataVolumeMountPath(t *testing.T) { AccessModes: []corev1.PersistentVolumeAccessMode{ corev1.ReadWriteOnce, }, - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("42Ti"), }, diff --git a/pkg/controller/elasticsearch/validation/volume_validation_test.go b/pkg/controller/elasticsearch/validation/volume_validation_test.go index 7a922e2ef60..f1879cfab53 100644 --- a/pkg/controller/elasticsearch/validation/volume_validation_test.go +++ b/pkg/controller/elasticsearch/validation/volume_validation_test.go @@ -37,14 +37,14 @@ var ( ObjectMeta: metav1.ObjectMeta{Name: "sample-claim"}, Spec: corev1.PersistentVolumeClaimSpec{ StorageClassName: pointer.String(sampleStorageClass.Name), - Resources: corev1.ResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ + Resources: corev1.VolumeResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceStorage: resource.MustParse("1Gi"), }}}} sampleClaim2 = corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{Name: "sample-claim-2"}, Spec: corev1.PersistentVolumeClaimSpec{ StorageClassName: pointer.String(sampleStorageClass.Name), - Resources: corev1.ResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ + Resources: corev1.VolumeResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceStorage: resource.MustParse("1Gi"), }}}} ) diff --git a/pkg/controller/elasticsearch/volume/defaults.go b/pkg/controller/elasticsearch/volume/defaults.go index 0e80c6ce2ac..a1ae2dd6564 100644 --- a/pkg/controller/elasticsearch/volume/defaults.go +++ b/pkg/controller/elasticsearch/volume/defaults.go @@ -23,7 +23,7 @@ var ( AccessModes: []corev1.PersistentVolumeAccessMode{ corev1.ReadWriteOnce, }, - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: DefaultPersistentVolumeSize, }, diff --git a/pkg/controller/logstash/volume/defaults.go b/pkg/controller/logstash/volume/defaults.go index 000bec57180..5890310ab48 100644 --- a/pkg/controller/logstash/volume/defaults.go +++ b/pkg/controller/logstash/volume/defaults.go @@ -33,7 +33,7 @@ var ( AccessModes: []corev1.PersistentVolumeAccessMode{ corev1.ReadWriteOnce, }, - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: DefaultPersistentVolumeSize, }, diff --git a/pkg/controller/logstash/volume/volumes_test.go b/pkg/controller/logstash/volume/volumes_test.go index fc85f948e48..adf8538e5ef 100644 --- a/pkg/controller/logstash/volume/volumes_test.go +++ b/pkg/controller/logstash/volume/volumes_test.go @@ -115,7 +115,7 @@ func Test_BuildVolumesAndMounts(t *testing.T) { AccessModes: []corev1.PersistentVolumeAccessMode{ corev1.ReadWriteOnce, }, - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("42Ti"), }, @@ -138,7 +138,7 @@ func Test_BuildVolumesAndMounts(t *testing.T) { AccessModes: []corev1.PersistentVolumeAccessMode{ corev1.ReadWriteOnce, }, - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("42Ti"), }, @@ -161,7 +161,7 @@ func Test_BuildVolumesAndMounts(t *testing.T) { AccessModes: []corev1.PersistentVolumeAccessMode{ corev1.ReadWriteOnce, }, - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("42Ti"), }, @@ -176,7 +176,7 @@ func Test_BuildVolumesAndMounts(t *testing.T) { AccessModes: []corev1.PersistentVolumeAccessMode{ corev1.ReadWriteOnce, }, - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("42Ti"), }, diff --git a/pkg/utils/k8s/k8sutils.go b/pkg/utils/k8s/k8sutils.go index b69f0e7ad7b..cb2d484a3c2 100644 --- a/pkg/utils/k8s/k8sutils.go +++ b/pkg/utils/k8s/k8sutils.go @@ -235,7 +235,7 @@ type StorageComparison struct { // CompareStorageRequests compares storage requests in the given resource requirements. // It returns a zero-ed StorageComparison in case one of the requests is zero (value not set: comparison not possible). -func CompareStorageRequests(initial corev1.ResourceRequirements, updated corev1.ResourceRequirements) StorageComparison { +func CompareStorageRequests(initial corev1.VolumeResourceRequirements, updated corev1.VolumeResourceRequirements) StorageComparison { initialSize := initial.Requests.Storage() updatedSize := updated.Requests.Storage() if initialSize.IsZero() || updatedSize.IsZero() { diff --git a/pkg/utils/k8s/k8sutils_test.go b/pkg/utils/k8s/k8sutils_test.go index af00ee0ba85..f4666d8840c 100644 --- a/pkg/utils/k8s/k8sutils_test.go +++ b/pkg/utils/k8s/k8sutils_test.go @@ -150,8 +150,8 @@ func TestGetServiceIPAddresses(t *testing.T) { func TestCompareStorageRequests(t *testing.T) { type args struct { - initial corev1.ResourceRequirements - updated corev1.ResourceRequirements + initial corev1.VolumeResourceRequirements + updated corev1.VolumeResourceRequirements } tests := []struct { name string @@ -161,10 +161,10 @@ func TestCompareStorageRequests(t *testing.T) { { name: "same size", args: args{ - initial: corev1.ResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ + initial: corev1.VolumeResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceStorage: resource.MustParse("1Gi"), }}, - updated: corev1.ResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ + updated: corev1.VolumeResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceStorage: resource.MustParse("1Gi"), }}, }, @@ -173,10 +173,10 @@ func TestCompareStorageRequests(t *testing.T) { { name: "storage increase", args: args{ - initial: corev1.ResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ + initial: corev1.VolumeResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceStorage: resource.MustParse("1Gi"), }}, - updated: corev1.ResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ + updated: corev1.VolumeResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceStorage: resource.MustParse("2Gi"), }}, }, @@ -185,10 +185,10 @@ func TestCompareStorageRequests(t *testing.T) { { name: "storage decrease", args: args{ - initial: corev1.ResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ + initial: corev1.VolumeResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceStorage: resource.MustParse("2Gi"), }}, - updated: corev1.ResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ + updated: corev1.VolumeResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceStorage: resource.MustParse("1Gi"), }}, }, @@ -197,16 +197,16 @@ func TestCompareStorageRequests(t *testing.T) { { name: "no storage specified in both", args: args{ - initial: corev1.ResourceRequirements{}, - updated: corev1.ResourceRequirements{}, + initial: corev1.VolumeResourceRequirements{}, + updated: corev1.VolumeResourceRequirements{}, }, want: StorageComparison{}, }, { name: "no initial storage specified: not an increase", args: args{ - initial: corev1.ResourceRequirements{}, - updated: corev1.ResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ + initial: corev1.VolumeResourceRequirements{}, + updated: corev1.VolumeResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceStorage: resource.MustParse("1Gi"), }}, }, @@ -215,10 +215,10 @@ func TestCompareStorageRequests(t *testing.T) { { name: "no updated storage specified: not a decrease", args: args{ - initial: corev1.ResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ + initial: corev1.VolumeResourceRequirements{Requests: map[corev1.ResourceName]resource.Quantity{ corev1.ResourceStorage: resource.MustParse("1Gi"), }}, - updated: corev1.ResourceRequirements{}, + updated: corev1.VolumeResourceRequirements{}, }, want: StorageComparison{}, }, diff --git a/test/e2e/es/autoscaling_test.go b/test/e2e/es/autoscaling_test.go index d22ad11bb92..a596d6a318d 100644 --- a/test/e2e/es/autoscaling_test.go +++ b/test/e2e/es/autoscaling_test.go @@ -171,7 +171,7 @@ func newPVC(storageQuantity, storageClass string) corev1.PersistentVolumeClaim { AccessModes: []corev1.PersistentVolumeAccessMode{ corev1.ReadWriteOnce, }, - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse(storageQuantity), }, diff --git a/test/e2e/es/volume_test.go b/test/e2e/es/volume_test.go index a43d1536fc1..640aacdfd6d 100644 --- a/test/e2e/es/volume_test.go +++ b/test/e2e/es/volume_test.go @@ -114,7 +114,7 @@ func TestVolumeMultiDataPath(t *testing.T) { AccessModes: []corev1.PersistentVolumeAccessMode{ corev1.ReadWriteOnce, }, - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("2Gi"), }, @@ -130,7 +130,7 @@ func TestVolumeMultiDataPath(t *testing.T) { AccessModes: []corev1.PersistentVolumeAccessMode{ corev1.ReadWriteOnce, }, - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("2Gi"), }, diff --git a/test/e2e/test/elasticsearch/builder.go b/test/e2e/test/elasticsearch/builder.go index f133d496fa9..6eeb47351cb 100644 --- a/test/e2e/test/elasticsearch/builder.go +++ b/test/e2e/test/elasticsearch/builder.go @@ -393,7 +393,7 @@ func (b Builder) WithDefaultPersistentVolumes() Builder { AccessModes: []corev1.PersistentVolumeAccessMode{ corev1.ReadWriteOnce, }, - Resources: corev1.ResourceRequirements{ + Resources: corev1.VolumeResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceStorage: resource.MustParse("1Gi"), },