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:
|
zalando:
|
||||||
- superuser
|
- superuser
|
||||||
- createdb
|
- createdb
|
||||||
useLoadBalancer: true
|
enableMasterLoadBalancer: true
|
||||||
allowedSourceRanges: #Load balancer source ranges
|
# 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
|
- 127.0.0.1/32
|
||||||
databases:
|
databases:
|
||||||
foo: zalando
|
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 {
|
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
|
// handle LB for the replica service separately if ReplicaLoadBalancer is set in the Postgres manifest
|
||||||
if role == Replica && spec.ReplicaLoadBalancer != nil {
|
if role == Replica && spec.EnableReplicaLoadBalancer != nil {
|
||||||
return *spec.ReplicaLoadBalancer
|
return *spec.EnableReplicaLoadBalancer
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a load balancer for the master service if either Postgres or operator manifests tell to do so
|
// 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
|
// if ReplicaLoadBalancer is unset and LB for master service is created, also create a balancer for replicas
|
||||||
return (spec.UseLoadBalancer != nil && *spec.UseLoadBalancer) ||
|
return (spec.EnableMasterLoadBalancer != nil && *spec.EnableMasterLoadBalancer) ||
|
||||||
(spec.UseLoadBalancer == nil && c.OpConfig.EnableLoadBalancer)
|
(spec.EnableMasterLoadBalancer == nil && c.OpConfig.EnableLoadBalancer)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,18 +96,18 @@ type PostgresSpec struct {
|
||||||
TeamID string `json:"teamId"`
|
TeamID string `json:"teamId"`
|
||||||
AllowedSourceRanges []string `json:"allowedSourceRanges"`
|
AllowedSourceRanges []string `json:"allowedSourceRanges"`
|
||||||
DockerImage string `json:"dockerImage,omitempty"`
|
DockerImage string `json:"dockerImage,omitempty"`
|
||||||
// EnableLoadBalancer is a pointer, since it is important to know if that parameters is omitted from the Postgres manifest
|
// EnableMasterLoadBalancer 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
|
// in that case EnableMasterLoadBalancer == nil and the value is taken from the operator config
|
||||||
UseLoadBalancer *bool `json:"useLoadBalancer,omitempty"`
|
EnableMasterLoadBalancer *bool `json:"enableMasterLoadBalancer,omitempty"`
|
||||||
// if ReplicaLoadBalancer == nil (is unset), value of UseLoadBalancer determines if a balancer for replicas is created
|
// if EnableReplicaLoadBalancer == nil (is unset), value of UseLoadBalancer determines if a balancer for replicas is created
|
||||||
ReplicaLoadBalancer *bool `json:"replicaLoadBalancer,omitempty"`
|
EnableReplicaLoadBalancer *bool `json:"enableReplicaLoadBalancer,omitempty"`
|
||||||
NumberOfInstances int32 `json:"numberOfInstances"`
|
NumberOfInstances int32 `json:"numberOfInstances"`
|
||||||
Users map[string]UserFlags `json:"users"`
|
Users map[string]UserFlags `json:"users"`
|
||||||
MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"`
|
MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"`
|
||||||
Clone CloneDescription `json:"clone"`
|
Clone CloneDescription `json:"clone"`
|
||||||
ClusterName string `json:"-"`
|
ClusterName string `json:"-"`
|
||||||
Databases map[string]string `json:"databases,omitempty"`
|
Databases map[string]string `json:"databases,omitempty"`
|
||||||
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
|
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PostgresqlList defines a list of PostgreSQL clusters.
|
// PostgresqlList defines a list of PostgreSQL clusters.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue