dynamic certs: do not copy mutex via shallow copy of tls.Config
go vet error: call of dynamiccertificates.NewDynamicServingCertificateController copies lock value: crypto/tls.Config contains sync.Once contains sync.Mutex Signed-off-by: Monis Khan <mok@vmware.com> Kubernetes-commit: 86a5993007e3c781749a5099b540307f65a4f377
This commit is contained in:
		
							parent
							
								
									68653ed579
								
							
						
					
					
						commit
						091c53ac7a
					
				|  | @ -79,7 +79,7 @@ func TestServingCert(t *testing.T) { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	dynamicCertificateController := NewDynamicServingCertificateController( | 	dynamicCertificateController := NewDynamicServingCertificateController( | ||||||
| 		*tlsConfig, | 		tlsConfig, | ||||||
| 		&nullCAContent{name: "client-ca"}, | 		&nullCAContent{name: "client-ca"}, | ||||||
| 		defaultCertProvider, | 		defaultCertProvider, | ||||||
| 		sniCerts, | 		sniCerts, | ||||||
|  |  | ||||||
|  | @ -41,7 +41,7 @@ const workItemKey = "key" | ||||||
| type DynamicServingCertificateController struct { | type DynamicServingCertificateController struct { | ||||||
| 	// baseTLSConfig is the static portion of the tlsConfig for serving to clients.  It is copied and the copy is mutated
 | 	// baseTLSConfig is the static portion of the tlsConfig for serving to clients.  It is copied and the copy is mutated
 | ||||||
| 	// based on the dynamic cert state.
 | 	// based on the dynamic cert state.
 | ||||||
| 	baseTLSConfig tls.Config | 	baseTLSConfig *tls.Config | ||||||
| 
 | 
 | ||||||
| 	// clientCA provides the very latest content of the ca bundle
 | 	// clientCA provides the very latest content of the ca bundle
 | ||||||
| 	clientCA CAContentProvider | 	clientCA CAContentProvider | ||||||
|  | @ -65,7 +65,7 @@ var _ Listener = &DynamicServingCertificateController{} | ||||||
| 
 | 
 | ||||||
| // NewDynamicServingCertificateController returns a controller that can be used to keep a TLSConfig up to date.
 | // NewDynamicServingCertificateController returns a controller that can be used to keep a TLSConfig up to date.
 | ||||||
| func NewDynamicServingCertificateController( | func NewDynamicServingCertificateController( | ||||||
| 	baseTLSConfig tls.Config, | 	baseTLSConfig *tls.Config, | ||||||
| 	clientCA CAContentProvider, | 	clientCA CAContentProvider, | ||||||
| 	servingCert CertKeyContentProvider, | 	servingCert CertKeyContentProvider, | ||||||
| 	sniCerts []SNICertKeyContentProvider, | 	sniCerts []SNICertKeyContentProvider, | ||||||
|  |  | ||||||
|  | @ -66,7 +66,7 @@ func (s *SecureServingInfo) tlsConfig(stopCh <-chan struct{}) (*tls.Config, erro | ||||||
| 
 | 
 | ||||||
| 	if s.ClientCA != nil || s.Cert != nil || len(s.SNICerts) > 0 { | 	if s.ClientCA != nil || s.Cert != nil || len(s.SNICerts) > 0 { | ||||||
| 		dynamicCertificateController := dynamiccertificates.NewDynamicServingCertificateController( | 		dynamicCertificateController := dynamiccertificates.NewDynamicServingCertificateController( | ||||||
| 			*tlsConfig, | 			tlsConfig, | ||||||
| 			s.ClientCA, | 			s.ClientCA, | ||||||
| 			s.Cert, | 			s.Cert, | ||||||
| 			s.SNICerts, | 			s.SNICerts, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue