Skip to content

Commit c104cdd

Browse files
baptman21jmckulk
authored andcommitted
Add internal and external traffic policy to crd.
To allow more modifications to the service created for the pgboucer, add the externalTrafficPolicy and internalTrafficPolicy to the CRD of the service. Issue: #3797
1 parent cb3fa0d commit c104cdd

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13060,6 +13060,13 @@ spec:
1306013060
service:
1306113061
description: Specification of the service that exposes PgBouncer.
1306213062
properties:
13063+
externalTrafficPolicy:
13064+
description: Service External Traffic Policy Type string
13065+
type: string
13066+
internalTrafficPolicy:
13067+
description: ServiceInternalTrafficPolicyType describes
13068+
the type of traffic routing for internal traffic
13069+
type: string
1306313070
metadata:
1306413071
description: Metadata contains metadata for custom resources
1306513072
properties:
@@ -13355,6 +13362,13 @@ spec:
1335513362
description: Specification of the service that exposes the PostgreSQL
1335613363
primary instance.
1335713364
properties:
13365+
externalTrafficPolicy:
13366+
description: Service External Traffic Policy Type string
13367+
type: string
13368+
internalTrafficPolicy:
13369+
description: ServiceInternalTrafficPolicyType describes the type
13370+
of traffic routing for internal traffic
13371+
type: string
1335813372
metadata:
1335913373
description: Metadata contains metadata for custom resources
1336013374
properties:
@@ -14825,6 +14839,13 @@ spec:
1482514839
service:
1482614840
description: Specification of the service that exposes pgAdmin.
1482714841
properties:
14842+
externalTrafficPolicy:
14843+
description: Service External Traffic Policy Type string
14844+
type: string
14845+
internalTrafficPolicy:
14846+
description: ServiceInternalTrafficPolicyType describes
14847+
the type of traffic routing for internal traffic
14848+
type: string
1482814849
metadata:
1482914850
description: Metadata contains metadata for custom resources
1483014851
properties:

internal/controller/postgrescluster/pgbouncer.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,12 @@ func (r *Reconciler) generatePGBouncerService(
315315
}
316316
servicePort.NodePort = *spec.NodePort
317317
}
318+
if spec.ExternalTrafficPolicy != nil {
319+
service.Spec.ExternalTrafficPolicy = *spec.ExternalTrafficPolicy
320+
}
321+
if spec.InternalTrafficPolicy != nil {
322+
service.Spec.InternalTrafficPolicy = spec.InternalTrafficPolicy
323+
}
318324
}
319325
service.Spec.Ports = []corev1.ServicePort{servicePort}
320326

pkg/apis/postgres-operator.crunchydata.com/v1beta1/shared_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ type ServiceSpec struct {
5555
// +kubebuilder:default=ClusterIP
5656
// +kubebuilder:validation:Enum={ClusterIP,NodePort,LoadBalancer}
5757
Type string `json:"type"`
58+
59+
// +optional
60+
InternalTrafficPolicy *corev1.ServiceInternalTrafficPolicyType `json:"internalTrafficPolicy"`
61+
62+
// +optional
63+
ExternalTrafficPolicy *corev1.ServiceExternalTrafficPolicyType `json:"externalTrafficPolicy"`
5864
}
5965

6066
// Sidecar defines the configuration of a sidecar container

pkg/apis/postgres-operator.crunchydata.com/v1beta1/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)