clusters

package
v0.29.3-dev Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPv4IPFamilyType      IPFamilyType = "ipv4"
	IPv6IPFamilyType      IPFamilyType = "ipv6"
	DualStackIPFamilyType IPFamilyType = "dual"

	Standard      VolumeType = "standard"
	SsdHiIops     VolumeType = "ssd_hiiops"
	SsdLowLatency VolumeType = "ssd_lowlatency"
	SsdLocal      VolumeType = "ssd_local"
	Cold          VolumeType = "cold"
	Ultra         VolumeType = "ultra"

	New       ClusterStatusType = "new"
	Active    ClusterStatusType = "active"
	Resizing  ClusterStatusType = "resizing"
	Suspended ClusterStatusType = "suspended"
	Deleting  ClusterStatusType = "deleting"
	Error     ClusterStatusType = "error"

	NewVolume VolumeSource = "new"
	Image     VolumeSource = "image"
	Snapshot  VolumeSource = "snapshot"

	External  InterfaceType = "external"
	Subnet    InterfaceType = "subnet"
	AnySubnet InterfaceType = "any_subnet"

	NewFloatingIP      FloatingIPSource = "new"
	ExistingFloatingIP FloatingIPSource = "existing"

	StartClusterAction      ClusterAction = "start"
	StopClusterAction       ClusterAction = "stop"
	HardRebootClusterAction ClusterAction = "hard_reboot"
	SoftRebootClusterAction ClusterAction = "soft_reboot"
	ResizeClusterAction     ClusterAction = "resize"
	UpdateTagsClusterAction ClusterAction = "update_tags"

	ManagedByK8s  ManagedByOpt = "k8s"
	ManagedByUser ManagedByOpt = "user"
)

Variables

This section is empty.

Functions

func ApplyAction added in v0.20.0

func ApplyAction(client *gcorecloud.ServiceClient, clusterID string, opts ClusterActionsOptsBuilder) (r tasks.Result)

func ClusterActionURL added in v0.20.0

func ClusterActionURL(c *gcorecloud.ServiceClient, clusterID string) string

ClusterActionURL returns URL for specific GPU cluster action operations

func ClusterURL

func ClusterURL(c *gcorecloud.ServiceClient, clusterID string) string

ClusterURL returns URL for specific GPU cluster operations

func ClustersURL

func ClustersURL(c *gcorecloud.ServiceClient) string

ClustersURL returns URL for GPU clusters operations

func Create

func Delete

func Delete(client *gcorecloud.ServiceClient, clusterID string, opts DeleteClusterOptsBuilder) (r tasks.Result)

Delete removes a specific GPU cluster by its ID.

func ExtractGPUClusterIDFromTask added in v0.20.0

func ExtractGPUClusterIDFromTask(task *tasks.Task) (string, error)

func FloatingIPSourceStringList

func FloatingIPSourceStringList() []string

func HardReboot added in v0.20.0

func HardReboot(client *gcorecloud.ServiceClient, clusterID string) (r tasks.Result)

func IPFamilyTypeListStringList

func IPFamilyTypeListStringList() []string

func InterfaceTypeStringList

func InterfaceTypeStringList() []string

func List added in v0.20.0

List retrieves list of GPU flavors

func RemoveAllTags added in v0.21.0

func RemoveAllTags(client *gcorecloud.ServiceClient, clusterID string) (r tasks.Result)

func RemoveTags added in v0.21.0

func RemoveTags(client *gcorecloud.ServiceClient, clusterID string, tags []string) (r tasks.Result)

func Resize added in v0.20.0

func Resize(client *gcorecloud.ServiceClient, clusterID string, serversCount int) (r tasks.Result)

func SoftReboot added in v0.20.0

func SoftReboot(client *gcorecloud.ServiceClient, clusterID string) (r tasks.Result)

func Start added in v0.20.0

func Start(client *gcorecloud.ServiceClient, clusterID string) (r tasks.Result)

func Stop added in v0.20.0

func Stop(client *gcorecloud.ServiceClient, clusterID string) (r tasks.Result)

func UpdateAndRemoveTags added in v0.21.0

func UpdateAndRemoveTags(client *gcorecloud.ServiceClient, clusterID string, tags map[string]*string) (r tasks.Result)

func UpdateTags added in v0.20.0

func UpdateTags(client *gcorecloud.ServiceClient, clusterID string, tags map[string]string) (r tasks.Result)

func VolumeSourcesStringList

func VolumeSourcesStringList() []string

func VolumeTypesStringList

func VolumeTypesStringList() []string

Types

type AnySubnetInterface

type AnySubnetInterface struct {
	NetworkID  string       `json:"network_id"`
	Name       *string      `json:"name"`
	Type       string       `json:"type"`
	IPFamily   IPFamilyType `json:"ip_family"`
	IPAddress  *string      `json:"ip_address"`
	FloatingIP *FloatingIP  `json:"floating_ip"`
}

type AnySubnetInterfaceOpts

type AnySubnetInterfaceOpts struct {
	NetworkID  string          `json:"network_id" validate:"required"`
	Name       *string         `json:"name,omitempty"`
	Type       string          `json:"type" validate:"required"`
	IPFamily   IPFamilyType    `json:"ip_family,omitempty"`
	IPAddress  *string         `json:"ip_address,omitempty"`
	FloatingIP *FloatingIPOpts `json:"floating_ip,omitempty"`
}

type BaremetalServerSettingsOpts added in v0.25.0

type BaremetalServerSettingsOpts struct {
	Interfaces     []InterfaceOpts        `json:"interfaces"`
	SecurityGroups []gcorecloud.ItemID    `json:"security_groups" validate:"omitempty,dive,uuid4"`
	UserData       *string                `json:"user_data,omitempty"`
	Credentials    *ServerCredentialsOpts `json:"credentials,omitempty"`
}

type Cluster

type Cluster struct {
	ID              string                   `json:"id"`
	Name            string                   `json:"name"`
	Status          ClusterStatusType        `json:"status"`
	Flavor          string                   `json:"flavor"`
	Tags            []Tag                    `json:"tags"`
	ServersCount    int                      `json:"servers_count"`
	CreatedAt       gcorecloud.JSONRFC3339Z  `json:"created_at"`
	UpdatedAt       *gcorecloud.JSONRFC3339Z `json:"updated_at"`
	ServersIDs      *[]string                `json:"servers_ids"`
	ServersSettings ClusterServerSettings    `json:"servers_settings"`
}

func ExtractClusters added in v0.20.0

func ExtractClusters(r pagination.Page) ([]Cluster, error)

ExtractClusters accepts a Page struct, specifically a ClusterPage struct, and extracts the elements into a slice of cluster structs. In other words, a generic collection is mapped into a relevant slice.

func ListAll added in v0.20.0

func ListAll(client *gcorecloud.ServiceClient, opts ListClustersOptsBuilder) ([]Cluster, error)

ListAll retrieves all GPU clusters, using the provided ListClustersOptsBuilder to filter results.

type ClusterAction added in v0.20.0

type ClusterAction string

func (ClusterAction) IsValid added in v0.20.0

func (ca ClusterAction) IsValid() error

func (ClusterAction) List added in v0.20.0

func (ca ClusterAction) List() []ClusterAction

func (*ClusterAction) MarshalJSON added in v0.20.0

func (ca *ClusterAction) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaler interface

func (ClusterAction) String added in v0.20.0

func (ca ClusterAction) String() string

func (ClusterAction) StringList added in v0.20.0

func (ca ClusterAction) StringList() []string

func (*ClusterAction) UnmarshalJSON added in v0.20.0

func (ca *ClusterAction) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface

func (ClusterAction) ValidOrNil added in v0.20.0

func (ca ClusterAction) ValidOrNil() (*ClusterAction, error)

type ClusterActionsOpts added in v0.20.0

type ClusterActionsOpts struct {
	Action       ClusterAction      `json:"action" required:"true" validate:"required,enum"`
	ServersCount int                `json:"servers_count,omitempty" validate:"rfe=Action:resize,gt=-1"`
	UpdateTags   map[string]*string `json:"tags"`
}

ClusterActionsOpts allows extensions to add parameters to cluster actions.

func (ClusterActionsOpts) ToClusterActionsMap added in v0.20.0

func (opts ClusterActionsOpts) ToClusterActionsMap() (map[string]interface{}, error)

ToClusterActionsMap builds a request body from ClusterActionsOpts.

func (ClusterActionsOpts) Validate added in v0.20.0

func (opts ClusterActionsOpts) Validate() error

Validate checks if the provided options are valid.

type ClusterActionsOptsBuilder added in v0.20.0

type ClusterActionsOptsBuilder interface {
	ToClusterActionsMap() (map[string]interface{}, error)
}

ClusterActionsOptsBuilder allows extensions to add additional parameters to cluster actions.

type ClusterPage added in v0.20.0

type ClusterPage struct {
	pagination.OffsetPageBase
}

ClusterPage is the page returned by a pager when traversing over a collection of clusters.

func (ClusterPage) IsEmpty added in v0.20.0

func (r ClusterPage) IsEmpty() (bool, error)

IsEmpty checks whether a ClusterPage struct is empty.

type ClusterServerSettings

type ClusterServerSettings struct {
	Interfaces     []InterfaceUnion        `json:"interfaces"`
	SecurityGroups []gcorecloud.ItemIDName `json:"security_groups"`
	Volumes        []Volume                `json:"volumes"`
	UserData       *string                 `json:"user_data"`
	SSHKeyName     *string                 `json:"ssh_key_name"`
}

type ClusterStatusType

type ClusterStatusType string

func (*ClusterStatusType) IsValid

func (ct *ClusterStatusType) IsValid() error

func (*ClusterStatusType) List

func (ct *ClusterStatusType) List() []ClusterStatusType

func (*ClusterStatusType) MarshalJSON

func (ct *ClusterStatusType) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaller interface

func (*ClusterStatusType) String

func (ct *ClusterStatusType) String() string

func (*ClusterStatusType) StringList

func (ct *ClusterStatusType) StringList() []string

func (*ClusterStatusType) UnmarshalJSON

func (ct *ClusterStatusType) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface

func (*ClusterStatusType) ValidOrNil

func (ct *ClusterStatusType) ValidOrNil() (*ClusterStatusType, error)

type ClusterTaskResult added in v0.20.0

type ClusterTaskResult struct {
	ClusterID string `mapstructure:"cluster_id"`
}

type CreateBaremetalClusterOpts added in v0.25.0

type CreateBaremetalClusterOpts struct {
	Name            string                      `json:"name" validate:"required"`
	Flavor          string                      `json:"flavor" validate:"required"`
	ImageID         string                      `json:"image_id" validate:"required"`
	Tags            map[string]string           `json:"tags,omitempty"`
	ServersCount    int                         `json:"servers_count" validate:"required"`
	ServersSettings BaremetalServerSettingsOpts `json:"servers_settings,omitempty"`
}

CreateBaremetalClusterOpts allows extensions to add parameters to create baremetal cluster options.

func (CreateBaremetalClusterOpts) ToCreateClusterMap added in v0.25.0

func (opts CreateBaremetalClusterOpts) ToCreateClusterMap() (map[string]interface{}, error)

ToCreateClusterMap builds a request body from CreateBaremetalClusterOpts.

func (CreateBaremetalClusterOpts) Validate added in v0.25.0

func (opts CreateBaremetalClusterOpts) Validate() error

Validate checks if the provided options are valid.

type CreateClusterOpts

type CreateClusterOpts struct {
	Name            string             `json:"name" validate:"required"`
	Flavor          string             `json:"flavor" validate:"required"`
	Tags            map[string]string  `json:"tags,omitempty"`
	ServersCount    int                `json:"servers_count" validate:"required"`
	ServersSettings ServerSettingsOpts `json:"servers_settings,omitempty"`
}

CreateClusterOpts allows extensions to add parameters to create cluster options.

func (CreateClusterOpts) ToCreateClusterMap

func (opts CreateClusterOpts) ToCreateClusterMap() (map[string]interface{}, error)

func (CreateClusterOpts) Validate

func (opts CreateClusterOpts) Validate() error

Validate checks if the provided options are valid.

type CreateClusterOptsBuilder

type CreateClusterOptsBuilder interface {
	ToCreateClusterMap() (map[string]interface{}, error)
}

CreateClusterOptsBuilder allows extensions to add additional parameters to the Create request.

type DeleteClusterOpts added in v0.20.0

type DeleteClusterOpts struct {
	AllFloatingIPs      bool     `q:"all_floating_ips" validate:"omitempty,allowed_without=FloatingIPIDs"`
	AllReservedFixedIPs bool     `q:"all_reserved_fixed_ips" validate:"omitempty,allowed_without=ReservedFixedIPIDs"`
	AllVolumes          bool     `q:"all_volumes" validate:"omitempty,allowed_without=VolumeIDs"`
	FloatingIPIDs       []string `q:"floating_ip_ids" validate:"omitempty,allowed_without=AllFloatingIPs,dive,uuid4" delimiter:"comma"`
	ReservedFixedIPIDs  []string `q:"reserved_fixed_ip_ids" validate:"omitempty,allowed_without=AllReservedFixedIPs,dive,uuid4" delimiter:"comma"`
	VolumeIDs           []string `q:"volume_ids" validate:"omitempty,allowed_without=AllVolumes,dive,uuid4" delimiter:"comma"`
}

DeleteClusterOpts specifies the parameters for the Delete method.

func (DeleteClusterOpts) ToClusterDeleteQuery added in v0.20.0

func (opts DeleteClusterOpts) ToClusterDeleteQuery() (string, error)

ToDeleteClusterActionMap builds a request body from DeleteInstanceOpts.

func (DeleteClusterOpts) Validate added in v0.20.0

func (opts DeleteClusterOpts) Validate() error

Validate checks if the provided options are valid.

type DeleteClusterOptsBuilder added in v0.20.0

type DeleteClusterOptsBuilder interface {
	ToClusterDeleteQuery() (string, error)
}

DeleteClusterOptsBuilder allows extensions to add parameters to delete cluster options.

type ExternalInterface

type ExternalInterface struct {
	Name     *string      `json:"name"`
	Type     string       `json:"type"`
	IPFamily IPFamilyType `json:"ip_family"`
}

type ExternalInterfaceOpts

type ExternalInterfaceOpts struct {
	Name     *string      `json:"name,omitempty"`
	Type     string       `json:"type" validate:"required"`
	IPFamily IPFamilyType `json:"ip_family,omitempty"`
}

type FloatingIP

type FloatingIP struct {
	Source string `json:"source"`
}

type FloatingIPOpts

type FloatingIPOpts struct {
	Source string `json:"source" validate:"required,enum"`
}

type FloatingIPSource

type FloatingIPSource string

func FloatingIPSourceList

func FloatingIPSourceList() []FloatingIPSource

func (*FloatingIPSource) String

func (fis *FloatingIPSource) String() string

type GetResult

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

GetResult represents the result of a get operation. Call its Extract method to interpret it as a Image.

func Get

func Get(client *gcorecloud.ServiceClient, clusterID string) (r GetResult)

Get retrieves a specific GPU cluster by its ID.

func Rename

func Rename(client *gcorecloud.ServiceClient, clusterID string, opts RenameClusterOptsBuilder) (r GetResult)

Rename changes the name of a GPU cluster.

func (GetResult) Extract

func (r GetResult) Extract() (*Cluster, error)

Extract is a function that accepts a result and extracts a cluster resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type IPFamilyType

type IPFamilyType string

func IPFamilyTypeList

func IPFamilyTypeList() []IPFamilyType

func (*IPFamilyType) IsValid

func (it *IPFamilyType) IsValid() error

func (*IPFamilyType) MarshalJSON

func (it *IPFamilyType) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaller interface

func (*IPFamilyType) String

func (it *IPFamilyType) String() string

func (*IPFamilyType) UnmarshalJSON

func (it *IPFamilyType) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface

func (*IPFamilyType) ValidOrNil

func (it *IPFamilyType) ValidOrNil() (*IPFamilyType, error)

type InterfaceOpts

type InterfaceOpts interface {
	// contains filtered or unexported methods
}

type InterfaceType

type InterfaceType string

func InterfaceTypeList

func InterfaceTypeList() []InterfaceType

func (*InterfaceType) String

func (it *InterfaceType) String() string

type InterfaceUnion

type InterfaceUnion struct {
	ExternalInterface  *ExternalInterface
	SubnetInterface    *SubnetInterface
	AnySubnetInterface *AnySubnetInterface
}

func (*InterfaceUnion) ExtractInterfaceType

func (i *InterfaceUnion) ExtractInterfaceType(data []byte) (string, error)

ExtractInterfaceType extracts the interface type from the data, returning the type if it is valid. If the type is not valid, an error is returned. If the type is not found, an error is returned.

func (*InterfaceUnion) InterfaceType

func (i *InterfaceUnion) InterfaceType() string

func (*InterfaceUnion) MarshalJSON

func (i *InterfaceUnion) MarshalJSON() ([]byte, error)

func (*InterfaceUnion) UnmarshalJSON

func (i *InterfaceUnion) UnmarshalJSON(data []byte) error

type ListClustersOptsBuilder added in v0.20.0

type ListClustersOptsBuilder interface {
	ToListClustersQuery() (string, error)
}

ListClustersOptsBuilder allows extensions to add additional parameters to the List request.

type ListOpts added in v0.20.0

type ListOpts struct {
	Limit     int          `q:"limit" validate:"omitempty,gt=0"`
	Offset    int          `q:"offset" validate:"omitempty,gte=0"`
	ManagedBy ManagedByOpt `q:"managed_by" validate:"omitempty,oneof=k8s user"`
}

ListOpts allows the filtering and sorting of paginated collections through the API.

func (ListOpts) ToListClustersQuery added in v0.20.0

func (opts ListOpts) ToListClustersQuery() (string, error)

ToListClustersQuery formats a ListOpts into a query string.

type ManagedByOpt added in v0.24.1

type ManagedByOpt string

