cloud

package
v0.0.0-...-4a20579 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCloudResourcePath = "/" + defaultCloudResource

	DefaultCloudLogPath = "/var/log/contrail/cloud.log"

	DefaultWorkRoot           = "/var/tmp/cloud"
	DefaultTemplateRoot       = "./pkg/cloud/configs"
	DefaultGenInventoryScript = "transform/generate_inventories.py"
	DefaultAWSPlanTF          = "aws.tf.json"
	DefaultAzurePlanTF        = "azure.tf.json"
	DefaultGCPPlanTF          = "google.tf.json"
	DefaultTFStateFile        = "terraform.tfstate"
	DefaultTopologyFile       = "topology.yml"
	DefaultSecretFile         = "secret.yml"
	DefaultMultiCloudDir      = "/usr/share/contrail/"
	DefaultMultiCloudRepo     = "contrail-multi-cloud"

	MultiCloudDockerImage     = "contrail-multicloud-deployer"
	MultiCloudContainerPrefix = "multicloud-deployer"

	StatusField          = "provisioning_state"
	StatusNoState        = "NOSTATE"
	StatusCreated        = "CREATED"
	StatusCreateProgress = "CREATE_IN_PROGRESS"
	StatusCreateFailed   = "CREATE_FAILED"

	StatusUpdated        = "UPDATED"
	StatusUpdateProgress = "UPDATE_IN_PROGRESS"
	StatusUpdateFailed   = "UPDATE_FAILED"

	CreateAction      = "create"
	UpdateAction      = "update"
	DeleteCloudAction = "DELETE_CLOUD"
)

Cloud related constants

Variables

This section is empty.

Functions

func GetCloud

func GetCloud(ctx context.Context, client *client.HTTP, cloudID string) (*models.Cloud, error)

GetCloud gets cloud data for a given cloud UUID

func GetCloudDir

func GetCloudDir(cloudID string) string

GetCloudDir gets directory of cloud

func GetCloudSSHKeyDir

func GetCloudSSHKeyDir(cloudID string) string

GetCloudSSHKeyDir returns directory of SSH key for given Cloud.

func GetCloudSSHKeyPath

func GetCloudSSHKeyPath(cloudID string, name string) string

GetCloudSSHKeyPath returns path of SSH key for given Cloud and key name.

func GetGenInventoryCmd

func GetGenInventoryCmd(mcDir string) string

GetGenInventoryCmd get generate inventory command

func GetMultiCloudRepodir

func GetMultiCloudRepodir() string

GetMultiCloudRepodir returns path to multi-cloud directory

func GetSecretFile

func GetSecretFile(cloudID string) string

GetSecretFile gets secret file for a cloud

func GetTFStateFile

func GetTFStateFile(cloudID string) string

GetTFStateFile get terraform state file

func GetTerraformAWSPlanFile

func GetTerraformAWSPlanFile(cloudID string) string

GetTerraformAWSPlanFile gets terraform AWS plan file

func GetTerraformAzurePlanFile

func GetTerraformAzurePlanFile(cloudID string) string

GetTerraformAzurePlanFile gets terraform Azure plan file

func GetTerraformGCPPlanFile

func GetTerraformGCPPlanFile(cloudID string) string

GetTerraformGCPPlanFile gets terraform GCP plan file

func GetTopoFile

func GetTopoFile(cloudID string) string

GetTopoFile gets topology file for a cloud

func NewCloudHTTPClient

func NewCloudHTTPClient(c *Config) *client.HTTP

NewCloudHTTPClient returns a new HTTP client based on Cloud Config.

Types

type AuthorizedRegistry

type AuthorizedRegistry struct {
	Registry string `yaml:"registry,omitempty"`
	Username string `yaml:"username,omitempty"`
	Password string `yaml:"password,omitempty"`
	Tag      string `yaml:"tag,omitempty"`
}

AuthorizedRegistry stores the information about authorized docker registries

func NewAuthorizedRegistry

func NewAuthorizedRegistry(c *models.ContrailCluster) (*AuthorizedRegistry, error)

NewAuthorizedRegistry creates AuthorizedRegistry based on ContrailCluster parameters

type Cloud

type Cloud struct {
	APIServer *client.HTTP
	// contains filtered or unexported fields
}

Cloud represents cloud service.

func NewCloud

func NewCloud(
	c *Config,
	terraformStateReader terraformStateReader,
	containerExecutor containerExecutor,
	httpClient *client.HTTP,
	reporter *report.Reporter,
) (*Cloud, error)

NewCloud returns a new Cloud instance

func NewCloudManager

func NewCloudManager(c *Config) (*Cloud, error)

NewCloudManager creates cloud fields by a given *cloud.Config

func NewCloudManagerFromConfigFile

func NewCloudManagerFromConfigFile(configPath string) (*Cloud, error)

NewCloudManagerFromConfigFile creates cloud fields by reading config from given configPath

func (*Cloud) Config

func (c *Cloud) Config() Config

Config returns copy of Cloud's config.

func (*Cloud) Context

func (c *Cloud) Context() context.Context

Context returns Cloud's context.

func (*Cloud) HandleCloudRequest

func (c *Cloud) HandleCloudRequest() error

HandleCloudRequest handles Cloud create/update/delete request.

func (*Cloud) Manage

func (c *Cloud) Manage() error

Manage starts managing the cloud.

type Config

type Config struct {
	// ID of cloud
	ID string `yaml:"id"`
	// Password of Cluster account.
	Password string `yaml:"password"`
	// DomainID is ID of keystone domain used for authentication.
	DomainID string `yaml:"domain_id"`
	// ProjectID is ID of keystone project used for authentication.
	ProjectID string `yaml:"project_id"`
	// DomainName is Name of keystone domain used for authentication.
	DomainName string `yaml:"domain_name"`
	// ProjectName is Name of keystone project used for authentication.
	ProjectName string `yaml:"project_name"`
	// AuthURL defines authentication URL.
	AuthURL string `yaml:"auth_url"`
	// Endpoint of API Server.
	Endpoint string `yaml:"endpoint"`
	// InSecure https connection to endpoint.
	InSecure bool `yaml:"insecure"`
	// UUID of cloud to be managed.
	CloudID string `yaml:"cloud_id,omitempty"`
	// Action to the performed with the cloud (values: create, update, delete).
	Action string `yaml:"cloud_action,omitempty"`
	// Logging level
	LogLevel string `yaml:"log_level"`
	// Logging  file
	LogFile string `yaml:"log_file"`
	// Template root directory
	TemplateRoot string `yaml:"template_root"`

	// Optional Test var to run cloud in test mode
	Test bool `yaml:"test"`
}

Config represents cloud configuration needed by cloudManager.

type Data

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

Data for cloud provider data

type Keypair

type Keypair struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

Keypair holds name and public SSH key value

type SecretFileConfig

type SecretFileConfig struct {
	Keypair              Keypair               `yaml:"public_key"`
	AWSAccessKey         string                `yaml:"aws_access_key,omitempty"`
	AWSSecretKey         string                `yaml:"aws_secret_key,omitempty"`
	AzureSubscriptionID  string                `yaml:"azure_subscription_id,omitempty"`
	AzureClientID        string                `yaml:"azure_client_id,omitempty"`
	AzureClientSecret    string                `yaml:"azure_client_secret,omitempty"`
	AzureTenantID        string                `yaml:"azure_tenant_id,omitempty"`
	GoogleAccount        string                `yaml:"google_credentials,omitempty"`
	AuthorizedRegistries []*AuthorizedRegistry `yaml:"authorized_registries,omitempty"`
}

SecretFileConfig holds the secret keys of the cloud

func (*SecretFileConfig) Update

func (sfc *SecretFileConfig) Update(kp *models.Keypair) error

Update fills the secret file config

type TerraformState

type TerraformState interface {
	GetPublicIP(hostname string) (string, error)
	GetPrivateIP(hostname string) (string, error)
}

TerraformState interface allows retrieving Terraform state data.

Jump to

Keyboard shortcuts

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