clusters

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CalicoProvider    CNIProvider     = "calico"
	CiliumProvider    CNIProvider     = "cilium"
	VXLANTunnel       TunnelType      = "vxlan"
	GeneveTunnel      TunnelType      = "geneve"
	EmptyTunnel       TunnelType      = ""
	SNATLBMode        LBModeType      = "snat"
	DSRLBMode         LBModeType      = "dsr"
	HybridLBMode      LBModeType      = "hybrid"
	NativeRoutingMode RoutingModeType = "native"
	TunnelRoutingMode RoutingModeType = "tunnel"
)

Variables

This section is empty.

Functions

func CheckLimits added in v0.7.16

CheckLimits checks quota limits for the values provided and returns the diff for exceeded quota.

func CheckLimitsPool added in v0.29.1

CheckLimitsPool checks quota limits for the values provided and returns the diff for exceeded quota.

func Create

Create accepts a CreateOpts struct and creates a new cluster using the values provided.

func CreateVersions added in v0.8.11

func CreateVersions(c *gcorecloud.ServiceClient) pagination.Pager

CreateVersions returns a Pager which allows you to iterate over a collection of supported k8s versions for cluster creation.

func Delete

func Delete(c *gcorecloud.ServiceClient, clusterName string) (r tasks.Result)

Delete accepts cluster name and deletes the cluster associated with it.

func ExtractClustersInto

func ExtractClustersInto(r pagination.Page, v interface{}) error

func ExtractVersionInto

func ExtractVersionInto(r pagination.Page, v interface{}) error

func List

List returns a Pager which allows you to iterate over a collection of clusters.

func ListInstances

func ListInstances(c *gcorecloud.ServiceClient, clusterID string) pagination.Pager

ListInstances returns a Pager which allows you to iterate over a collection of cluster instances.

func ListInstancesAll

func ListInstancesAll(c *gcorecloud.ServiceClient, clusterID string) ([]instances.Instance, error)

ListInstancesAll is a convenience function that returns all cluster instances.

func Update added in v0.7.17

func Update(c *gcorecloud.ServiceClient, clusterID string, opts UpdateOptsBuilder) (r tasks.Result)

Update accepts a UpdateOpts struct and updates an existing cluster using the values provided.

func Upgrade

func Upgrade(c *gcorecloud.ServiceClient, clusterID string, opts UpgradeOptsBuilder) (r tasks.Result)

Upgrade accepts a UpgradeOpts struct and upgrades an existing cluster using the values provided.

func UpgradeVersions added in v0.8.11

func UpgradeVersions(c *gcorecloud.ServiceClient, clusterID string) pagination.Pager

UpgradeVersions returns a Pager which allows you to iterate over a collection of supported k8s versions for cluster upgrade.

Types

type Authentication added in v0.7.17

type Authentication struct {
	OIDC *OIDC `json:"oidc,omitempty"`
}

type AuthenticationCreateOpts added in v0.7.17

type AuthenticationCreateOpts struct {
	OIDC *OIDCCreateOpts `json:"oidc,omitempty" validate:"omitempty"`
}

type AuthenticationUpdateOpts added in v0.7.17

type AuthenticationUpdateOpts = AuthenticationCreateOpts

type CNI added in v0.6.33

type CNI struct {
	Provider CNIProvider `json:"provider"`
	Cilium   *Cilium     `json:"cilium,omitempty"`
}

type CNICreateOpts added in v0.6.33

type CNICreateOpts struct {
	Provider CNIProvider       `json:"provider" required:"true" validate:"required"`
	Cilium   *CiliumCreateOpts `json:"cilium,omitempty"`
}

type CNIProvider added in v0.6.33

type CNIProvider string

func (CNIProvider) IsValid added in v0.6.33

func (cn CNIProvider) IsValid() error

func (CNIProvider) List added in v0.6.33

func (cn CNIProvider) List() []CNIProvider

func (*CNIProvider) MarshalJSON added in v0.6.33

func (cn *CNIProvider) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaler interface for CNIProvider

func (CNIProvider) String added in v0.6.33

func (cn CNIProvider) String() string

func (CNIProvider) StringList added in v0.6.33

func (cn CNIProvider) StringList() []string

func (*CNIProvider) UnmarshalJSON added in v0.6.33

func (cn *CNIProvider) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface for CNIProvider

func (CNIProvider) ValidOrNil added in v0.6.33

func (cn CNIProvider) ValidOrNil() (*CNIProvider, error)

type CSI added in v0.20.0

