provisioning

package
v0.0.0-...-105ea73 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const KubeconfigOutputKey = "kubeconfig-file"

Variables

View Source
var PlatformAdapters = map[Platform]func(*models.K8sProvisionerSpec, string) K8sClusterAdapter{
	PlatformGCP: func(spec *models.K8sProvisionerSpec, workdir string) K8sClusterAdapter {
		support := gcpsupport.NewKopsSupport(gcpsupport.KopsSupportConfig{
			ProjectID:                spec.Project,
			ServiceAccountFileBase64: spec.Credentials.GCPServiceAccountFile,
			StateStoreName:           spec.StateStoreName,
			WorkDir:                  workdir,
		})
		return cloud.NewK8sClusterAdapter(spec, support, workdir)
	},
	PlatformAWS: func(spec *models.K8sProvisionerSpec, workdir string) K8sClusterAdapter {
		support := awssupport.NewKopsSupport(awssupport.KopsSupportConfig{
			AccessKeyID:     spec.Credentials.AWSAccessKeyID,
			SecretAccessKey: spec.Credentials.AWSSecretAccessKey,
			StateStoreName:  spec.StateStoreName,
			Region:          spec.Region,
			SSHPublicKey:    spec.Credentials.SSHPublicKey,
			WorkDir:         workdir,
		})
		return cloud.NewK8sClusterAdapter(spec, support, workdir)
	},
}
View Source
var PlatformMapping = map[string]Platform{
	"gcp": PlatformGCP,
	"aws": PlatformAWS,
}

Functions

func NewK8sClusterManager

func NewK8sClusterManager(cfg K8sClusterManagerConfig, adapter K8sClusterAdapter) *k8sClusterManager

NewK8sClusterManager returns a new k8sClusterManager instance. Takes a spec and a platform adapter and synchronize makes relevant synchronization calls to the adapter.

Types

type K8sClusterAdapter

type K8sClusterAdapter interface {
	ProvisionCluster(ctx context.Context) errors.Error
	GetCluster(ctx context.Context) (*models.K8sCluster, errors.Error)
	GetKubeconfig(ctx context.Context) (io.Reader, errors.Error)
}

type K8sClusterManager

type K8sClusterManager interface {
	Synchronize(context.Context) (*models.K8sCluster, errors.Error)
	SaveKubeconfig(context.Context) errors.Error
}

func NewK8sClusterManagerFromSpec

func NewK8sClusterManagerFromSpec(cfg K8sClusterManagerConfig) (K8sClusterManager, errors.Error)

type K8sClusterManagerConfig

type K8sClusterManagerConfig struct {
	Spec          *models.K8sProvisionerSpec
	Workdir       string
	OutputsClient outputs.OutputsClient
}

type Platform

type Platform int
const (
	PlatformGCP Platform = iota
	PlatformAWS
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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