mirror of
https://github.com/bloomberg/goldpinger.git
synced 2026-08-23 21:36:25 +00:00
Merge branch 'master' into 15-remove-sudo-from-makefile
This commit is contained in:
@@ -26,5 +26,6 @@ var GoldpingerConfig = struct {
|
||||
Hostname string `long:"hostname" description:"Hostname to use" env:"HOSTNAME"`
|
||||
Port int `long:"client-port-override" description:"(for testing) use this port when calling other instances" env:"CLIENT_PORT_OVERRIDE"`
|
||||
UseHostIP bool `long:"use-host-ip" description:"When making the calls, use host ip (defaults to pod ip)" env:"USE_HOST_IP"`
|
||||
LabelSelector string `long:"label-selector" description:"label selector to use to discover goldpinger pods in the cluster" env:"LABEL_SELECTOR" default:"app=goldpinger"`
|
||||
KubernetesClient *kubernetes.Clientset
|
||||
}{}
|
||||
|
||||
@@ -30,10 +30,10 @@ func getNamespace() string {
|
||||
return namespace
|
||||
}
|
||||
|
||||
// GetAllPods returns a map of Pod IP to Host IP based on a label selector defined in config
|
||||
func GetAllPods() map[string]string {
|
||||
timer := GetLabeledKubernetesCallsTimer()
|
||||
namespace := getNamespace()
|
||||
pods, err := GoldpingerConfig.KubernetesClient.CoreV1().Pods(namespace).List(metav1.ListOptions{LabelSelector: "app=goldpinger"})
|
||||
pods, err := GoldpingerConfig.KubernetesClient.CoreV1().Pods(getNamespace()).List(metav1.ListOptions{LabelSelector: GoldpingerConfig.LabelSelector})
|
||||
if err != nil {
|
||||
log.Println("Error getting pods for selector: ", err.Error())
|
||||
CountError("kubernetes_api")
|
||||
|
||||
Reference in New Issue
Block a user