Move statefulset creation from cluster spec to the separate function

This commit is contained in:
Murat Kabilov
2017-05-12 11:41:25 +02:00
parent 776ed3fa0f
commit caa0eab19b
2 changed files with 16 additions and 21 deletions
+1 -10
View File
@@ -23,7 +23,6 @@ import (
"github.bus.zalan.do/acid/postgres-operator/pkg/util"
"github.bus.zalan.do/acid/postgres-operator/pkg/util/constants"
"github.bus.zalan.do/acid/postgres-operator/pkg/util/k8sutil"
"github.bus.zalan.do/acid/postgres-operator/pkg/util/resources"
"github.bus.zalan.do/acid/postgres-operator/pkg/util/teams"
)
@@ -199,15 +198,7 @@ func (c *Cluster) Create() error {
}
func (c *Cluster) Update(newSpec *spec.Postgresql, rollingUpdate bool) error {
nSpec := newSpec.Spec
cSpec := c.Spec
clusterName := c.ClusterName()
volumeSize := cSpec.Volume.Size
volumeStorageClass := cSpec.Volume.StorageClass
resourceList := resources.ResourceList(nSpec.Resources)
template := resources.PodTemplate(clusterName, resourceList, c.dockerImage, nSpec.Version, c.etcdHost)
volumeClaimTemplate := resources.VolumeClaimTemplate(volumeSize, volumeStorageClass)
statefulSet := resources.StatefulSet(clusterName, template, volumeClaimTemplate, nSpec.NumberOfInstances)
statefulSet := getStatefulSet(c.ClusterName(), newSpec.Spec, c.etcdHost, c.dockerImage)
//TODO: mind the case of updating allowedSourceRanges
err := c.updateStatefulSet(statefulSet)