mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-06 02:53:54 +02:00
check resource requests also on UPDATE and SYNC + update docs
This commit is contained in:
@@ -228,7 +228,7 @@ func (c *Cluster) Create() error {
|
||||
c.setStatus(acidv1.ClusterStatusCreating)
|
||||
|
||||
if err = c.validateResources(&c.Spec); err != nil {
|
||||
return fmt.Errorf("unsufficient ressources: %v", err)
|
||||
return fmt.Errorf("insufficient resources specified: %v", err)
|
||||
}
|
||||
|
||||
for _, role := range []PostgresRole{Master, Replica} {
|
||||
@@ -595,6 +595,12 @@ func (c *Cluster) Update(oldSpec, newSpec *acidv1.Postgresql) error {
|
||||
}
|
||||
}
|
||||
|
||||
// check pod resources and volume size and cancel update if they are too low
|
||||
if err := c.validateResources(&c.Spec); err != nil {
|
||||
updateFailed = true
|
||||
return fmt.Errorf("insufficient resources specified: %v", err)
|
||||
}
|
||||
|
||||
// Volume
|
||||
if oldSpec.Spec.Size != newSpec.Spec.Size {
|
||||
c.logger.Debugf("syncing persistent volumes")
|
||||
|
||||
@@ -34,6 +34,11 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error {
|
||||
}
|
||||
}()
|
||||
|
||||
if err = c.validateResources(&c.Spec); err != nil {
|
||||
err = fmt.Errorf("insufficient resources specified: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
if err = c.initUsers(); err != nil {
|
||||
err = fmt.Errorf("could not init users: %v", err)
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user