type CSI struct {
	NFS *NFS `json:"nfs,omitempty"`
}

type CSICreateOpts added in v0.20.0

type CSICreateOpts struct {
	NFS *NFSCreateOpts `json:"nfs,omitempty" validate:"omitempty,dive"`
}

type Certificate

type Certificate struct {
	Key         string `json:"key"`
	Certificate string `json:"certificate"`
}

Certificate represents a cluster CA certificate.

type CertificateResult

type CertificateResult struct {
	gcorecloud.Result
}

CertificateResult represents the result of a get certificate operation. Call its Extract method to interpret it as a Certificate.

func GetCertificate

func GetCertificate(c *gcorecloud.ServiceClient, clusterName string) (r CertificateResult)

GetCertificate accepts cluster name and returns the cluster CA certificate.

func (CertificateResult) Extract

func (r CertificateResult) Extract() (*Certificate, error)

Extract is a function that accepts a result and extracts a cluster CA certificate.

type CheckLimitsOpts added in v0.7.16

type CheckLimitsOpts struct {
	Pools []CheckLimitsPoolOpts `json:"pools,omitempty"`
}

func (CheckLimitsOpts) ToCheckLimitsMap added in v0.7.16

func (opts CheckLimitsOpts) ToCheckLimitsMap() (map[string]interface{}, error)

ToCheckLimitsMap builds a request body from CheckLimitsOpts.

type CheckLimitsOptsBuilder added in v0.7.16

type CheckLimitsOptsBuilder interface {
	ToCheckLimitsMap() (map[string]interface{}, error)
}

type CheckLimitsPoolOpts added in v0.7.16

type CheckLimitsPoolOpts struct {
	Name              string                         `json:"name,omitempty" validate:"omitempty"`
	FlavorID          string                         `json:"flavor_id" required:"true" validate:"required"`
	MinNodeCount      int                            `json:"min_node_count,omitempty" validate:"omitempty,gt=0,ltefield=MaxNodeCount"`
	MaxNodeCount      int                            `json:"max_node_count,omitempty" validate:"omitempty,gt=0,gtefield=MinNodeCount"`
	NodeCount         int                            `json:"node_count,omitempty" validate:"omitempty"`
	BootVolumeSize    int                            `json:"boot_volume_size,omitempty" validate:"omitempty,gt=0"`
	ServerGroupPolicy servergroups.ServerGroupPolicy `json:"servergroup_policy,omitempty" validate:"omitempty,enum"`
}

func (CheckLimitsPoolOpts) ToCheckLimitsPoolMap added in v0.29.1

func (opts CheckLimitsPoolOpts) ToCheckLimitsPoolMap() (map[string]interface{}, error)

ToCheckLimitsPoolMap builds a request body from CheckLimitsPoolOpts.

type CheckLimitsPoolOptsBuilder added in v0.29.1

type CheckLimitsPoolOptsBuilder interface {
	ToCheckLimitsPoolMap() (map[string]interface{}, error)
}

type Cilium added in v0.6.33

type Cilium struct {
	MaskSize                 int             `json:"mask_size,omitempty"`
	MaskSizeV6               int             `json:"mask_size_v6,omitempty"`
	Tunnel                   TunnelType      `json:"tunnel,omitempty"`
	Encryption               bool            `json:"encryption"`
	LoadBalancerMode         LBModeType      `json:"lb_mode,omitempty"`
	LoadBalancerAcceleration bool            `json:"lb_acceleration"`
	RoutingMode              RoutingModeType `json:"routing_mode,omitempty"`
	HubbleRelay              bool            `json:"hubble_relay"`
	HubbleUI                 bool            `json:"hubble_ui"`
}

type CiliumCreateOpts added in v0.6.33

type CiliumCreateOpts struct {
	MaskSize                 int             `json:"mask_size,omitempty"`
	MaskSizeV6               int             `json:"mask_size_v6,omitempty"`
	Tunnel                   TunnelType      `json:"tunnel"`
	Encryption               bool            `json:"encryption"`
	LoadBalancerMode         LBModeType      `json:"lb_mode,omitempty"`
	LoadBalancerAcceleration bool            `json:"lb_acceleration"`
	RoutingMode              RoutingModeType `json:"routing_mode,omitempty"`
	HubbleRelay              bool            `json:"hubble_relay"`
	HubbleUI                 bool            `json:"hubble_ui"`
}

type Cluster

