cloudnative-pg
cloudnative-pg copied to clipboard
[Bug]: Cannot create Pooler with nodePort specified in "serviceTemplate"
Is there an existing issue already for this bug?
- [X] I have searched for an existing issue, and could not find anything. I believe this is a new bug.
I have read the troubleshooting guide
- [X] I have read the troubleshooting guide and I think this is a new bug.
I am running a supported version of CloudNativePG
- [X] I have read the troubleshooting guide and I think this is a new bug.
Contact Details
Version
1.23.0
What version of Kubernetes are you using?
1.30 (unsuppprted)
What is your Kubernetes environment?
Self-managed: kind (evaluation)
How did you install the operator?
Helm
What happened?
Hello. I'm trying to create a Pooler with a nodePort, specified in serviceTemplate.
I tried to set only a name of a port, trying not to set a port at all. But I cannot achieve the result.
Thank you.
Cluster resource
apiVersion: postgresql.cnpg.io/v1
kind: Pooler
metadata:
name: pooler-example-rw
namespace: cnpg-tmp
spec:
cluster:
name: cluster-example
# TODO: how to set exact port?
serviceTemplate:
spec:
type: NodePort
ports:
- name: pgbouncer-np
nodePort: 30852
port: 5432
protocol: TCP
targetPort: pgbouncer
instances: 3
type: rw
pgbouncer:
poolMode: session
parameters:
max_client_conn: "1000"
default_pool_size: "10"
Relevant log output
{
"level": "error",
"ts": "2024-05-12T08:03:32Z",
"msg": "Reconciler error",
"controller": "pooler",
"controllerGroup": "postgresql.cnpg.io",
"controllerKind": "Pooler",
"Pooler": { "name": "pooler-example-rw", "namespace": "cnpg-tmp" },
"namespace": "cnpg-tmp",
"name": "pooler-example-rw",
"reconcileID": "0c3b93f1-b6cb-4c1e-ba79-2066fbfb8845",
"error": 'Service "pooler-example-rw" is invalid: [spec.ports[1].nodePort: Duplicate value: 30852, spec.ports[1]: Duplicate value: core.ServicePort{Name:"", Protocol:"TCP", AppProtocol:(*string)(nil), Port:5432, TargetPort:intstr.IntOrString{Type:0, IntVal:0, StrVal:""}, NodePort:0}]',
"stacktrace": "sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tpkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:329\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tpkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tpkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:227",
}
Code of Conduct
- [X] I agree to follow this project's Code of Conduct