mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 18:13:42 +08:00 
			
		
		
		
	Tested with `kind` and GKE. Note: "nodes" shown in `docker buildx ls` are unrelated to Kubernetes "nodes". Probably buildx should come up with an alternative term. Usage: $ kind create cluster $ export KUBECONFIG="$(kind get kubeconfig-path --name="kind")" $ docker buildx create --driver kubernetes --driver-opt replicas=3 --use $ docker buildx build -t foo --load . `--load` loads the image into the local Docker. Driver opts: - `image=IMAGE` - Sets the container image to be used for running buildkit. - `namespace=NS` - Sets the Kubernetes namespace. Defaults to the current namespace. - `replicas=N` - Sets the number of `Pod` replicas. Defaults to 1. - `rootless=(true|false)` - Run the container as a non-root user without `securityContext.privileged`. Defaults to false. - `loadbalance=(sticky|random)` - Load-balancing strategy. If set to "sticky", the pod is chosen using the hash of the context path. Defaults to "sticky" Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
		
			
				
	
	
		
			58 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2018 The Go Authors. All rights reserved.
 | 
						|
// Use of this source code is governed by a BSD-style
 | 
						|
// license that can be found in the LICENSE file.
 | 
						|
 | 
						|
// +build go1.9
 | 
						|
 | 
						|
package google
 | 
						|
 | 
						|
import (
 | 
						|
	"golang.org/x/net/context"
 | 
						|
	"golang.org/x/oauth2"
 | 
						|
)
 | 
						|
 | 
						|
// Credentials holds Google credentials, including "Application Default Credentials".
 | 
						|
// For more details, see:
 | 
						|
// https://developers.google.com/accounts/docs/application-default-credentials
 | 
						|
type Credentials struct {
 | 
						|
	ProjectID   string // may be empty
 | 
						|
	TokenSource oauth2.TokenSource
 | 
						|
 | 
						|
	// JSON contains the raw bytes from a JSON credentials file.
 | 
						|
	// This field may be nil if authentication is provided by the
 | 
						|
	// environment and not with a credentials file, e.g. when code is
 | 
						|
	// running on Google Cloud Platform.
 | 
						|
	JSON []byte
 | 
						|
}
 | 
						|
 | 
						|
// DefaultCredentials is the old name of Credentials.
 | 
						|
//
 | 
						|
// Deprecated: use Credentials instead.
 | 
						|
type DefaultCredentials = Credentials
 | 
						|
 | 
						|
// FindDefaultCredentials searches for "Application Default Credentials".
 | 
						|
//
 | 
						|
// It looks for credentials in the following places,
 | 
						|
// preferring the first location found:
 | 
						|
//
 | 
						|
//   1. A JSON file whose path is specified by the
 | 
						|
//      GOOGLE_APPLICATION_CREDENTIALS environment variable.
 | 
						|
//   2. A JSON file in a location known to the gcloud command-line tool.
 | 
						|
//      On Windows, this is %APPDATA%/gcloud/application_default_credentials.json.
 | 
						|
//      On other systems, $HOME/.config/gcloud/application_default_credentials.json.
 | 
						|
//   3. On Google App Engine it uses the appengine.AccessToken function.
 | 
						|
//   4. On Google Compute Engine and Google App Engine Managed VMs, it fetches
 | 
						|
//      credentials from the metadata server.
 | 
						|
//      (In this final case any provided scopes are ignored.)
 | 
						|
func FindDefaultCredentials(ctx context.Context, scopes ...string) (*Credentials, error) {
 | 
						|
	return findDefaultCredentials(ctx, scopes)
 | 
						|
}
 | 
						|
 | 
						|
// CredentialsFromJSON obtains Google credentials from a JSON value. The JSON can
 | 
						|
// represent either a Google Developers Console client_credentials.json file (as in
 | 
						|
// ConfigFromJSON) or a Google Developers service account key file (as in
 | 
						|
// JWTConfigFromJSON).
 | 
						|
func CredentialsFromJSON(ctx context.Context, jsonData []byte, scopes ...string) (*Credentials, error) {
 | 
						|
	return credentialsFromJSON(ctx, jsonData, scopes)
 | 
						|
}
 |