config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForCluster

func ForCluster(ctx context.Context, n uint16, cfg *Config, fn func(context.Context, *ClusterInfo) error) error

Types

type ClusterInfo

type ClusterInfo struct {
	*Config
	Index    ClusterNumber
	Password string
}

func NewClusterInfo

func NewClusterInfo(ctx context.Context, cfg *Config, i ClusterNumber) *ClusterInfo

func (*ClusterInfo) BasicAuth

func (c *ClusterInfo) BasicAuth() string

func (*ClusterInfo) Domain

func (c *ClusterInfo) Domain() string

type ClusterLogin

type ClusterLogin struct {
	// Username for basic auth logins. Defaults to workshopctl.
	Username string `json:"username"`
	// CommonPassword sets the same password for VS code and all basic auth
	// for all clusters. If unset, a random password will be generated.
	CommonPassword string `json:"commonPassword"`
	// UniquePasswords tells whether every cluster should have its own password.
	// By default false, which means all clusters share CommonPassword. If true,
	// CommonPassword will be ignored and all clusters' passwords will be generated.
	UniquePasswords bool `json:"uniquePasswords"`
}

type ClusterNumber

type ClusterNumber uint16

func (ClusterNumber) ClusterDir

func (n ClusterNumber) ClusterDir() string

func (ClusterNumber) Domain

func (n ClusterNumber) Domain(rootDomain string) string

func (ClusterNumber) KubeConfigPath

func (n ClusterNumber) KubeConfigPath() string

func (ClusterNumber) String

func (n ClusterNumber) String() string

func (ClusterNumber) Subdomain

func (n ClusterNumber) Subdomain() string

type Config

type Config struct {
	// The prefix to use for all identifying names/tags/etc.
	// This allows an user to have multiple workshop environments at once in the same provider
	Name string `json:"name"`

	// CloudProvider specifies what cloud provider to use and how to authenticate with it.
	CloudProvider Provider `json:"cloudProvider"`
	// DNSProvider specifies what dns provider to use and how to authenticate with it.
	DNSProvider Provider `json:"dnsProvider"`

	RootDomain string `json:"rootDomain"`
	// How many clusters should be created?
	Clusters uint16 `json:"clusters"`
	// Where to store the manifests for collaboration?
	Git Git `json:"git"`

	// Whom to contact by Let's Encrypt
	LetsEncryptEmail string `json:"letsEncryptEmail"`

	Tutorials Tutorials `json:"tutorials"`

	ClusterLogin ClusterLogin `json:"clusterLogin"`

	NodeGroups []NodeGroup `json:"nodeGroups"`
}

func (*Config) Complete

func (c *Config) Complete(ctx context.Context) error

func (*Config) Validate

func (c *Config) Validate() error

type Git

type Git struct {
	// Repo specifies where the "infra" git repo should be
	Repo       string                        `json:"repo"`
	RepoStruct gitprovider.UserRepositoryRef `json:"-"`

	// The ServiceAccount struct is embedded and inlined into this struct
	ServiceAccount `json:",inline"`
}

type NodeClaim

type NodeClaim struct {
	CPU uint16 `json:"cpus"`
	RAM uint16 `json:"ram"`
	// Refers to if the CPU is shared with other tenants, or dedicated for this VM
	Dedicated bool `json:"dedicated"`
}

type NodeGroup

type NodeGroup struct {
	Instances uint16    `json:"instances"`
	NodeClaim NodeClaim `json:"nodeClaim"`
}

type Provider

type Provider struct {
	// Name of the provider. For now, only "digitalocean" is supported.
	Name string `json:"name"`
	// The ServiceAccount struct is embedded and inlined into the provider
	ServiceAccount `json:",inline"`
	// Provider-specific data
	ProviderSpecific map[string]string `json:"providerSpecific,omitempty"`
}

type ServiceAccount

type ServiceAccount struct {
	// ServiceAccountPath specifies the file path to the service account
	ServiceAccountPath string `json:"serviceAccountPath"`
	// The contents of ServiceAccountPath, read at runtime and never marshalled.
	ServiceAccountContent string `json:"-"`
}

func (ServiceAccount) TokenSource

func (sa ServiceAccount) TokenSource() oauth2.TokenSource

If the ServiceAccount is an oauth2 token, this helper method might be useful for the implementing provider

type Tutorials

type Tutorials struct {
	Repo string `json:"repo"`
	Dir  string `json:"dir"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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