mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
kubernetes: Add useragent (#6484)
In kubernetes' audit logs you'll see: "userAgent":"coredns/v0.0.0 (linux/amd64) kubernetes/$Format" This change adds a userAgent to the requests made by CoreDNS against the kubernetes API: "userAgent":"CoreDNS/v1.11.1 git_commit:ae2bbc29be1aaae0b3ded5d188968a6c97bb3144 (linux/amd64/go1.22)" Signed-off-by: Manuel Rüger <manuel@rueg.eu>
This commit is contained in:
@@ -6,9 +6,11 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/coredns/coredns/coremain"
|
||||
"github.com/coredns/coredns/plugin"
|
||||
"github.com/coredns/coredns/plugin/etcd/msg"
|
||||
"github.com/coredns/coredns/plugin/kubernetes/object"
|
||||
@@ -192,6 +194,7 @@ func (k *Kubernetes) getClientConfig() (*rest.Config, error) {
|
||||
return nil, err
|
||||
}
|
||||
cc.ContentType = "application/vnd.kubernetes.protobuf"
|
||||
cc.UserAgent = fmt.Sprintf("%s/%s git_commit:%s (%s/%s/%s)", coremain.CoreName, coremain.CoreVersion, coremain.GitCommit, runtime.GOOS, runtime.GOARCH, runtime.Version())
|
||||
return cc, err
|
||||
}
|
||||
|
||||
@@ -218,6 +221,7 @@ func (k *Kubernetes) getClientConfig() (*rest.Config, error) {
|
||||
return nil, err
|
||||
}
|
||||
cc.ContentType = "application/vnd.kubernetes.protobuf"
|
||||
cc.UserAgent = fmt.Sprintf("%s/%s git_commit:%s (%s/%s/%s)", coremain.CoreName, coremain.CoreVersion, coremain.GitCommit, runtime.GOOS, runtime.GOARCH, runtime.Version())
|
||||
return cc, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user