Skip to content

Commit

Permalink
Merge pull request #135 from j4ckstraw/use-protobuf
Browse files Browse the repository at this point in the history
use protobuf and add resourceVersion in listOption
  • Loading branch information
skamboj authored Apr 8, 2024
2 parents 0b96e45 + 507a63d commit e22842f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name ?= goldpinger
version ?= v3.7.0
version ?= v3.10.0
bin ?= goldpinger
pkg ?= "github.com/bloomberg/goldpinger"
tag = $(name):$(version)
Expand Down
6 changes: 6 additions & 0 deletions cmd/goldpinger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import (
"io/ioutil"
"log"
"os"
"strings"
"time"

"github.com/go-openapi/loads"
"go.uber.org/zap"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
Expand Down Expand Up @@ -131,6 +133,10 @@ func main() {
if err != nil {
logger.Fatal("Error getting config ", zap.Error(err))
}
// communicate to kube-apiserver with protobuf
config.AcceptContentTypes = strings.Join([]string{runtime.ContentTypeProtobuf, runtime.ContentTypeJSON}, ",")
config.ContentType = runtime.ContentTypeProtobuf

// create the clientset
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions pkg/goldpinger/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ func getPodNodeName(p v1.Pod) string {
func GetAllPods() map[string]*GoldpingerPod {
timer := GetLabeledKubernetesCallsTimer()
listOpts := metav1.ListOptions{
ResourceVersion: "0",

LabelSelector: GoldpingerConfig.LabelSelector,
FieldSelector: "status.phase=Running", // only select Running pods, otherwise we will get them before they have IPs
}
Expand Down

0 comments on commit e22842f

Please sign in to comment.