func NewClientFromSecret(ctx context.Context, kubecli kubernetes.Interface, namespace, gcsSecret string) (w *GCSClient, err error) {
	defer func() {
		if err != nil {
			err = fmt.Errorf("new GCS client failed: %v", err)
		}
	}()
	var authOptions []option.ClientOption
	if se, err := kubecli.CoreV1().Secrets(namespace).Get(gcsSecret, metav1.GetOptions{}); err == nil {
		if accessToken, ok := se.Data[api.GCPAccessToken]; ok {
			authOptions = append(authOptions, option.WithTokenSource(oauth2.StaticTokenSource(&oauth2.Token{AccessToken: string(accessToken)})))
		} else if credentialsJson, ok := se.Data[api.GCPCredentialsJson]; ok {
			authOptions = append(authOptions, option.WithCredentialsJSON(credentialsJson))
		}
	}
	gcs, err := storage.NewClient(ctx, authOptions...)
	if err != nil {
		return nil, fmt.Errorf("failed to create client: %v", err)
	}
	return &GCSClient{GCS: gcs}, nil
}
NewClientFromSecret returns a GCS client based on given k8s secret containing azure credentials.
package gcsfactory
import (
	"context"
	"fmt"
	"cloud.google.com/go/storage"
	api "github.com/coreos/etcd-operator/pkg/apis/etcd/v1beta2"
	"golang.org/x/oauth2"
	"google.golang.org/api/option"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes"
)
type GCSClient struct {
	GCS *storage.Client
}