Documentation ¶
Index ¶
- Variables
- type GcpCloud
- func (c *GcpCloud) AddFirewall(publicIP, networkName, projectName, firewallName string, ports []string, ...) error
- func (c *GcpCloud) ChangeInstanceType(instanceID, zone, machineType string) error
- func (c *GcpCloud) CheckFirewallExists(firewallName string, checkMonitoring bool) (bool, error)
- func (c *GcpCloud) CheckNetworkExists(networkName string) (bool, error)
- func (c *GcpCloud) DestroyGCPNode(nodeConfig models.NodeConfig, clusterName string) error
- func (c *GcpCloud) GetInstancePublicIPs(zone string, nodeIDs []string) (map[string]string, error)
- func (c *GcpCloud) GetRandomZone(region string) (string, error)
- func (c *GcpCloud) GetRootVolumeID(instanceID string, zone string) (string, error)
- func (c *GcpCloud) GetUbuntuImageID() (string, error)
- func (c *GcpCloud) IsInstanceTypeSupported(machineType string, zone string) (bool, error)
- func (c *GcpCloud) ListRegions() []string
- func (c *GcpCloud) ListZonesInRegion(region string) ([]string, error)
- func (c *GcpCloud) ResizeVolume(volumeID string, zone string, newSizeGb int64) error
- func (c *GcpCloud) SetFirewallRule(ipAddress, firewallName, networkName string, ports []string) (*compute.Firewall, error)
- func (c *GcpCloud) SetPublicIP(zone, nodeName string, numNodes int) ([]string, error)
- func (c *GcpCloud) SetupInstances(...) ([]*compute.Instance, error)
- func (c *GcpCloud) SetupNetwork(ipAddress, networkName string) (*compute.Network, error)
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
ChangeInstanceType changes the instance type of the instance on-the-fly
func (*GcpCloud) CheckFirewallExists ¶
CheckFirewallExists checks that firewall firewallName exists in GCP project projectName
func (*GcpCloud) CheckNetworkExists ¶
CheckNetworkExists checks that network networkName exists in GCP project projectName
func (*GcpCloud) DestroyGCPNode ¶
func (c *GcpCloud) DestroyGCPNode(nodeConfig models.NodeConfig, clusterName string) error
DestroyGCPNode terminates GCP node in GCP
func (*GcpCloud) GetInstancePublicIPs ¶
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 ¶
GetRandomZone returns a random zone in the specified region.
func (*GcpCloud) GetRootVolumeID ¶
ListAttachedVolumes returns a list of attached volumes to the instance excluding the boot volume
func (*GcpCloud) GetUbuntuImageID ¶
func (*GcpCloud) IsInstanceTypeSupported ¶
IsInstanceTypeSupported checks if the machine type is supported in the zone
func (*GcpCloud) ListRegions ¶
ListRegions returns a list of regions for the GcpCloud instance.
func (*GcpCloud) ListZonesInRegion ¶
ListZonesInRegion returns a list of zones in a specific region for a given project ID.
func (*GcpCloud) ResizeVolume ¶
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 ¶
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 ¶
SetNetwork creates a new network in GCP