steps

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: Apache-2.0 Imports: 15 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterStep

func RegisterStep(stepName string, step Step)

func RunTemplate

func RunTemplate(ctx context.Context, tpl *template.Template, r runner.Runner, output io.Writer, cfg interface{}) error

Types

type AWSConfig

type AWSConfig struct {
	KeyID                  string `json:"access_key"`
	Secret                 string `json:"secret_key"`
	Region                 string `json:"region"`
	AvailabilityZone       string `json:"availabilityZone"`
	KeyPairName            string `json:"keyPairName"`
	VPCID                  string `json:"vpcid"`
	VPCCIDR                string `json:"vpccidr"`
	RouteTableID           string `json:"routeTableId"`
	InternetGatewayID      string `json:"internetGatewayId"`
	NodesSecurityGroupID   string `json:"nodesSecurityGroupID"`
	MastersSecurityGroupID string `json:"mastersSecurityGroupID"`
	MastersInstanceProfile string `json:"mastersInstanceProfile"`
	NodesInstanceProfile   string `json:"nodesInstanceProfile"`
	VolumeSize             string `json:"volumeSize"`
	DeviceName             string `json:"deviceName"`
	EbsOptimized           string `json:"ebsOptimized"`
	ImageID                string `json:"image"`
	InstanceType           string `json:"size"`

	ExternalLoadBalancerName string `json:"externalLoadBalancerName"`
	InternalLoadBalancerName string `json:"internalLoadBalancerName"`

	// Map of availability zone to subnet
	Subnets map[string]string `json:"subnets"`
	// Map az to route table association
	RouteTableAssociationIDs map[string]string `json:"routeTableAssociationIds"`
}

type AzureConfig

type AzureConfig struct {
	ClientID       string `json:"clientId"`
	ClientSecret   string `json:"clientSecret"`
	TenantID       string `json:"tenantId"`
	SubscriptionID string `json:"subscriptionId"`

	Location string `json:"location"`

	VMSize string `json:"vmSize"`
	// TODO: cidr validation?
	VNetCIDR string `json:"vNetCIDR"`
}

type CertificatesConfig

type CertificatesConfig struct {
	ServicesCIDR string `json:"servicesCIDR"`
	PublicIP     string `json:"publicIp"`
	PrivateIP    string `json:"privateIp"`
	Provider     string `json:"provider"`

	MasterHost string `json:"masterHost"`
	MasterPort string `json:"masterPort"`

	IsMaster bool `json:"isMaster"`
	// TODO: this shouldn't be a part of SANs
	// https://kubernetes.io/docs/setup/certificates/#all-certificates
	KubernetesSvcIP string `json:"kubernetesSvcIp"`

	StaticAuth profile.StaticAuth `json:"staticAuth"`

	// DEPRECATED: it's a part of staticAuth
	Username string
	// DEPRECATED: it's a part of staticAuth
	Password string

	AdminCert string `json:"adminCert"`
	AdminKey  string `json:"adminKey"`

	ParenCert []byte `json:"parenCert"`
	CACert    string `json:"caCert"`
	CAKey     string `json:"caKey"`

	SAKey string `json:"saKey"`
	SAPub string `json:"saPub"`
}

type Config

