clusters

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CalicoProvider    CNIProvider     = "calico"
	CiliumProvider    CNIProvider     = "cilium"
	VXLANTunnel       TunnelType      = "vxlan"
	GeneveTunnel      TunnelType      = "geneve"
	SNATLBMode        LBModeType      = "snat"
	DSRLBMode         LBModeType      = "dsr"
	HybridLBMode      LBModeType      = "hybrid"
	NormalRoutingMode RoutingModeType = "normal"
)

Variables

This section is empty.

Functions

func Create

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

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 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 Versions

Versions returns a Pager which allows you to iterate over a collection of supported cluster versions.

Types

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 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 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,omitemtpy"`
	LoadBalancerAcceleration bool            `json:"lb_acceleration"`
	RoutingMode              RoutingModeType `json:"routing_mode,omitempty"`
}

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,omitempty"`
	Encryption               bool            `json:"encryption"`
	LoadBalancerMode         LBModeType      `json:"lb_mode,omitemtpy"`
	LoadBalancerAcceleration bool            `json:"lb_acceleration"`
	RoutingMode              RoutingModeType `json:"routing_mode,omitempty"`
}

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"`
	CNI              *CNI                `json:"cni,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"`
	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"`
}

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"`
	CNI              *CNICreateOpts     `json:"cni,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 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 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 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 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 VersionsAll

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

VersionsAll is a convenience function that returns all supported cluster versions.

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