Skip to content

Commit

Permalink
Proxy rejects requests for first generation instances. (#269)
Browse files Browse the repository at this point in the history
First generation instances are not supported by the proxy, so this causes them to fail slightly faster.
  • Loading branch information
hfwang authored Apr 5, 2019
1 parent c904b69 commit c70a36b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/cloud_sql_proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ func parseInstanceConfig(dir, instance string, cl *http.Client) (instanceConfig,
if err != nil {
return instanceConfig{}, err
}
if in.BackendType == "FIRST_GEN" {
logging.Errorf("WARNING: proxy client does not support first generation Cloud SQL instances.")
return instanceConfig{}, fmt.Errorf("%q is a first generation instance", instance)
}
if strings.HasPrefix(strings.ToLower(in.DatabaseVersion), "postgres") {
path := filepath.Join(dir, instance)
if err := os.MkdirAll(path, 0755); err != nil {
Expand Down
4 changes: 4 additions & 0 deletions proxy/certs/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ func (s *RemoteCertSource) Remote(instance string) (cert *x509.Certificate, addr
if len(data.IpAddresses) == 0 {
return nil, "", "", fmt.Errorf("no IP address found for %v", instance)
}
if data.BackendType == "FIRST_GEN" {
logging.Errorf("WARNING: proxy client does not support first generation Cloud SQL instances.")
return nil, "", "", fmt.Errorf("%q is a first generation instance", instance)
}

// Find the first matching IP address by user input IP address types
ipAddrInUse := ""
Expand Down

0 comments on commit c70a36b

Please sign in to comment.