openstack

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const KubekitOS = "c0b5a78d-6b21-4f44-a839-1a16c9f5e525"

KubekitOS is the latest or stable KubekitOS template name

Variables

View Source
var ResourceTemplates map[string]string

ResourceTemplates maps resource names to content of resources implementation specified in code.go

Functions

This section is empty.

Types

type Config

type Config struct {
	// Following fields are platform generic
	// TODO: refactor common fields into common data structure
	ClusterName             string   `json:"-" yaml:"-" mapstructure:"clustername"`
	KubeAPISSLPort          int      `json:"kube_api_ssl_port" yaml:"kube_api_ssl_port" mapstructure:"kube_api_ssl_port"`
	DisableMasterHA         bool     `json:"disable_master_ha" yaml:"disable_master_ha" mapstructure:"disable_master_ha"`
	KubeVirtualIPShortname  string   `json:"kube_virtual_ip_shortname" yaml:"kube_virtual_ip_shortname" mapstructure:"kube_virtual_ip_shortname"`
	KubeVirtualIPApi        string   `json:"kube_virtual_ip_api" yaml:"kube_virtual_ip_api" mapstructure:"kube_virtual_ip_api"`
	KubeVIPAPISSLPort       int      `json:"kube_vip_api_ssl_port" yaml:"kube_vip_api_ssl_port" mapstructure:"kube_vip_api_ssl_port"`
	PublicAPIServerDNSName  string   `json:"public_apiserver_dns_name" yaml:"public_apiserver_dns_name" mapstructure:"public_apiserver_dns_name"`
	PrivateAPIServerDNSName string   `json:"private_apiserver_dns_name" yaml:"private_apiserver_dns_name" mapstructure:"private_apiserver_dns_name"`
	Username                string   `json:"username" yaml:"username" mapstructure:"username"`
	PrivateKey              string   `json:"private_key,omitempty" yaml:"private_key,omitempty" mapstructure:"private_key"`
	PrivateKeyFile          string   `json:"private_key_file" yaml:"private_key_file" mapstructure:"private_key_file"`
	PublicKey               string   `json:"public_key,omitempty" yaml:"public_key,omitempty" mapstructure:"public_key"`
	PublicKeyFile           string   `json:"public_key_file" yaml:"public_key_file" mapstructure:"public_key_file"`
	DNSServers              []string `json:"dns_servers" yaml:"dns_servers" mapstructure:"dns_servers"`
	DNSSearch               []string `json:"dns_search" yaml:"dns_search" mapstructure:"dns_search"`
	TimeServers             []string `json:"time_servers" yaml:"time_servers" mapstructure:"time_servers"`

	// Following are openstack specific fields
	OpenstackTenantName string              `json:"openstack_tenant_name,omitempty" yaml:"openstack_tenant_name" mapstructure:"openstack_tenant_name"`
	OpenstackAuthURL    string              `json:"-" yaml:"-" mapstructure:"-"`
	OpenstackUserName   string              `json:"-" yaml:"-" mapstructure:"-"`
	OpenstackPassword   string              `json:"-" yaml:"-" mapstructure:"-"`
	OpenstackDomainName string              `json:"openstack_domain_name,omitempty" yaml:"openstack_domain_name" mapstructure:"openstack_domain_name"`
	OpenstackRegion     string              `json:"openstack_region,omitempty" yaml:"openstack_region" mapstructure:"openstack_region"`
	OpenstackNetName    string              `json:"openstack_net_name,omitempty" yaml:"openstack_net_name" mapstructure:"openstack_net_name"`
	DefaultNodePool     NodePool            `json:"default_node_pool" yaml:"default_node_pool" yaml:"default_node_pool" mapstructure:"default_node_pool"`
	NodePools           map[string]NodePool `json:"node_pools" yaml:"node_pools" yaml:"node_pools" mapstructure:"node_pools"`
}

Config defines the Openstack configuration parameters in the Cluster config file

func NewConfigFrom

func NewConfigFrom(m map[interface{}]interface{}) *Config

NewConfigFrom returns a new openstack configuration from a map, usually from a cluster config file

func (*Config) MergeNodePools

func (c *Config) MergeNodePools(nodePoolsEnvConf map[string]string)

MergeNodePools merges the node pools in this configuration with the given environment configuration for node pools

func (*Config) MergeWithEnv

func (c *Config) MergeWithEnv(envConf map[string]string, conf ...Config) error

MergeWithEnv merges this configuration with the given configuration in a map[string]string, usually from environment variables

func (*Config) MergeWithMapConfig

func (c *Config) MergeWithMapConfig(m map[interface{}]interface{})

MergeWithMapConfig merges this configuration with the given configuration in a map[string], usually from a cluster config file

