Skip to content

Commit

Permalink
Do not require the storage class name for reapers storage
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvoncek committed Jul 19, 2024
1 parent 1b12935 commit bd76ffb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
5 changes: 1 addition & 4 deletions apis/k8ssandra/v1alpha1/k8ssandracluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ var (
ErrClusterName = fmt.Errorf("cluster name can not be changed")
ErrNoStoragePrefix = fmt.Errorf("medusa storage prefix must be set when a medusaConfigurationRef is used")
ErrNoReaperStorageConfig = fmt.Errorf("reaper StorageConfig not set")
ErrNoReaperStorageClassName = fmt.Errorf("reaper StorageConfig.StorageClassName not set")
ErrNoReaperAccessMode = fmt.Errorf("reaper StorageConfig.AccessModes not set")
ErrNoReaperResourceRequests = fmt.Errorf("reaper StorageConfig.Resources.Requests not set")
ErrNoReaperStorageRequest = fmt.Errorf("reaper StorageConfig.Resources.Requests.Storage not set")
Expand Down Expand Up @@ -292,9 +291,7 @@ func (r *K8ssandraCluster) validateReaper() error {
if r.Spec.Reaper.StorageConfig == nil {
return ErrNoReaperStorageConfig
}
if r.Spec.Reaper.StorageConfig.StorageClassName == nil {
return ErrNoReaperStorageClassName
}
// not checking StorageClassName because Kubernetes will use a default one if it's not set
if r.Spec.Reaper.StorageConfig.AccessModes == nil {
return ErrNoReaperAccessMode
}
Expand Down
6 changes: 0 additions & 6 deletions apis/k8ssandra/v1alpha1/k8ssandracluster_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,6 @@ func testReaperStorage(t *testing.T) {
err = reaperWithDefaultConfig.validateK8ssandraCluster()
required.NoError(err)

reaperWithoutStorageClass := createClusterObjWithCassandraConfig("reaper-no-storage-class", "ns")
reaperWithoutStorageClass.Spec.Reaper = minimalInMemoryReaperConfig.DeepCopy()
reaperWithoutStorageClass.Spec.Reaper.StorageConfig.StorageClassName = nil
err = reaperWithoutStorageClass.validateK8ssandraCluster()
required.Error(err)

reaperWithoutAccessMode := createClusterObjWithCassandraConfig("reaper-no-access-mode", "ns")
reaperWithoutAccessMode.Spec.Reaper = minimalInMemoryReaperConfig.DeepCopy()
reaperWithoutAccessMode.Spec.Reaper.StorageConfig.AccessModes = nil
Expand Down

0 comments on commit bd76ffb

Please sign in to comment.