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