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

Function runProxyRequest

tests/utils/proxy/proxy.go:34–53  ·  view source on GitHub ↗

runProxyRequest makes a GET call on the pod interface proxy, and returns the raw response

(
	ctx context.Context,
	kubeInterface kubernetes.Interface,
	pod *corev1.Pod,
	tlsEnabled bool,
	path string,
	port int,
)

Source from the content-addressed store, hash-verified

32
33// runProxyRequest makes a GET call on the pod interface proxy, and returns the raw response
34func runProxyRequest(
35 ctx context.Context,
36 kubeInterface kubernetes.Interface,
37 pod *corev1.Pod,
38 tlsEnabled bool,
39 path string,
40 port int,
41) ([]byte, error) {
42 portString := strconv.Itoa(port)
43
44 schema := "http"
45 if tlsEnabled {
46 schema = "https"
47 }
48
49 req := kubeInterface.CoreV1().Pods(pod.Namespace).ProxyGet(
50 schema, pod.Name, portString, path, map[string]string{})
51
52 return req.DoRaw(ctx)
53}
54
55// RetrieveMetricsFromInstance aims to retrieve the metrics from a PostgreSQL instance pod
56// using a GET request on the pod interface proxy

Calls

no outgoing calls

Tested by

no test coverage detected