type NodePool

type NodePool struct {
	Name              string   `json:"-" yaml:"-" mapstructure:"name"`
	Count             int      `json:"count" yaml:"count" mapstructure:"count"`
	OpenstackImageID  string   `json:"openstack_image_id,omitempty" yaml:"openstack_image_id,omitempty" mapstructure:"openstack_image_id"`
	OpenstackFlavorID string   `json:"openstack_flavor_id,omitempty" yaml:"openstack_flavor_id,omitempty" mapstructure:"openstack_flavor_id"`
	SecurityGroups    []string `json:"security_groups,omitempty" yaml:"security_groups,omitempty" mapstructure:"security_groups"`
	KubeletNodeLabels []string `json:"kubelet_node_labels,omitempty" yaml:"kubelet_node_labels,omitempty" mapstructure:"kubelet_node_labels"`
	KubeletNodeTaints []string `json:"kubelet_node_taints,omitempty" yaml:"kubelet_node_taints,omitempty" mapstructure:"kubelet_node_taints"`
}

NodePool defines the settings for group of instances on Openstack

type Platform

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

Platform implements the Provisioner interface for AWS

func CreateFrom

func CreateFrom(clusterName string, config map[interface{}]interface{}, credentials []string, ui *ui.UI, version string) *Platform

CreateFrom creates a new Plaftorm with the given configuration for Openstack

func New

func New(clusterName string, envConfig map[string]string, ui *ui.UI, version string) (*Platform, error)

New creates a new Plaform with the given environment configuration

func (*Platform) Address

func (p *Platform) Address() string

Address returns the address to access the Kubernetes cluster

func (*Platform) Apply

func (p *Platform) Apply(destroy bool) error

Apply apply the changes either to create or destroy the cluster on this platform

func (*Platform) BeProvisioner

func (p *Platform) BeProvisioner(state *terraformer.State) error

BeProvisioner setup the Plaftorm to be a Provisioner

func (*Platform) Code

func (p *Platform) Code() []byte

Code returns the Terraform code to execute

func (*Platform) Config

func (p *Platform) Config() interface{}

Config returns the default configuration for openstack

func (*Platform) Credentials

func (p *Platform) Credentials(params ...string)

Credentials is to assign the credentials to the configuration. Four arguments are expected:

First:  authentication URL string
Second: username
Third:  password

func (*Platform) GetPrivateKey

func (p *Platform) GetPrivateKey() (string, []byte, bool)

GetPrivateKey returns the private key and file from the configuration, also if this platform requires a private key for provisioning

func (*Platform) GetPublicKey

func (p *Platform) GetPublicKey() (string, []byte, bool)

GetPublicKey return the public key and file from the configuration, also if this platform requires a public key for provisioning

func (*Platform) LoadState

func (p *Platform) LoadState(stateBuffer *bytes.Buffer) error

LoadState loads the given Terraform state in a buffer into the terraformer state

func (*Platform) MergeWithEnv

func (p *Platform) MergeWithEnv(envConfig map[string]string) error

MergeWithEnv implements the MergeWithEnv method from the interfase Provisioner. It merges the environment variables with the existing configuration

func (*Platform) Name

func (p *Platform) Name() string

Name returns the platform name

func (*Platform) Nodes

func (p *Platform) Nodes() []*state.Node

Nodes returns the list of provisioned nodes in the current terraform state

func (*Platform) Output

func (p *Platform) Output(name string) string

Output returns a value from the terraform output

func (*Platform) Plan

func (p *Platform) Plan(destroy bool) (plan *terraformer.Plan, err error)

Plan do the planning of the changes either to create or destroy the cluster on this platform.

func (*Platform) Port

func (p *Platform) Port() int

Port returns the port to access the Kubernetes cluster

func (*Platform) PrivateKey

func (p *Platform) PrivateKey(file string, encKey, key []byte)

PrivateKey sets the private key and file in the configuration

func (*Platform) Provision

func (p *Platform) Provision() error

Provision provisions or creates a cluster on this platform

func (*Platform) PublicKey

func (p *Platform) PublicKey(file string, key []byte)

PublicKey sets the public key and file in the configuration and variables

func (*Platform) State

func (p *Platform) State() *terraformer.State

State returns the current Terraform state of the cluster

func (*Platform) Terminate

func (p *Platform) Terminate() error

Terminate terminates or destroys a cluster on this platform

func (*Platform) Variables

func (p *Platform) Variables() map[string]interface{}

Variables returns the variables as a map where the key is the variable name Note: Variables has been reduced to sensative data fields such as credentials and private keys. All other values are rendered directly from Config.

Jump to

Keyboard shortcuts

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