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

Function FirstEndpointSliceIP

tests/utils/endpoints.go:31–39  ·  view source on GitHub ↗

FirstEndpointSliceIP returns the IP of the first Address in the EndpointSlice

(endpoint *discoveryv1.EndpointSlice)

Source from the content-addressed store, hash-verified

29
30// FirstEndpointSliceIP returns the IP of the first Address in the EndpointSlice
31func FirstEndpointSliceIP(endpoint *discoveryv1.EndpointSlice) string {
32 if endpoint == nil {
33 return ""
34 }
35 if len(endpoint.Endpoints) == 0 || len(endpoint.Endpoints[0].Addresses) == 0 {
36 return ""
37 }
38 return endpoint.Endpoints[0].Addresses[0]
39}
40
41// GetEndpointSliceByServiceName returns the EndpointSlice for a given service name in a given namespace
42func GetEndpointSliceByServiceName(

Callers 1

assertFastSwitchoverFunction · 0.92

Calls

no outgoing calls

Tested by 1

assertFastSwitchoverFunction · 0.74