fix(inputs/kube_inventory): set TLS server name config properly (#9975)

This commit is contained in:
Sam Lai 2021-12-07 15:30:27 +00:00 committed by GitHub
parent c7f882c97d
commit 2fdf223efb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -74,6 +74,8 @@ avoid cardinality issues:
# tls_cert = "/path/to/certfile"
## Used for TLS client certificate authentication
# tls_key = "/path/to/keyfile"
## Send the specified TLS server name via SNI
# tls_server_name = "kubernetes.example.com"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false

View File

@ -23,7 +23,7 @@ type client struct {
func newClient(baseURL, namespace, bearerToken string, timeout time.Duration, tlsConfig tls.ClientConfig) (*client, error) {
c, err := kubernetes.NewForConfig(&rest.Config{
TLSClientConfig: rest.TLSClientConfig{
ServerName: baseURL,
ServerName: tlsConfig.ServerName,
Insecure: tlsConfig.InsecureSkipVerify,
CAFile: tlsConfig.TLSCA,
CertFile: tlsConfig.TLSCert,

View File

@ -81,6 +81,7 @@ var sampleConfig = `
# tls_ca = "/path/to/cafile"
# tls_cert = "/path/to/certfile"
# tls_key = "/path/to/keyfile"
# tls_server_name = "kubernetes.example.com"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
`