type RenameClusterOpts

type RenameClusterOpts struct {
	Name string `json:"name" validate:"required"`
}

RenameClusterOpts specifies the parameters for the Rename method.

func (RenameClusterOpts) ToRenameClusterActionMap

func (opts RenameClusterOpts) ToRenameClusterActionMap() (map[string]interface{}, error)

ToRenameClusterActionMap builds a request body from RenameInstanceOpts.

func (RenameClusterOpts) Validate

func (opts RenameClusterOpts) Validate() error

Validate checks if the provided options are valid.

type RenameClusterOptsBuilder

type RenameClusterOptsBuilder interface {
	ToRenameClusterActionMap() (map[string]interface{}, error)
}

RenameClusterOptsBuilder allows extensions to add parameters to rename cluster options.

type ServerCredentialsOpts

type ServerCredentialsOpts struct {
	Username   string `json:"username,omitempty"`
	Password   string `json:"password,omitempty"`
	SSHKeyName string `json:"ssh_key_name,omitempty"`
}

type ServerSettingsOpts

type ServerSettingsOpts struct {
	Interfaces     []InterfaceOpts        `json:"interfaces"`
	SecurityGroups []gcorecloud.ItemID    `json:"security_groups" validate:"omitempty,dive,uuid4"`
	Volumes        []VolumeOpts           `json:"volumes"`
	UserData       *string                `json:"user_data,omitempty"`
	Credentials    *ServerCredentialsOpts `json:"credentials,omitempty"`
}

type SubnetInterface

type SubnetInterface struct {
	NetworkID  string      `json:"network_id"`
	Name       *string     `json:"name"`
	Type       string      `json:"type"`
	SubnetID   string      `json:"subnet_id"`
	FloatingIP *FloatingIP `json:"floating_ip"`
}

type SubnetInterfaceOpts

type SubnetInterfaceOpts struct {
	NetworkID  string          `json:"network_id" validate:"required"`
	Name       *string         `json:"name,omitempty"`
	Type       string          `json:"type" validate:"required"`
	SubnetID   string          `json:"subnet_id" validate:"required"`
	FloatingIP *FloatingIPOpts `json:"floating_ip,omitempty"`
}

type Tag added in v0.20.0

type Tag struct {
	Key      string `json:"key"`
	Value    string `json:"value"`
	ReadOnly bool   `json:"read_only"`
}

Tag represents a key-value pair used to tag resources like clusters, servers, volumes, etc. Some tags are read-only and cannot be modified by the user.

type Volume

type Volume struct {
	Size                int        `json:"size"`
	Type                VolumeType `json:"type"`
	DeleteOnTermination bool       `json:"delete_on_termination"`
	Tags                []Tag      `json:"tags"`
	Name                *string    `json:"name"`
	BootIndex           *int       `json:"boot_index"`
	ImageID             *string    `json:"image_id"`
	SnapshotID          *string    `json:"snapshot_id"`
}

Volume represents a volume structure.

type VolumeOpts

type VolumeOpts struct {
	Source              VolumeSource      `json:"source" validate:"required,enum"`
	BootIndex           int               `json:"boot_index" validate:"required"`
	DeleteOnTermination bool              `json:"delete_on_termination,omitempty"`
	Name                string            `json:"name" validate:"required"`
	Size                int               `json:"size,omitempty" validate:"required"`
	ImageID             string            `json:"image_id,omitempty" validate:"rfe=Source:image,allowed_without=SnapshotID,omitempty,uuid4"`
	SnapshotID          string            `json:"snapshot_id,omitempty" validate:"rfe=Source:snapshot,allowed_without=ImageID,omitempty,uuid4"`
	Tags                map[string]string `json:"tags,omitempty"`
	Type                VolumeType        `json:"type,omitempty" validate:"required,enum"`
}

VolumeOpts represents options used to create a volume.

type VolumeSource

type VolumeSource string

func VolumeSourcesList

func VolumeSourcesList() []VolumeSource

func (*VolumeSource) String

func (vs *VolumeSource) String() string

type VolumeType

type VolumeType string

func VolumeTypesList

func VolumeTypesList() []VolumeType

func (*VolumeType) IsValid

func (vt *VolumeType) IsValid() error

func (*VolumeType) MarshalJSON

func (vt *VolumeType) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaller interface

func (*VolumeType) String

func (vt *VolumeType) String() string

func (*VolumeType) UnmarshalJSON

func (vt *VolumeType) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface

func (*VolumeType) ValidOrNil

func (vt *VolumeType) ValidOrNil() (*VolumeType, error)

Jump to

Keyboard shortcuts

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