Skip to content

Commit c70a36b

Browse files
authored
Proxy rejects requests for first generation instances. (GoogleCloudPlatform#269)
First generation instances are not supported by the proxy, so this causes them to fail slightly faster.
1 parent c904b69 commit c70a36b

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

cmd/cloud_sql_proxy/proxy.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ func parseInstanceConfig(dir, instance string, cl *http.Client) (instanceConfig,
264264
if err != nil {
265265
return instanceConfig{}, err
266266
}
267+
if in.BackendType == "FIRST_GEN" {
268+
logging.Errorf("WARNING: proxy client does not support first generation Cloud SQL instances.")
269+
return instanceConfig{}, fmt.Errorf("%q is a first generation instance", instance)
270+
}
267271
if strings.HasPrefix(strings.ToLower(in.DatabaseVersion), "postgres") {
268272
path := filepath.Join(dir, instance)
269273
if err := os.MkdirAll(path, 0755); err != nil {

proxy/certs/certs.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ func (s *RemoteCertSource) Remote(instance string) (cert *x509.Certificate, addr
259259
if len(data.IpAddresses) == 0 {
260260
return nil, "", "", fmt.Errorf("no IP address found for %v", instance)
261261
}
262+
if data.BackendType == "FIRST_GEN" {
263+
logging.Errorf("WARNING: proxy client does not support first generation Cloud SQL instances.")
264+
return nil, "", "", fmt.Errorf("%q is a first generation instance", instance)
265+
}
262266

263267
// Find the first matching IP address by user input IP address types
264268
ipAddrInUse := ""

0 commit comments

Comments
 (0)