MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / WithServicePort

Method WithServicePort

pkg/servicespec/builder.go:82–92  ·  view source on GitHub ↗

WithServicePort adds a port to the current service

(value *corev1.ServicePort)

Source from the content-addressed store, hash-verified

80
81// WithServicePort adds a port to the current service
82func (builder *Builder) WithServicePort(value *corev1.ServicePort) *Builder {
83 for idx, port := range builder.status.Spec.Ports {
84 if port.Name == value.Name {
85 builder.status.Spec.Ports[idx] = *value
86 return builder
87 }
88 }
89
90 builder.status.Spec.Ports = append(builder.status.Spec.Ports, *value)
91 return builder
92}
93
94// WithServicePortNoOverwrite adds a ServicePort to the current service if no ServicePort that matches the name
95// or port value is found

Callers 2

builder_test.goFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected