@@ -25,6 +25,7 @@ import (
2525 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2626 "k8s.io/apimachinery/pkg/util/intstr"
2727
28+ "github.com/crunchydata/postgres-operator/internal/initialize"
2829 "github.com/crunchydata/postgres-operator/internal/naming"
2930 "github.com/crunchydata/postgres-operator/internal/patroni"
3031 "github.com/crunchydata/postgres-operator/internal/pki"
@@ -142,13 +143,12 @@ func (r *Reconciler) generateClusterPrimaryService(
142143 service .Spec .ClusterIP = corev1 .ClusterIPNone
143144 service .Spec .Selector = nil
144145
145- appProtocol := naming .AppProtocolTCP
146146 service .Spec .Ports = []corev1.ServicePort {{
147147 Name : naming .PortPostgreSQL ,
148148 Port : * cluster .Spec .Port ,
149149 Protocol : corev1 .ProtocolTCP ,
150150 TargetPort : intstr .FromString (naming .PortPostgreSQL ),
151- AppProtocol : & appProtocol ,
151+ AppProtocol : initialize . String ( naming . AppProtocolPOSTGRES ) ,
152152 }}
153153
154154 // Resolve to the ClusterIP for which Patroni has configured the Endpoints.
@@ -163,6 +163,7 @@ func (r *Reconciler) generateClusterPrimaryService(
163163 Name : sp .Name ,
164164 Port : sp .Port ,
165165 Protocol : sp .Protocol ,
166+ AppProtocol : sp .AppProtocol ,
166167 })
167168 }
168169
@@ -222,13 +223,12 @@ func (r *Reconciler) generateClusterReplicaService(
222223 // The TargetPort must be the name (not the number) of the PostgreSQL
223224 // ContainerPort. This name allows the port number to differ between Pods,
224225 // which can happen during a rolling update.
225- appProtocol := naming .AppProtocolTCP
226226 service .Spec .Ports = []corev1.ServicePort {{
227227 Name : naming .PortPostgreSQL ,
228228 Port : * cluster .Spec .Port ,
229229 Protocol : corev1 .ProtocolTCP ,
230230 TargetPort : intstr .FromString (naming .PortPostgreSQL ),
231- AppProtocol : & appProtocol ,
231+ AppProtocol : initialize . String ( naming . AppProtocolPOSTGRES ) ,
232232 }}
233233
234234 err := errors .WithStack (r .setControllerReference (cluster , service ))
0 commit comments