type Cluster struct {
	ID               string              `json:"id"`
	Name             string              `json:"name"`
	KeyPair          string              `json:"keypair"`
	NodeCount        int                 `json:"node_count"`
	FlavorID         string              `json:"flavor_id"`
	Status           string              `json:"status"`
	Pools            []pools.ClusterPool `json:"pools"`
	Version          string              `json:"version"`
	IsPublic         bool                `json:"is_public"`
	Authentication   *Authentication     `json:"authentication,omitempty"`
	AutoscalerConfig map[string]string   `json:"autoscaler_config,omitempty"`
	CNI              *CNI                `json:"cni,omitempty"`
	CSI              *CSI                `json:"csi,omitempty"`
	FixedNetwork     string              `json:"fixed_network"`
	FixedSubnet      string              `json:"fixed_subnet"`
	PodsIPPool       *gcorecloud.CIDR    `json:"pods_ip_pool,omitempty" validate:"omitempty,cidr"`
	ServicesIPPool   *gcorecloud.CIDR    `json:"services_ip_pool,omitempty" validate:"omitempty,cidr"`
	PodsIPV6Pool     *gcorecloud.CIDR    `json:"pods_ipv6_pool,omitempty" validate:"omitempty,cidr"`
	ServicesIPV6Pool *gcorecloud.CIDR    `json:"services_ipv6_pool,omitempty" validate:"omitempty,cidr"`
	IsIPV6           bool                `json:"is_ipv6,omitempty"`
	CreatedAt        time.Time           `json:"created_at"`
	CreatorTaskID    string              `json:"creator_task_id"`
	DDoSProfile      *DDoSProfile        `json:"ddos_profile,omitempty"`
	TaskID           string              `json:"task_id"`
	ProjectID        int                 `json:"project_id"`
	RegionID         int                 `json:"region_id"`
	Region           string              `json:"region"`
}

Cluster represents a cluster structure.

func ExtractClusters

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

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

func ListAll

func ListAll(c *gcorecloud.ServiceClient) ([]Cluster, error)

ListALL is a convenience function that returns all clusters.

type ClusterPage

type ClusterPage struct {
	pagination.LinkedPageBase
}

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

func (ClusterPage) IsEmpty

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

IsEmpty checks whether a ClusterPage struct is empty.

func (ClusterPage) NextPageURL

func (r ClusterPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of clusters has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type Config

type Config struct {
	Config string `json:"config"`

	Host                 string `json:"host"`
	ClusterCACertificate string `json:"cluster_ca_certificate"`
	ClientCertificate    string `json:"client_certificate"`
	ClientKey            string `json:"client_key"`
}

Config represents a kubeconfig structure.

type ConfigResult

type ConfigResult struct {
	gcorecloud.Result
}

ConfigResult represents the result of a get config operation. Call its Extract method to interpret it as a Config.

func GetConfig

func GetConfig(c *gcorecloud.ServiceClient, clusterName string) (r ConfigResult)

GetConfig accepts cluster name and returns the cluster kubeconfig.

func (ConfigResult) Extract

func (r ConfigResult) Extract() (*Config, error)

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

type CreateOpts

type CreateOpts struct {
	Name             string                    `json:"name" required:"true" validate:"required,gt=0,lte=20"`
	Authentication   *AuthenticationCreateOpts `json:"authentication,omitempty" validate:"omitempty"`
	AutoscalerConfig map[string]string         `json:"autoscaler_config,omitempty" validate:"omitempty"`
	CNI              *CNICreateOpts            `json:"cni,omitempty" validate:"omitempty,dive"`
	CSI              *CSICreateOpts            `json:"csi,omitempty" validate:"omitempty,dive"`
	DDoSProfile      *DDoSProfileCreateOpts    `json:"ddos_profile,omitempty" validate:"omitempty"`
	FixedNetwork     string                    `json:"fixed_network" validate:"omitempty,uuid4"`
	FixedSubnet      string                    `json:"fixed_subnet" validate:"omitempty,uuid4"`
	PodsIPPool       *gcorecloud.CIDR          `json:"pods_ip_pool,omitempty" validate:"omitempty,cidr"`
	ServicesIPPool   *gcorecloud.CIDR          `json:"services_ip_pool,omitempty" validate:"omitempty,cidr"`
	PodsIPV6Pool     *gcorecloud.CIDR          `json:"pods_ipv6_pool,omitempty" validate:"omitempty,cidr"`
	ServicesIPV6Pool *gcorecloud.CIDR          `json:"services_ipv6_pool,omitempty" validate:"omitempty,cidr"`
	KeyPair          string                    `json:"keypair" required:"true" validate:"required"`
	Version          string                    `json:"version" required:"true" validate:"required"`
	IsIPV6           bool                      `json:"is_ipv6,omitempty"`
	Pools            []pools.CreateOpts        `json:"pools" required:"true" validate:"required,min=1,dive"`
}

CreateOpts represents options used to create a cluster.

func (CreateOpts) ToClusterCreateMap

func (opts CreateOpts) ToClusterCreateMap() (map[string]interface{}, error)

ToClusterCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToClusterCreateMap() (map[string]interface{}, error)
}

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

