Explicitly name replica and master load balancer params in PostgresSpec
This commit is contained in:
parent
5bc5e70c81
commit
ac6c5bcf09
|
|
@ -12,8 +12,9 @@ spec:
|
|||
zalando:
|
||||
- superuser
|
||||
- createdb
|
||||
useLoadBalancer: true
|
||||
allowedSourceRanges: #Load balancer source ranges
|
||||
enableMasterLoadBalancer: true
|
||||
# enableReplicaLoadBalancer: true # uncomment to enable a LB for a replica k8s service
|
||||
allowedSourceRanges: # load balancers' source ranges for both master and replica services
|
||||
- 127.0.0.1/32
|
||||
databases:
|
||||
foo: zalando
|
||||
|
|
|
|||
|
|
@ -672,14 +672,14 @@ func (c *Cluster) generateSingleUserSecret(namespace string, pgUser spec.PgUser)
|
|||
func (c *Cluster) shouldCreateLoadBalancerForService(role PostgresRole, spec *spec.PostgresSpec) bool {
|
||||
|
||||
// handle LB for the replica service separately if ReplicaLoadBalancer is set in the Postgres manifest
|
||||
if role == Replica && spec.ReplicaLoadBalancer != nil {
|
||||
return *spec.ReplicaLoadBalancer
|
||||
if role == Replica && spec.EnableReplicaLoadBalancer != nil {
|
||||
return *spec.EnableReplicaLoadBalancer
|
||||
}
|
||||
|
||||
// create a load balancer for the master service if either Postgres or operator manifests tell to do so
|
||||
// if ReplicaLoadBalancer is unset and LB for master service is created, also create a balancer for replicas
|
||||
return (spec.UseLoadBalancer != nil && *spec.UseLoadBalancer) ||
|
||||
(spec.UseLoadBalancer == nil && c.OpConfig.EnableLoadBalancer)
|
||||
return (spec.EnableMasterLoadBalancer != nil && *spec.EnableMasterLoadBalancer) ||
|
||||
(spec.EnableMasterLoadBalancer == nil && c.OpConfig.EnableLoadBalancer)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,18 +96,18 @@ type PostgresSpec struct {
|
|||
TeamID string `json:"teamId"`
|
||||
AllowedSourceRanges []string `json:"allowedSourceRanges"`
|
||||
DockerImage string `json:"dockerImage,omitempty"`
|
||||
// EnableLoadBalancer is a pointer, since it is important to know if that parameters is omitted from the Postgres manifest
|
||||
// in that case UseLoadBalancer == nil and the value is taken from the operator config
|
||||
UseLoadBalancer *bool `json:"useLoadBalancer,omitempty"`
|
||||
// if ReplicaLoadBalancer == nil (is unset), value of UseLoadBalancer determines if a balancer for replicas is created
|
||||
ReplicaLoadBalancer *bool `json:"replicaLoadBalancer,omitempty"`
|
||||
NumberOfInstances int32 `json:"numberOfInstances"`
|
||||
Users map[string]UserFlags `json:"users"`
|
||||
MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"`
|
||||
Clone CloneDescription `json:"clone"`
|
||||
ClusterName string `json:"-"`
|
||||
Databases map[string]string `json:"databases,omitempty"`
|
||||
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
|
||||
// EnableMasterLoadBalancer is a pointer, since it is important to know if that parameters is omitted from the Postgres manifest
|
||||
// in that case EnableMasterLoadBalancer == nil and the value is taken from the operator config
|
||||
EnableMasterLoadBalancer *bool `json:"enableMasterLoadBalancer,omitempty"`
|
||||
// if EnableReplicaLoadBalancer == nil (is unset), value of UseLoadBalancer determines if a balancer for replicas is created
|
||||
EnableReplicaLoadBalancer *bool `json:"enableReplicaLoadBalancer,omitempty"`
|
||||
NumberOfInstances int32 `json:"numberOfInstances"`
|
||||
Users map[string]UserFlags `json:"users"`
|
||||
MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"`
|
||||
Clone CloneDescription `json:"clone"`
|
||||
ClusterName string `json:"-"`
|
||||
Databases map[string]string `json:"databases,omitempty"`
|
||||
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
|
||||
}
|
||||
|
||||
// PostgresqlList defines a list of PostgreSQL clusters.
|
||||
|
|
|
|||
Loading…
Reference in New Issue