Skip to content

Commit

Permalink
feat: Cluster ephemeral volume configuration validation.
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Fyne <josh.fyne@gmail.com>
  • Loading branch information
jfyne committed Jan 15, 2024
1 parent 7c86a41 commit 8102f83
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions api/v1/cluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ func (r *Cluster) Validate() (allErrs field.ErrorList) {
r.validateMaxSyncReplicas,
r.validateStorageSize,
r.validateWalStorageSize,
r.validateEphemeralVolumeSource,
r.validateTablespaceStorageSize,
r.validateName,
r.validateTablespaceNames,
Expand Down Expand Up @@ -1475,6 +1476,19 @@ func (r *Cluster) validateWalStorageSize() field.ErrorList {
return result
}

func (r *Cluster) validateEphemeralVolumeSource() field.ErrorList {
var result field.ErrorList

if r.Spec.EphemeralVolumeSource != nil && (r.Spec.EphemeralVolumesSizeLimit != nil && r.Spec.EphemeralVolumesSizeLimit.TemporaryData != nil) {
result = append(result, field.Duplicate(
field.NewPath("spec", "ephemeralVolumeSource"),
"ephemeralVolumeSource and ephemeralVolumesSizeLimit.temporaryData are in conflict, set one only",
))
}

return result
}

func (r *Cluster) validateTablespaceStorageSize() field.ErrorList {
if r.Spec.Tablespaces == nil {
return nil
Expand Down

0 comments on commit 8102f83

Please sign in to comment.