From 10cecd366f213c9400e1f0f8a52923f2d9da32d4 Mon Sep 17 00:00:00 2001 From: Nick Sardo Date: Fri, 21 Apr 2017 12:14:41 -0700 Subject: [PATCH] Remove unnecessary variable --- controllers/gce/loadbalancers/loadbalancers.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/controllers/gce/loadbalancers/loadbalancers.go b/controllers/gce/loadbalancers/loadbalancers.go index 6ab8902f2..e2d788a2f 100644 --- a/controllers/gce/loadbalancers/loadbalancers.go +++ b/controllers/gce/loadbalancers/loadbalancers.go @@ -392,15 +392,13 @@ func (l *L7) checkSSLCert() (err error) { } // Retrieve known ssl certificate - var usedCert *compute.SslCertificate if expectedCertName != "" { - usedCert, _ = l.cloud.GetSslCertificate(expectedCertName) + l.sslCert, _ = l.cloud.GetSslCertificate(expectedCertName) } // TODO: Currently, GCE only supports a single certificate per static IP // so we don't need to bother with disambiguation. Naming the cert after // the loadbalancer is a simplification. - ingCert := l.runtimeInfo.TLS.Cert ingKey := l.runtimeInfo.TLS.Key @@ -414,10 +412,10 @@ func (l *L7) checkSSLCert() (err error) { // PrivateKey is write only, so compare certs alone. We're assuming that // no one will change just the key. We can remember the key and compare, // but a bug could end up leaking it, which feels worse. - if usedCert == nil || ingCert != usedCert.Certificate { + if l.sslCert == nil || ingCert != l.sslCert.Certificate { newCertName := primaryCertName - if usedCert != nil && (ingCert != usedCert.Certificate) { - if usedCert.Name == primaryCertName { + if l.sslCert != nil && (ingCert != l.sslCert.Certificate) { + if l.sslCert.Name == primaryCertName { newCertName = secondaryCertName } } @@ -439,7 +437,7 @@ func (l *L7) checkSSLCert() (err error) { return err } // Save the current cert for cleanup after we update the target proxy. - l.oldSSLCert = usedCert + l.oldSSLCert = l.sslCert l.sslCert = cert }