type DDoSProfile added in v0.19.0

type DDoSProfile struct {
	Enabled             bool               `json:"enabled,omitempty"`
	Fields              []DDoSProfileField `json:"fields,omitempty"`
	ProfileTemplate     *int               `json:"profile_template,omitempty"`
	ProfileTemplateName *string            `json:"profile_template_name,omitempty"`
}

type DDoSProfileCreateOpts added in v0.19.0

type DDoSProfileCreateOpts struct {
	Enabled             bool               `json:"enabled"`
	Fields              []DDoSProfileField `json:"fields,omitempty"`
	ProfileTemplate     *int               `json:"profile_template,omitempty"`
	ProfileTemplateName *string            `json:"profile_template_name,omitempty"`
}

type DDoSProfileField added in v0.19.0

type DDoSProfileField struct {
	BaseField  int     `json:"base_field" required:"true" validate:"required"`
	FieldValue any     `json:"field_value,omitempty"`
	Value      *string `json:"value,omitempty" validate:"omitempty"`
}

func (DDoSProfileField) Validate added in v0.19.0

func (f DDoSProfileField) Validate() error

Validate ensures that only one of FieldValue or Value is specified.

type DDoSProfileUpdateOpts added in v0.19.0

type DDoSProfileUpdateOpts = DDoSProfileCreateOpts

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 Cluster.

func Get

func Get(c *gcorecloud.ServiceClient, clusterName string) (r GetResult)

Get retrieves a specific cluster based on its name.

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 LBModeType added in v0.6.33

type LBModeType string

func (LBModeType) IsValid added in v0.6.33

func (t LBModeType) IsValid() error

func (LBModeType) List added in v0.6.33

func (t LBModeType) List() []LBModeType

func (*LBModeType) MarshalJSON added in v0.6.33

func (t *LBModeType) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaler interface for LBModeType

func (LBModeType) String added in v0.6.33

func (t LBModeType) String() string

func (LBModeType) StringList added in v0.6.33

func (t LBModeType) StringList() []string

func (*LBModeType) UnmarshalJSON added in v0.6.33

func (t *LBModeType) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface for LBModeType

func (LBModeType) ValidOrNil added in v0.6.33

func (t LBModeType) ValidOrNil() (*LBModeType, error)

type NFS added in v0.20.0

type NFS struct {
	VASTEnabled bool `json:"vast_enabled"`
}

type NFSCreateOpts added in v0.20.0

type NFSCreateOpts struct {
	VASTEnabled bool `json:"vast_enabled"`
}

type OIDC added in v0.7.17

type OIDC struct {
	ClientID       string            `json:"client_id,omitempty"`
	GroupsClaim    string            `json:"groups_claim,omitempty"`
	GroupsPrefix   string            `json:"groups_prefix,omitempty"`
	IssuerURL      string            `json:"issuer_url,omitempty"`
	RequiredClaims map[string]string `json:"required_claims,omitempty"`
	SigningAlgs    []string          `json:"signing_algs,omitempty"`
	UsernameClaim  string            `json:"username_claim,omitempty"`
	UsernamePrefix string            `json:"username_prefix,omitempty"`
}

type OIDCCreateOpts added in v0.7.17

type OIDCCreateOpts struct {
	ClientID       string            `json:"client_id,omitempty" validate:"omitempty"`
	GroupsClaim    string            `json:"groups_claim,omitempty" validate:"omitempty"`
	GroupsPrefix   string            `json:"groups_prefix,omitempty" validate:"omitempty"`
	IssuerURL      string            `json:"issuer_url,omitempty" validate:"omitempty"`
	RequiredClaims map[string]string `json:"required_claims,omitempty" validate:"omitempty"`
	SigningAlgs    []string          `json:"signing_algs,omitempty" validate:"omitempty"`
	UsernameClaim  string            `json:"username_claim,omitempty" validate:"omitempty"`
	UsernamePrefix string            `json:"username_prefix,omitempty" validate:"omitempty"`
}

