cliaas

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

README

cliaas

cliaas wraps multiple IaaS-specific libraries to perform some IaaS-agnostic functions. Presently it only supports upgrading a Pivotal Cloud Foundry Operations Manager VM.

Installing

Download the latest release.

Install from source

Requirements:

go get github.com/pivotal-cf/cliaas
cd $GOPATH/src/github.com/pivotal-cf/cliaas
glide install
go install github.com/pivotal-cf/cliaas/cmd/cliaas

Usage

cliaas -c config.yml replace-vm --identifier vm-identifier --image some-image

Config

The -c, --config= flag is for specifying a YAML file with IaaS-specific configuration options to use when running a command. The config should only contain the configuration for a single IaaS for now.

AWS-specific Config
cat > config.yml <<EOF
  aws:
    access_key_id: example-access-key-id
    secret_access_key: example-secret-access-key
    region: us-east-1
    vpc: vpc-12345678
    ami: ami-019e4617
EOF
  • access_key_id: The AWS_ACCESS_KEY_ID to use. Must have the ability to stop VM, start VM, and associate an IP address.
  • secret_access_key: The AWS_SECRET_ACCESS_KEY to use. Must have the ability to stop VM, start VM, and associate an IP address.
  • region: The AWS region to use.
  • vpc: The AWS vpc to use.
  • ami: A Pivotal Cloud Foundry Operations Manager AMI, for the new VM in replace-vm.
GCP-specific Config
cat > config.yml <<EOF
  gcp:
    credfile: /tmp/gcp-creds.json
    zone: us-east-1
    project: my-gcp-projectname
    disk_image_url: opsmanager-disk-image-url 
EOF
  • credfile: The path of your credentials json file issued by gcp.
  • zone: the zone in gcp your deployments are in.
  • project: the name of the gcp project you're using.
  • disk_image_url:: the url of ops manager image provided by pivotal on pivnet
Azure-specific Config

!!! The replace-vm call on Azure will DELETE the current ops manager vm when standing up the new version. This behavior is different than other IaaS' so be warned !!!

cat > config.yml <<EOF
  azure:
    vhd_image_url: xxxx
    subscription_id: xxxxxx 
    client_id: xxxxx
    client_secret: xxxxx
    tenant_id: xxxxx
    resource_group_name: xxxxx
    resource_manager_endpoint: xxxxx
    storage_account_name: xxxx
    storage_account_key: xxxx
    storage_container_name: xxxx
    storage_url: xxxx
    vm_admin_password: xxxxx
EOF
  • vhd_image_url: xxxxxx //$ the url of ops manager vhd provided by Pivotal, which can be found on pivnet
  • subscription_id: xxxxxx //$ azure account show | grep "data: ID"
  • client_id: xxxxx //this is the appID output of azure ad app create
  • client_secret: xxxxx //this is the password given as a param to the $ azure ad sp create
  • tenant_id: xxxxx //$ azure account show | grep "Tenant ID"
  • resource_group_name: xxxxx /// this is just the resource group name we wish to target
  • storage_account_name: xxxx // this is the name of the storage account you wish to use for storing ops manager vhd
  • storage_account_key: xxxx // this is the key to access the above storage account
  • storage_container_name: xxxx // the name of the storage container you wish to place the ops manager disk image vhd
  • //optional values
  • resource_manager_endpoint: xxxx /// option value. defaults to https://management.azure.com/
  • storage_url: xxxx // optional storage url to overwrite default value (core.windows.net)
  • vm_admin_password: xxxx // optional vm admin password ( a random one will be used if none given)
Identifiers

The VM identifier is used to find the VM by name in the IaaS.

Image values in config.yml

Developing

go install github.com/onsi/ginkgo/ginkgo
ginkgo -r -p -race -skipPackage integration

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "0.0.0-dev"

Functions

This section is empty.

Types

type AWSClient

