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, )
| 32 | |
| 33 | // runProxyRequest makes a GET call on the pod interface proxy, and returns the raw response |
| 34 | func 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 |
no outgoing calls
no test coverage detected