Skip to content

Commit

Permalink
Partial revert of #1304
Browse files Browse the repository at this point in the history
Remove the certificate fix just for GCP as it was causing reflection
errors (See #1312 for more info).

Signed-off-by: Ben <[email protected]>
  • Loading branch information
Neon-White committed Mar 5, 2024
1 parent 75a9c13 commit 30db621
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions pkg/system/phase4_configuring.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"net/http"
"net/url"
"os"
"reflect"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -1031,30 +1030,7 @@ func (r *Reconciler) prepareGCPBackingStore() error {
}
r.GCPBucketCreds.StringData["GoogleServiceAccountPrivateKeyJson"] = cloudCredsSecret.StringData["service_account.json"]
ctx := context.Background()
// Inject the global refreshing CA pool into the one used by the Google client
parsedGoogleCredsOption := option.WithCredentialsJSON([]byte(cloudCredsSecret.StringData["service_account.json"]))
tempgcpclient, err := storage.NewClient(ctx, parsedGoogleCredsOption)
if err != nil {
r.Logger.Info(err)
return err
}
// Read gcpclient's internal HTTPClient via reflection since it is private
tempclientInternalHTTPClient := reflect.ValueOf(tempgcpclient).Elem().FieldByName("hc")
castTempclientInternalHTTPClient, ok := tempclientInternalHTTPClient.Interface().(*http.Client)
if !ok {
r.Logger.Errorf("failed to cast castTempclientInternalHTTPClient to *http.Client")
return fmt.Errorf("failed to cast castTempclientInternalHTTPClient to *http.Client")
}
tempClient := &http.Client{
Transport: castTempclientInternalHTTPClient.Transport,
}
tempTransport, ok := tempClient.Transport.(*http.Transport)
if !ok {
r.Logger.Errorf("failed to cast tempTransport to *http.Transport")
return fmt.Errorf("failed to cast tempTransport to *http.Transport")
}
tempTransport.TLSClientConfig.RootCAs = util.GlobalCARefreshingTransport.TLSClientConfig.RootCAs
gcpclient, err := storage.NewClient(ctx, option.WithHTTPClient(tempClient), parsedGoogleCredsOption)
gcpclient, err := storage.NewClient(ctx, option.WithCredentialsJSON([]byte(cloudCredsSecret.StringData["service_account.json"])))
if err != nil {
r.Logger.Info(err)
return err
Expand Down

0 comments on commit 30db621

Please sign in to comment.