Configure User-Agent
Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
This commit is contained in:
parent
446845114c
commit
09074a8589
1 changed files with 13 additions and 0 deletions
|
@ -24,6 +24,8 @@ import (
|
||||||
"net/http/pprof"
|
"net/http/pprof"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -201,10 +203,21 @@ func handleSigterm(ngx *controller.NGINXController, exit exiter) {
|
||||||
// the in-cluster config is missing or fails, we fallback to the default config.
|
// the in-cluster config is missing or fails, we fallback to the default config.
|
||||||
func createApiserverClient(apiserverHost, rootCAFile, kubeConfig string) (*kubernetes.Clientset, error) {
|
func createApiserverClient(apiserverHost, rootCAFile, kubeConfig string) (*kubernetes.Clientset, error) {
|
||||||
cfg, err := clientcmd.BuildConfigFromFlags(apiserverHost, kubeConfig)
|
cfg, err := clientcmd.BuildConfigFromFlags(apiserverHost, kubeConfig)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Configure the User-Agent used for the HTTP requests made to the API server.
|
||||||
|
cfg.UserAgent = fmt.Sprintf(
|
||||||
|
"%s/%s (%s/%s) ingress-nginx/%s",
|
||||||
|
filepath.Base(os.Args[0]),
|
||||||
|
version.RELEASE,
|
||||||
|
runtime.GOOS,
|
||||||
|
runtime.GOARCH,
|
||||||
|
version.COMMIT,
|
||||||
|
)
|
||||||
|
|
||||||
if apiserverHost != "" && rootCAFile != "" {
|
if apiserverHost != "" && rootCAFile != "" {
|
||||||
tlsClientConfig := rest.TLSClientConfig{}
|
tlsClientConfig := rest.TLSClientConfig{}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue