use ContentTypeProtobuf

Signed-off-by: yangchao <yccharles@163.com>
This commit is contained in:
yangchao 2023-02-28 21:24:39 +08:00
parent 9a1ffb7b17
commit 6f27e9820a

View file

@ -20,6 +20,7 @@ import (
"crypto/tls" "crypto/tls"
"crypto/x509" "crypto/x509"
"fmt" "fmt"
"k8s.io/apimachinery/pkg/runtime"
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
@ -251,6 +252,9 @@ func (cmd *PrometheusAdapter) addResourceMetricsAPI(promClient prom.Client, stop
return err return err
} }
rest.AcceptContentTypes = strings.Join([]string{runtime.ContentTypeProtobuf, runtime.ContentTypeJSON}, ",")
rest.ContentType = runtime.ContentTypeProtobuf
client, err := metadata.NewForConfig(rest) client, err := metadata.NewForConfig(rest)
if err != nil { if err != nil {
return err return err