type RoutingModeType added in v0.6.33

type RoutingModeType string

func (RoutingModeType) IsValid added in v0.6.33

func (t RoutingModeType) IsValid() error

func (RoutingModeType) List added in v0.6.33

func (t RoutingModeType) List() []RoutingModeType

func (*RoutingModeType) MarshalJSON added in v0.6.33

func (t *RoutingModeType) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaler interface for RoutingModeType

func (RoutingModeType) String added in v0.6.33

func (t RoutingModeType) String() string

func (RoutingModeType) StringList added in v0.6.33

func (t RoutingModeType) StringList() []string

func (*RoutingModeType) UnmarshalJSON added in v0.6.33

func (t *RoutingModeType) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface for RoutingModeType

func (RoutingModeType) ValidOrNil added in v0.6.33

func (t RoutingModeType) ValidOrNil() (*RoutingModeType, error)

type TunnelType added in v0.6.33

type TunnelType string

func (TunnelType) IsValid added in v0.6.33

func (t TunnelType) IsValid() error

func (TunnelType) List added in v0.6.33

func (t TunnelType) List() []TunnelType

func (*TunnelType) MarshalJSON added in v0.6.33

func (t *TunnelType) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaler interface for TunnelType

func (TunnelType) String added in v0.6.33

func (t TunnelType) String() string

func (TunnelType) StringList added in v0.6.33

func (t TunnelType) StringList() []string

func (*TunnelType) UnmarshalJSON added in v0.6.33

func (t *TunnelType) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface for TunnelType

func (TunnelType) ValidOrNil added in v0.6.33

func (t TunnelType) ValidOrNil() (*TunnelType, error)

type UpdateOpts added in v0.7.17

type UpdateOpts struct {
	Authentication   *AuthenticationUpdateOpts `json:"authentication,omitempty" validate:"omitempty"`
	AutoscalerConfig map[string]string         `json:"autoscaler_config,omitempty" validate:"omitempty"`
	CNI              *CNICreateOpts            `json:"cni,omitempty" validate:"omitempty"`
	DDoSProfile      *DDoSProfileUpdateOpts    `json:"ddos_profile,omitempty" validate:"omitempty"`
}

UpdateOpts represents options used to upgrade a cluster.

func (UpdateOpts) ToClusterUpdateMap added in v0.7.17

func (opts UpdateOpts) ToClusterUpdateMap() (map[string]interface{}, error)

ToClusterUpdateMap builds a request body from UpdateOpts.

type UpdateOptsBuilder added in v0.7.17

type UpdateOptsBuilder interface {
	ToClusterUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpgradeOpts

type UpgradeOpts struct {
	Version string `json:"version" required:"true"`
}

UpgradeOpts represents options used to upgrade a cluster.

func (UpgradeOpts) ToClusterUpgradeMap

func (opts UpgradeOpts) ToClusterUpgradeMap() (map[string]interface{}, error)

ToClusterUpgradeMap builds a request body from UpgradeOpts.

type UpgradeOptsBuilder

type UpgradeOptsBuilder interface {
	ToClusterUpgradeMap() (map[string]interface{}, error)
}

UpgradeOptsBuilder allows extensions to add additional parameters to the Upgrade request.

type Version

type Version struct {
	Version string `json:"version"`
}

Version represents a cluster version structure.

func CreateVersionsAll added in v0.8.11

func CreateVersionsAll(c *gcorecloud.ServiceClient) ([]Version, error)

CreateVersionsAll is a convenience function that returns all supported k8s versions for cluster creation.

func ExtractVersions

func ExtractVersions(r pagination.Page) ([]Version, error)

ExtractVersions accepts a Page struct, specifically a VersionPage struct, and extracts the elements into a slice of Version structs.. In other words, a generic collection is mapped into a relevant slice.

func UpgradeVersionsAll added in v0.8.11

func UpgradeVersionsAll(c *gcorecloud.ServiceClient, clusterID string) ([]Version, error)

UpgradeVersionsAll is a convenience function that returns all supported k8s versions for cluster upgrade.

type VersionPage

type VersionPage struct {
	pagination.LinkedPageBase
}

VersionPage is the page returned by a pager when traversing over a collection of cluster versions.

func (VersionPage) IsEmpty

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

IsEmpty checks whether a VersionPage struct is empty.

func (VersionPage) NextPageURL

func (r VersionPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of clusters has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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