target port should be intval
This commit is contained in:
parent
8db652126c
commit
43f275c89c
|
|
@ -247,7 +247,7 @@ func (c *Cluster) generateConnectionPoolerPodTemplate(role PostgresRole) (
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "PGPORT",
|
Name: "PGPORT",
|
||||||
Value: c.servicePort(role),
|
Value: fmt.Sprint(c.servicePort(role)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "PGUSER",
|
Name: "PGUSER",
|
||||||
|
|
@ -386,7 +386,7 @@ func (c *Cluster) generateConnectionPoolerService(connectionPooler *ConnectionPo
|
||||||
{
|
{
|
||||||
Name: connectionPooler.Name,
|
Name: connectionPooler.Name,
|
||||||
Port: pgPort,
|
Port: pgPort,
|
||||||
TargetPort: intstr.IntOrString{Type: 1, StrVal: c.servicePort(connectionPooler.Role)},
|
TargetPort: intstr.IntOrString{IntVal: c.servicePort(connectionPooler.Role)},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Type: v1.ServiceTypeClusterIP,
|
Type: v1.ServiceTypeClusterIP,
|
||||||
|
|
|
||||||
|
|
@ -99,15 +99,15 @@ func (c *Cluster) serviceAddress(role PostgresRole) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cluster) servicePort(role PostgresRole) string {
|
func (c *Cluster) servicePort(role PostgresRole) int32 {
|
||||||
service, exist := c.Services[role]
|
service, exist := c.Services[role]
|
||||||
|
|
||||||
if exist {
|
if exist {
|
||||||
return fmt.Sprint(service.Spec.Ports[0].Port)
|
return service.Spec.Ports[0].Port
|
||||||
}
|
}
|
||||||
|
|
||||||
c.logger.Warningf("No service for role %s", role)
|
c.logger.Warningf("No service for role %s - defaulting to port 5432", role)
|
||||||
return ""
|
return 5432
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cluster) podDisruptionBudgetName() string {
|
func (c *Cluster) podDisruptionBudgetName() string {
|
||||||
|
|
|
||||||
|
|
@ -1479,7 +1479,7 @@ func getServices(serviceType v1.ServiceType, sourceRanges []string, extTrafficPo
|
||||||
v1.ServiceSpec{
|
v1.ServiceSpec{
|
||||||
ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyType(extTrafficPolicy),
|
ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyType(extTrafficPolicy),
|
||||||
LoadBalancerSourceRanges: sourceRanges,
|
LoadBalancerSourceRanges: sourceRanges,
|
||||||
Ports: []v1.ServicePort{{Name: clusterName + "-pooler", Port: 5432, TargetPort: intstr.IntOrString{Type: 1, StrVal: "5432"}}},
|
Ports: []v1.ServicePort{{Name: clusterName + "-pooler", Port: 5432, TargetPort: intstr.IntOrString{IntVal: 5432}}},
|
||||||
Selector: map[string]string{"connection-pooler": clusterName + "-pooler"},
|
Selector: map[string]string{"connection-pooler": clusterName + "-pooler"},
|
||||||
Type: serviceType,
|
Type: serviceType,
|
||||||
},
|
},
|
||||||
|
|
@ -1493,7 +1493,7 @@ func getServices(serviceType v1.ServiceType, sourceRanges []string, extTrafficPo
|
||||||
v1.ServiceSpec{
|
v1.ServiceSpec{
|
||||||
ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyType(extTrafficPolicy),
|
ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyType(extTrafficPolicy),
|
||||||
LoadBalancerSourceRanges: sourceRanges,
|
LoadBalancerSourceRanges: sourceRanges,
|
||||||
Ports: []v1.ServicePort{{Name: clusterName + "-pooler-repl", Port: 5432, TargetPort: intstr.IntOrString{Type: 1, StrVal: "5432"}}},
|
Ports: []v1.ServicePort{{Name: clusterName + "-pooler-repl", Port: 5432, TargetPort: intstr.IntOrString{IntVal: 5432}}},
|
||||||
Selector: map[string]string{"connection-pooler": clusterName + "-pooler-repl"},
|
Selector: map[string]string{"connection-pooler": clusterName + "-pooler-repl"},
|
||||||
Type: serviceType,
|
Type: serviceType,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue