Skip to content

Commit 565f795

Browse files
committed
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 dd3e6be commit 565f795

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:
@@ -13323,6 +13330,13 @@ spec:
1332313330
description: Specification of the service that exposes the PostgreSQL
1332413331
primary instance.
1332513332
properties:
13333+
externalTrafficPolicy:
13334+
description: Service External Traffic Policy Type string
13335+
type: string
13336+
internalTrafficPolicy:
13337+
description: ServiceInternalTrafficPolicyType describes the type
13338+
of traffic routing for internal traffic
13339+
type: string
1332613340
metadata:
1332713341
description: Metadata contains metadata for custom resources
1332813342
properties:
@@ -14793,6 +14807,13 @@ spec:
1479314807
service:
1479414808
description: Specification of the service that exposes pgAdmin.
1479514809
properties:
14810+
externalTrafficPolicy:
14811+
description: Service External Traffic Policy Type string
14812+
type: string
14813+
internalTrafficPolicy:
14814+
description: ServiceInternalTrafficPolicyType describes
14815+
the type of traffic routing for internal traffic
14816+
type: string
1479614817
metadata:
1479714818
description: Metadata contains metadata for custom resources
1479814819
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)