cloudsetup

package
v0.0.0-...-ff61ee7 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllowPreemption     = false
	DefaultInstanceType = "n1-standard-2"
	TemplateName        = "base-cons-template"

	DefaultRegion     = "us-central1" // "us-east1"
	BaseInstanceName  = "cons-instance"
	InstanceGroupName = "cons-instance-group"
	DefaultZone       = "us-central1-a"
	InitInstance      = "initial-instance"
	Port              = config.RPCNodePort
	FirewallName      = "cons-firewall"
)
View Source
const (
	GlobalImageName = "projects/debian-cloud/global/images/family/debian-10"
	// GlobalImageName   = "projects/centos-cloud/global/images/family/centos-8"
	// initScriptName = "./scripts/imagesetuplocal.sh"
	ConsImageName = "cons-image"
)

Variables

View Source
var JsonPath = os.Getenv("OAUTHPATH")
View Source
var ProjectID = os.Getenv("PROJECTID")

Functions

func CreateInstanceTemplate

func CreateInstanceTemplate(templateName, imageName, instanceType, project string, service *compute.Service) (err error)

func DeleteImage

func DeleteImage(imageName, project, zone string, service *compute.Service) error

func DeleteInstanceTemplate

func DeleteInstanceTemplate(templateName, project string, service *compute.Service) (err error)

func DoAllFirewallRule

func DoAllFirewallRule(project string, service *compute.Service) (err error)

DoAddFirewallRule adds the cons firewall rule.

func DoDeleteDisk

func DoDeleteDisk(instanceName, project, zone string, service *compute.Service) (err error)

DoDeleteDisk deletes the given disk.

func DoGetInstanceIP

func DoGetInstanceIP(instanceName, imageName, instanceType, project, zone string, service *compute.Service) (err error)

DoGetInstanceIP gets the IP on an instance launched with DoLaunchInstance.

func DoInitialSetup

func DoInitialSetup(instanceName, instanceType, project, zone string, service *compute.Service) (err error)

DoInitialSetup creates an image and image template from the values.

func DoLaunchInstance

func DoLaunchInstance(instanceName, imageName, instanceType, project, zone string, service *compute.Service) (err error)

DoLaunchInstance launches an instance.

func DoRebootRegions

func DoRebootRegions(singleZone bool, instanceGroupName, project string, regions []string,
	service *compute.Service) (errs []error)

DoRebootRegions reboots the nodes from the instance groups.

func DoRemoveFirewallRule

func DoRemoveFirewallRule(project string, service *compute.Service) (err error)

DoRemoveFirewallRule removes the cons firewall rule.

func DoShutdownInstance

func DoShutdownInstance(instanceName, project, zone string, service *compute.Service) (err error)

DoLaunchInstance launches an instance.

func GetIPFromInstance

func GetIPFromInstance(inst *compute.Instance) string

func GetInstance

func GetInstance(name, imageName, instanceType, project, zone string, service *compute.Service) (*compute.Instance, error)

func GetInstanceGroupsIPs

func GetInstanceGroupsIPs(singleZone, onlyExternalIps bool, instanceGroupName, project string, regions []string,
	service *compute.Service) (ips []string, err error)

GetInstanceGroupIPs returns the list of ips for the regions, where each line rotates through the regions.

func LaunchCreateNode

func LaunchCreateNode(name, imageName, instanceType, project, zone string, service *compute.Service) (*compute.Instance, error)

func LaunchInstanceGroups

func LaunchInstanceGroups(singleZone bool, numNodes int, baseInstanceName, instanceGroupName,
	templateName, project string, regions []string,
	service *compute.Service) (err error)

func MakeImageFromInstance

func MakeImageFromInstance(imageName, instanceName, project, zone string, service *compute.Service) error

func ShutdownInstance

func ShutdownInstance(instanceName, project, zone string, service *compute.Service) error

func ShutdownInstanceGroups

func ShutdownInstanceGroups(singleZone bool, instanceGroupName, project string, regions []string, service *compute.Service) (ret []error)

func UndoInitialSetup

func UndoInitialSetup(project, zone string, service *compute.Service) (err error)

UndoInitialSetup removes the items created in the initial setup

func UpdateInstanceTemplateInstanceType

func UpdateInstanceTemplateInstanceType(newInstanceType, templateName, project string,
	service *compute.Service) error

func WaitRegionInstanceGroupDeleted

func WaitRegionInstanceGroupDeleted(singleZone bool, instanceGroupName, region, project string, service *compute.Service) error

func WaitRegionInstanceGroupStable

func WaitRegionInstanceGroupStable(singleZone bool, instanceGroupName, region, project string, service *compute.Service) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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