type Config struct {
	Kube model.Kube `json:"kube"`

	DryRun                 bool `json:"dryRun"`
	TaskID                 string
	Provider               clouds.Name  `json:"provider"`
	IsMaster               bool         `json:"isMaster"`
	IsBootstrap            bool         `json:"IsBootstrap"`
	BootstrapToken         string       `json:"bootstrapToken"`
	ClusterID              string       `json:"clusterId"`
	ClusterName            string       `json:"clusterName"`
	LogBootstrapPrivateKey bool         `json:"logBootstrapPrivateKey"`
	DigitalOceanConfig     DOConfig     `json:"digitalOceanConfig"`
	AWSConfig              AWSConfig    `json:"awsConfig"`
	GCEConfig              GCEConfig    `json:"gceConfig"`
	AzureConfig            AzureConfig  `json:"azureConfig"`
	OSConfig               OSConfig     `json:"osConfig"`
	PacketConfig           PacketConfig `json:"packetConfig"`

	DockerConfig       DockerConfig       `json:"dockerConfig"`
	DownloadK8sBinary  DownloadK8sBinary  `json:"downloadK8sBinary"`
	CertificatesConfig CertificatesConfig `json:"certificatesConfig"`
	NetworkConfig      NetworkConfig      `json:"networkConfig"`
	PostStartConfig    PostStartConfig    `json:"postStartConfig"`
	TillerConfig       TillerConfig       `json:"tillerConfig"`
	PrometheusConfig   PrometheusConfig   `json:"prometheusConfig"`
	DrainConfig        DrainConfig        `json:"drainConfig"`
	KubeadmConfig      KubeadmConfig      `json:"kubeadmConfig"`
	ConfigMap          ConfigMap          `json:"configMap"`

	ExternalDNSName string `json:"externalDnsName"`
	InternalDNSName string `json:"internalDnsName"`

	Node             model.Machine `json:"node"`
	CloudAccountID   string        `json:"cloudAccountId" valid:"required, length(1|32)"`
	CloudAccountName string        `json:"cloudAccountName" valid:"required, length(1|32)"`
	Timeout          time.Duration `json:"timeout"`
	Runner           runner.Runner `json:"-"`

	Masters Map `json:"masters"`

	Nodes Map `json:"nodes"`
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(clusterName, cloudAccountName string, profile profile.Profile) (*Config, error)

NewConfig builds instance of config for provisioning

func NewConfigFromKube

func NewConfigFromKube(profile *profile.Profile, k *model.Kube) (*Config, error)

func (*Config) AddMaster

func (c *Config) AddMaster(n *model.Machine)

AddMaster to map of master, map is used because it is reference and can be shared among goroutines that run multiple tasks of cluster deployment

func (*Config) AddNode

func (c *Config) AddNode(n *model.Machine)

AddNode to map of nodes in cluster

func (*Config) ConfigChan

func (c *Config) ConfigChan() chan *Config

func (*Config) GetAzureAuthorizer

func (c *Config) GetAzureAuthorizer() autorest.Authorizer

func (*Config) GetMaster

func (c *Config) GetMaster() *model.Machine

GetMaster returns first master in master map or nil

func (*Config) GetMasters

func (c *Config) GetMasters() map[string]*model.Machine

func (*Config) GetNode

func (c *Config) GetNode() *model.Machine

GetMaster returns first master in master map or nil

func (*Config) GetNodes

func (c *Config) GetNodes() map[string]*model.Machine

func (*Config) KubeStateChan

func (c *Config) KubeStateChan() chan model.KubeState

func (*Config) NodeChan

func (c *Config) NodeChan() chan model.Machine

func (*Config) SetAzureAuthorizer

func (c *Config) SetAzureAuthorizer(a autorest.Authorizer)

func (*Config) SetConfigChan

func (c *Config) SetConfigChan(configChan chan *Config)

func (*Config) SetKubeStateChan

func (c *Config) SetKubeStateChan(kubeStateChan chan model.KubeState)

func (*Config) SetNodeChan

func (c *Config) SetNodeChan(nodeChan chan model.Machine)

type ConfigMap

type ConfigMap struct {
	Data string
}

type DOConfig

type DOConfig struct {
	Name string `json:"name" valid:"required"`
	// These come from UI select
	Region string `json:"region" valid:"required"`
	Size   string `json:"size" valid:"required"`
	Image  string `json:"image" valid:"required"`

	// These come from cloud account
	Fingerprint string `json:"fingerprint" valid:"required"`
	AccessToken string `json:"accessToken" valid:"required"`

	ExternalLoadBalancerID string `json:"externalLoadBalancerId"`
	InternalLoadBalancerID string `json:"internalLoadBalancerId"`
}

type DockerConfig

type DockerConfig struct {
	Version        string `json:"version"`
	ReleaseVersion string `json:"releaseVersion"`
	Arch           string `json:"arch"`
}

type DownloadK8sBinary

type DownloadK8sBinary struct {
	K8SVersion      string `json:"k8sVersion"`
	Arch            string `json:"arch"`
	OperatingSystem string `json:"operatingSystem"`
}

type DrainConfig

type DrainConfig struct {
	PrivateIP string `json:"privateIp"`
}

type GCEConfig

type GCEConfig struct {
	ServiceAccount

	// This comes from profile
	ImageFamily      string `json:"imageFamily"`
	Region           string `json:"region"`
	AvailabilityZone string `json:"availabilityZone"`
	Size             string `json:"size"`

	NetworkName string `json:"networkName"`
	NetworkLink string `json:"networkLink"`
	SubnetLink  string `json:"subnetLink"`

	AZs map[string]string `json:"subnets"`

	// Mapping AZ -> Instance group
	InstanceGroupNames map[string]string `json:"instanceGroupNames"`
	InstanceGroupLinks map[string]string `json:"instanceGroupLinks"`

	// Target pool acts as a balancer for external traffic https://cloud.google.com/load-balancing/docs/target-pools
	TargetPoolName string `json:"targetPoolName"`
	TargetPoolLink string `json:"targetPoolLink"`

	ExternalAddressName string `json:"externalAddressName"`
	InternalAddressName string `json:"internalAddressName"`

	ExternalIPAddressLink string `json:"externalIpAddressLink"`
	InternalIPAddressLink string `json:"internalIpAddressLink"`

	BackendServiceName string `json:"backendServiceName"`
	BackendServiceLink string `json:"backendServiceLink"`

	HealthCheckName string `json:"healthCheckName"`

	ExternalForwardingRuleName string `json:"externalForwardingRuleName"`
	InternalForwardingRuleName string `json:"externalForwardingRuleName"`
}

type KubeadmConfig

type KubeadmConfig struct {
	K8SVersion  string `json:"K8SVersion"`
	IsMaster    bool   `json:"isMaster"`
	IsBootstrap bool   `json:"IsBootstrap"`
	ServiceCIDR string `json:"serviceCIDR"`
	CIDR        string `json:"cidr"`
	Token       string `json:"token"`
	Provider    string `json:"provider"`
	NodeIp      string `json:"nodeIp"`

	InternalDNSName string `json:"internalDNSName"`
	ExternalDNSName string `json:"externalDNSName"`
}

type Map

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

func NewMap

func NewMap(m map[string]*model.Machine) Map

func (*Map) MarshalJSON

func (m *Map) MarshalJSON() ([]byte, error)

func (*Map) UnmarshalJSON

func (m *Map) UnmarshalJSON(b []byte) error

type NetworkConfig

type NetworkConfig struct {
	IsBootstrap     bool   `json:"isBootstrap"`
	CIDR            string `json:"cidr"`
	NetworkProvider string `json:"networkProvider"`
}

type OSConfig

type OSConfig struct{}

type PacketConfig

type PacketConfig struct{}

type PostStartConfig

type PostStartConfig struct {
	IsBootstrap bool          `json:"isBootstrap"`
	Provider    clouds.Name   `json:"provider"`
	Host        string        `json:"host"`
	Port        string        `json:"port"`
	Username    string        `json:"username"`
	RBACEnabled bool          `json:"rbacEnabled"`
	Timeout     time.Duration `json:"timeout"`
}

type PrometheusConfig

type PrometheusConfig struct {
	Port        string `json:"port"`
	RBACEnabled bool   `json:"rbacEnabled"`
}

type ServiceAccount

type ServiceAccount struct {
	// NOTE(stgleb): This comes from cloud account
	Type      string `json:"type"`
	ProjectID string `json:"project_id"`

	PrivateKeyID string `json:"private_key_id"`
	PrivateKey   string `json:"private_key"`

	ClientEmail string `json:"client_email"`
	ClientID    string `json:"client_id"`

	AuthURI  string `json:"auth_uri"`
	TokenURI string `json:"token_uri"`

	AuthProviderX509CertURL string `json:"auth_provider_x509_cert_url"`
	ClientX509CertUrl       string `json:"client_x509_cert_url"`
}

type Step

type Step interface {
	Run(context.Context, io.Writer, *Config) error
	Name() string
	Description() string
	Depends() []string
	Rollback(context.Context, io.Writer, *Config) error
}

func GetStep

func GetStep(stepName string) Step

type TillerConfig

type TillerConfig struct {
	HelmVersion     string `json:"helmVersion"`
	RBACEnabled     bool   `json:"rbacEnabled"`
	OperatingSystem string `json:"operatingSystem"`
	Arch            string `json:"arch"`
}

Jump to

Keyboard shortcuts

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