gcp

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNodeNotFoundToBeRunning = errors.New("node not found to be running")

Functions

This section is empty.

Types

type GcpCloud

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

func NewGcpCloud

func NewGcpCloud(gcpClient *compute.Service, projectID string, ctx context.Context) (*GcpCloud, error)

NewGcpCloud creates a GCP cloud

func (*GcpCloud) AddFirewall added in v1.3.7

func (c *GcpCloud) AddFirewall(publicIP, networkName, projectName, firewallName string, ports []string, checkMonitoring bool) error

AddFirewall adds firewall into an existing project in GCP

func (*GcpCloud) ChangeInstanceType added in v1.5.2

func (c *GcpCloud) ChangeInstanceType(instanceID, zone, machineType string) error

ChangeInstanceType changes the instance type of the instance on-the-fly

func (*GcpCloud) CheckFirewallExists

func (c *GcpCloud) CheckFirewallExists(firewallName string, checkMonitoring bool) (bool, error)

CheckFirewallExists checks that firewall firewallName exists in GCP project projectName

func (*GcpCloud) CheckNetworkExists

func (c *GcpCloud) CheckNetworkExists(networkName string) (bool, error)

CheckNetworkExists checks that network networkName exists in GCP project projectName

func (*GcpCloud) DestroyGCPNode added in v1.5.0

func (c *GcpCloud) DestroyGCPNode(nodeConfig models.NodeConfig, clusterName string) error

DestroyGCPNode terminates GCP node in GCP

func (*GcpCloud) GetInstancePublicIPs

func (c *GcpCloud) GetInstancePublicIPs(zone string, nodeIDs []string) (map[string]string, error)

GetInstancePublicIPs gets public IP(s) of GCP instance(s) without static IP and returns a map with gcp instance id as key and public ip as value

func (*GcpCloud) GetRandomZone added in v1.4.0

func (c *GcpCloud) GetRandomZone(region string) (string, error)

GetRandomZone returns a random zone in the specified region.

func (*GcpCloud) GetRootVolumeID added in v1.5.2

func (c *GcpCloud) GetRootVolumeID(instanceID string, zone string) (string, error)

ListAttachedVolumes returns a list of attached volumes to the instance excluding the boot volume

func (*GcpCloud) GetUbuntuImageID

func (c *GcpCloud) GetUbuntuImageID() (string, error)

func (*GcpCloud) IsInstanceTypeSupported added in v1.5.2

func (c *GcpCloud) IsInstanceTypeSupported(machineType string, zone string) (bool, error)

IsInstanceTypeSupported checks if the machine type is supported in the zone

func (*GcpCloud) ListRegions added in v1.4.0

func (c *GcpCloud) ListRegions() []string

ListRegions returns a list of regions for the GcpCloud instance.

func (*GcpCloud) ListZonesInRegion added in v1.4.0

func (c *GcpCloud) ListZonesInRegion(region string) ([]string, error)

ListZonesInRegion returns a list of zones in a specific region for a given project ID.

func (*GcpCloud) ResizeVolume added in v1.5.2

func (c *GcpCloud) ResizeVolume(volumeID string, zone string, newSizeGb int64) error

ResizeVolume resizes the volume to the new size

func (*GcpCloud) SetFirewallRule

func (c *GcpCloud) SetFirewallRule(ipAddress, firewallName, networkName string, ports []string) (*compute.Firewall, error)

SetFirewallRule creates a new firewall rule in GCP

func (*GcpCloud) SetPublicIP

func (c *GcpCloud) SetPublicIP(zone, nodeName string, numNodes int) ([]string, error)

SetPublicIP creates a static IP in GCP

func (*GcpCloud) SetupInstances

func (c *GcpCloud) SetupInstances(
	cliDefaultName,
	zone,
	networkName,
	sshPublicKey,
	ami,
	instancePrefix,
	instanceType string,
	staticIP []string,
	numNodes int,
	forMonitoring bool,
) ([]*compute.Instance, error)

SetupInstances creates GCP instances

func (*GcpCloud) SetupNetwork

func (c *GcpCloud) SetupNetwork(ipAddress, networkName string) (*compute.Network, error)

SetNetwork creates a new network in GCP

Jump to

Keyboard shortcuts

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