@@ -65,7 +65,7 @@ type restConfig struct {
6565 BearerToken string
6666
6767 // TLSClientConfig contains settings to enable transport layer security
68- restTLSClientConfig
68+ TLSClientConfig restTLSClientConfig
6969
7070 // Server should be accessed without verifying the TLS
7171 // certificate. For testing only.
@@ -238,8 +238,8 @@ func getServerIdentificationPartialConfig(configAuthInfo clientcmdAuthInfo, conf
238238
239239 // configClusterInfo holds the information identify the server provided by .kubeconfig
240240 configClientConfig := & restConfig {}
241- configClientConfig .CAFile = configClusterInfo .CertificateAuthority
242- configClientConfig .CAData = configClusterInfo .CertificateAuthorityData
241+ configClientConfig .TLSClientConfig . CAFile = configClusterInfo .CertificateAuthority
242+ configClientConfig .TLSClientConfig . CAData = configClusterInfo .CertificateAuthorityData
243243 configClientConfig .Insecure = configClusterInfo .InsecureSkipTLSVerify
244244 if err := mergo .MergeWithOverwrite (mergedConfig , configClientConfig ); err != nil {
245245 return nil , err
@@ -264,10 +264,10 @@ func getUserIdentificationPartialConfig(configAuthInfo clientcmdAuthInfo) (*rest
264264 mergedConfig .BearerToken = configAuthInfo .Token
265265 }
266266 if len (configAuthInfo .ClientCertificate ) > 0 || len (configAuthInfo .ClientCertificateData ) > 0 {
267- mergedConfig .CertFile = configAuthInfo .ClientCertificate
268- mergedConfig .CertData = configAuthInfo .ClientCertificateData
269- mergedConfig .KeyFile = configAuthInfo .ClientKey
270- mergedConfig .KeyData = configAuthInfo .ClientKeyData
267+ mergedConfig .TLSClientConfig . CertFile = configAuthInfo .ClientCertificate
268+ mergedConfig .TLSClientConfig . CertData = configAuthInfo .ClientCertificateData
269+ mergedConfig .TLSClientConfig . KeyFile = configAuthInfo .ClientKey
270+ mergedConfig .TLSClientConfig . KeyData = configAuthInfo .ClientKeyData
271271 }
272272 if len (configAuthInfo .Username ) > 0 || len (configAuthInfo .Password ) > 0 {
273273 mergedConfig .Username = configAuthInfo .Username
@@ -806,8 +806,8 @@ func defaultServerURL(host string, defaultTLS bool) (*url.URL, error) {
806806func defaultServerURLFor (config * restConfig ) (* url.URL , error ) {
807807 // TODO: move the default to secure when the apiserver supports TLS by default
808808 // config.Insecure is taken to mean "I want HTTPS but don't bother checking the certs against a CA."
809- hasCA := len (config .CAFile ) != 0 || len (config .CAData ) != 0
810- hasCert := len (config .CertFile ) != 0 || len (config .CertData ) != 0
809+ hasCA := len (config .TLSClientConfig . CAFile ) != 0 || len (config . TLSClientConfig .CAData ) != 0
810+ hasCert := len (config .TLSClientConfig . CertFile ) != 0 || len (config . TLSClientConfig .CertData ) != 0
811811 defaultTLS := hasCA || hasCert || config .Insecure
812812 host := config .Host
813813 if host == "" {
@@ -968,11 +968,11 @@ func tlsConfigFor(c *restConfig) (*tls.Config, error) {
968968 }
969969
970970 if c .HasCA () {
971- tlsConfig .RootCAs = rootCertPool (c .CAData )
971+ tlsConfig .RootCAs = rootCertPool (c .TLSClientConfig . CAData )
972972 }
973973
974974 if c .HasCertAuth () {
975- cert , err := tls .X509KeyPair (c .CertData , c .KeyData )
975+ cert , err := tls .X509KeyPair (c .TLSClientConfig . CertData , c . TLSClientConfig .KeyData )
976976 if err != nil {
977977 return nil , err
978978 }
@@ -988,17 +988,17 @@ func tlsConfigFor(c *restConfig) (*tls.Config, error) {
988988// either populated or were empty to start.
989989func loadTLSFiles (c * restConfig ) error {
990990 var err error
991- c .CAData , err = dataFromSliceOrFile (c .CAData , c .CAFile )
991+ c .TLSClientConfig . CAData , err = dataFromSliceOrFile (c .TLSClientConfig . CAData , c . TLSClientConfig .CAFile )
992992 if err != nil {
993993 return err
994994 }
995995
996- c .CertData , err = dataFromSliceOrFile (c .CertData , c .CertFile )
996+ c .TLSClientConfig . CertData , err = dataFromSliceOrFile (c .TLSClientConfig . CertData , c . TLSClientConfig .CertFile )
997997 if err != nil {
998998 return err
999999 }
10001000
1001- c .KeyData , err = dataFromSliceOrFile (c .KeyData , c .KeyFile )
1001+ c .TLSClientConfig . KeyData , err = dataFromSliceOrFile (c .TLSClientConfig . KeyData , c . TLSClientConfig .KeyFile )
10021002 if err != nil {
10031003 return err
10041004 }
@@ -1042,13 +1042,13 @@ func rootCertPool(caData []byte) *x509.CertPool {
10421042// HasCA is a modified copy of k8s.io/kubernetes/pkg/client/transport.Config.HasCA.
10431043// HasCA returns whether the configuration has a certificate authority or not.
10441044func (c * restConfig ) HasCA () bool {
1045- return len (c .CAData ) > 0 || len (c .CAFile ) > 0
1045+ return len (c .TLSClientConfig . CAData ) > 0 || len (c . TLSClientConfig .CAFile ) > 0
10461046}
10471047
10481048// HasCertAuth is a modified copy of k8s.io/kubernetes/pkg/client/transport.Config.HasCertAuth.
10491049// HasCertAuth returns whether the configuration has certificate authentication or not.
10501050func (c * restConfig ) HasCertAuth () bool {
1051- return len (c .CertData ) != 0 || len (c .CertFile ) != 0
1051+ return len (c .TLSClientConfig . CertData ) != 0 || len (c . TLSClientConfig .CertFile ) != 0
10521052}
10531053
10541054// clientcmdConfig is a modified copy of k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api.Config.
0 commit comments