type AWSClient interface {
	CreateVM(ami, instanceType, name, keyName, subnetID, securityGroupID string) (string, error)
	DeleteVM(instanceID string) error
	GetVMInfo(name string) (VMInfo, error)
	StartVM(instanceID string) error
	StopVM(instanceID string) error
	AssignPublicIP(instance, ip string) error
	WaitForStatus(instanceID string, status string) error
}

func NewAWSClient

func NewAWSClient(
	ec2Client EC2Client,
	vpcID string,
	clock clock.Clock,
) AWSClient

type AWSConfig added in v0.1.2

type AWSConfig struct {
	AMI             string `yaml:"ami"`
	AccessKeyID     string `yaml:"access_key_id"`
	SecretAccessKey string `yaml:"secret_access_key"`
	Region          string `yaml:"region"`
	VPCID           string `yaml:"vpc_id"`
}

func (*AWSConfig) Complete added in v0.1.2

func (c *AWSConfig) Complete() bool

func (*AWSConfig) Image added in v0.1.2

func (c *AWSConfig) Image() string

func (*AWSConfig) NewClient added in v0.1.2

func (c *AWSConfig) NewClient() (Client, error)

type AzureConfig added in v0.1.2

type AzureConfig struct {
	VHDImageURL             string `yaml:"vhd_image_url"`
	SubscriptionID          string `yaml:"subscription_id"`
	ClientID                string `yaml:"client_id"`
	ClientSecret            string `yaml:"client_secret"`
	TenantID                string `yaml:"tenant_id"`
	ResourceGroupName       string `yaml:"resource_group_name"`
	ResourceManagerEndpoint string `yaml:"resource_manager_endpoint"`
	StorageAccountName      string `yaml:"storage_account_name"`
	StorageAccountKey       string `yaml:"storage_account_key"`
	StorageContainerName    string `yaml:"storage_container_name"`
	StorageURL              string `yaml:"storage_url"`
	VMAdminPassword         string `yaml:"vm_admin_password"`
}

func (*AzureConfig) Complete added in v0.1.2

func (c *AzureConfig) Complete() bool

func (*AzureConfig) Image added in v0.1.2

func (c *AzureConfig) Image() string

func (*AzureConfig) NewClient added in v0.1.2

func (c *AzureConfig) NewClient() (Client, error)

type Client added in v0.1.2

type Client interface {
	Delete(vmIdentifier string) error
	Replace(vmIdentifier string, imageIdentifier string) error
}

type Config

type Config interface {
	Image() string
	Complete() bool
	NewClient() (Client, error)
}

type EC2Client

func NewEC2Client added in v0.1.2

func NewEC2Client(
	accessKeyID string,
	secretAccessKey string,
	region string,
) (EC2Client, error)

type GCPConfig added in v0.1.2

type GCPConfig struct {
	CredfilePath string `yaml:"credfile"`
	Zone         string `yaml:"zone"`
	Project      string `yaml:"project"`
	DiskImageURL string `yaml:"disk_image_url"`
}

func (*GCPConfig) Complete added in v0.1.2

func (c *GCPConfig) Complete() bool

func (*GCPConfig) Image added in v0.1.2

func (c *GCPConfig) Image() string

func (*GCPConfig) NewClient added in v0.1.2

func (c *GCPConfig) NewClient() (Client, error)

type MultiConfig added in v0.1.2

type MultiConfig struct {
	AWS   *AWSConfig   `yaml:"aws"`
	GCP   *GCPConfig   `yaml:"gcp"`
	Azure *AzureConfig `yaml:"azure"`
}

func (*MultiConfig) CompleteConfigs added in v0.1.2

func (c *MultiConfig) CompleteConfigs() []Config

func (*MultiConfig) Configs added in v0.1.2

func (c *MultiConfig) Configs() []Config

type VMInfo

type VMInfo struct {
	InstanceID       string
	InstanceType     string
	KeyName          string
	SubnetID         string
	SecurityGroupIDs []string
	PublicIP         string
}

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter
cmd
iaas
azure/azurefakes
This file was generated by counterfeiter
This file was generated by counterfeiter
gcp
gcp/gcpfakes
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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