gcp

package
v0.0.0-...-9ad3809 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2019 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GCP_CONFIG        = "gcp_config"
	CONFIG_FILE       = "cluster-kubeflow.yaml"
	STORAGE_FILE      = "storage-kubeflow.yaml"
	NETWORK_FILE      = "network.yaml"
	GCFS_FILE         = "gcfs.yaml"
	ADMIN_SECRET_NAME = "admin-gcp-sa"
	USER_SECRET_NAME  = "user-gcp-sa"
	KUBEFLOW_OAUTH    = "kubeflow-oauth"
	IMPORTS           = "imports"
	PATH              = "path"
	CLIENT_ID         = "CLIENT_ID"
	CLIENT_SECRET     = "CLIENT_SECRET"
	BASIC_AUTH_SECRET = "kubeflow-login"
	KUBECONFIG_FORMAT = "gke_{project}_{zone}_{cluster}"

	// Plugin parameter constants
	GcpPluginName               = kftypes.GCP
	GcpAccessTokenName          = "accessToken"
	BasicAuthPasswordSecretName = "password"
)

TODO: golint complains that we should not use all capital var name.

Variables

This section is empty.

Functions

func GetGcloudDefaultAccount

func GetGcloudDefaultAccount() (string, error)

GetGcloudDefaultAccount try to get the default account.

func GetPlatform

func GetPlatform(kfdef *kfdefs.KfDef) (kftypes.Platform, error)

GetPlatform returns the gcp kfapp. It's called by coordinator.GetPlatform

func IsValid

func IsValid(kfDef kfdefs.KfDef) (bool, string)

IsValid checks whether a KfDef is properly configured for GCP.

This function only performs GCP specific checks. Generic checks should be performed by KfDef.IsSpec

TODO(jlewi): Add a unittest.

Types

type Auth

type Auth struct {
	BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
	IAP       *IAP       `json:"iap,omitempty"`
}

type BasicAuth

type BasicAuth struct {
	Username string            `json:"username,omitempty"`
	Password *kfdefs.SecretRef `json:"password,omitempty"`
}

type Gcp

type Gcp struct {
	// contains filtered or unexported fields
}

Gcp implements KfApp Interface It includes the KsApp along with additional Gcp types TODO(jlewi): Why doesn't Gcp store GcpArgs as opposed to duplicating the options?

func (*Gcp) AddNamedContext

func (gcp *Gcp) AddNamedContext() error

Add a conveniently named context to KUBECONFIG.

func (*Gcp) Apply

func (gcp *Gcp) Apply(resources kftypes.ResourceEnum) error

Apply applies the gcp kfapp. Remind: Need to be thread-safe: this entry is share among kfctl and deploy app

func (*Gcp) ConfigK8s

func (gcp *Gcp) ConfigK8s() error

func (*Gcp) ConfigPodDefault

func (gcp *Gcp) ConfigPodDefault() error

Configure PodDefault to add secret.

func (*Gcp) Delete

func (gcp *Gcp) Delete(resources kftypes.ResourceEnum) error

func (*Gcp) Generate

func (gcp *Gcp) Generate(resources kftypes.ResourceEnum) error

Generate generates the gcp kfapp manifest. Remind: Need to be thread-safe: this entry is share among kfctl and deploy app

func (*Gcp) GetK8sConfig

func (gcp *Gcp) GetK8sConfig() (*rest.Config, *clientcmdapi.Config)

TODO(jlewi): We should be able to get rid of this method because it was only used for ksonnet.

func (*Gcp) GetPluginSpec

func (gcp *Gcp) GetPluginSpec() (*GcpPluginSpec, error)

GetPluginSpec gets the plugin spec.

func (*Gcp) Init

func (gcp *Gcp) Init(resources kftypes.ResourceEnum) error

Init initializes a gcp kfapp

func (*Gcp) SetRunGetCredentials

func (gcp *Gcp) SetRunGetCredentials(v bool)

func (*Gcp) SetTokenSource

func (gcp *Gcp) SetTokenSource(s oauth2.TokenSource) error

type GcpPluginSpec

type GcpPluginSpec struct {
	Auth *Auth `json:"auth,omitempty"`

	// SAClientId if supplied grant this service account cluster admin access
	// TODO(jlewi): Might want to make it a list
	SAClientId string `json:"username,omitempty"`

	// CreatePipelinePersistentStorage indicates whether to create storage.
	// Use a pointer so we can distinguish unset values.
	CreatePipelinePersistentStorage *bool `json:"createPipelinePersistentStorage,omitempty"`
}

GcpPlugin defines the extra data provided by the GCP Plugin in KfDef

func (*GcpPluginSpec) GetCreatePipelinePersistentStorage

func (p *GcpPluginSpec) GetCreatePipelinePersistentStorage() bool

func (*GcpPluginSpec) IsValid

func (s *GcpPluginSpec) IsValid() (bool, string)

IsValid returns true if the spec is a valid and complete spec. If false it will also return a string providing a message about why its invalid.

type IAP

type IAP struct {
	OAuthClientId     string            `json:"oAuthClientId,omitempty"`
	OAuthClientSecret *kfdefs.SecretRef `json:"oAuthClientSecret,omitempty"`
}

type Setter

type Setter interface {
	SetTokenSource(s oauth2.TokenSource) error

	// SetRunGetCredentials controls whether or not to run get credentials
	SetRunGetCredentials(v bool)
}

Directories

Path Synopsis
package fake provides a fake implementation of the GCP Plugin
package fake provides a fake implementation of the GCP Plugin

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL