clusters

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MPL-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

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 *edgecloud.ServiceClient, clusterID string) (r tasks.Result)

Delete accepts a unique ID and deletes the cluster associated with it.

func ExtractClusterIDFromTask

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

func ExtractClustersInto

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

func ExtractVersionInto

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

func ExtractVersions

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

ExtractVersions accepts a Page struct, specifically a VersionPage struct, and extracts the elements into a slice of strings.

func Instances

func Instances(c *edgecloud.ServiceClient, clusterID string) pagination.Pager

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

func InstancesAll

func InstancesAll(c *edgecloud.ServiceClient, clusterID string) ([]instances.Instance, error)

InstancesAll returns all cluster instances.

func List

List returns a Pager which allows you to iterate over a collection of clusters. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

func Resize

func Resize(c *edgecloud.ServiceClient, clusterID, poolID string, opts ResizeOptsBuilder) (r tasks.Result)

Resize accepts a ResizeOpts struct and updates an existing cluster using the values provided.

func Upgrade

func Upgrade(c *edgecloud.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 available cluster versions.

func VersionsAll

func VersionsAll(c *edgecloud.ServiceClient) ([]string, error)

VersionsAll returns all cluster versions.

Types

type Cluster

type Cluster struct {
	StatusReason       string            `json:"status_reason"`
	APIAddress         *edgecloud.URL    `json:"api_address"`
	CoeVersion         string            `json:"coe_version"`
	ContainerVersion   string            `json:"container_version"`
	DiscoveryURL       *edgecloud.URL    `json:"discovery_url"`
	HealthStatusReason map[string]string `json:"health_status_reason"`
	ProjectID          string            `json:"project_id"`
	UserID             string            `json:"user_id"`
	NodeAddresses      []net.IP          `json:"node_addresses"`
	MasterAddresses    []net.IP          `json:"master_addresses"`
	FixedNetwork       string            `json:"fixed_network"`
	FixedSubnet        string            `json:"fixed_subnet"`
	FloatingIPEnabled  bool              `json:"floating_ip_enabled"`
	AutoHealingEnabled bool              `json:"auto_healing_enabled"`
	Faults             map[string]string `json:"faults"`
	*ClusterList
}

Cluster represents a cluster structure.

type ClusterCACertificate

type ClusterCACertificate struct {
	ClusterUUID string `json:"cluster_uuid"`
	PEM         string `json:"pem"`
}

ClusterCACertificate represents a cluster CA certificate structure.

type ClusterCertificateCAResult

type ClusterCertificateCAResult struct {
	edgecloud.Result
}

ClusterCertificateCAResult represents the result of CA cluster certificates.

func Certificate

func Certificate(c *edgecloud.ServiceClient, clusterID string) (r ClusterCertificateCAResult)

Certificate accepts a unique ID and return cluster CA.

func (ClusterCertificateCAResult) Extract

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

type ClusterCertificateSignResult

type ClusterCertificateSignResult struct {
	edgecloud.Result
}

ClusterCertificateSignResult represents the result of signing cluster certificate operation.

func SignCertificate

SignCertificate accepts a unique ID and sign cluster certificate.

func (ClusterCertificateSignResult) Extract

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

type ClusterList

type ClusterList struct {
	UUID              string             `json:"uuid"`
	Name              string             `json:"name"`
	ClusterTemplateID string             `json:"cluster_template_id"`
	KeyPair           string             `json:"keypair"`
	NodeCount         int                `json:"node_count"`
	MasterCount       int                `json:"master_count"`
	DockerVolumeSize  int                `json:"docker_volume_size"`
	Labels            map[string]string  `json:"labels"`
	MasterFlavorID    string             `json:"master_flavor_id"`
	FlavorID          string             `json:"flavor_id"`
	CreateTimeout     int                `json:"create_timeout"`
	StackID           string             `json:"stack_id"`
	Status            string             `json:"status"`
	HealthStatus      types.HealthStatus `json:"health_status"`
	Version           string             `json:"version"`
	CreatedAt         time.Time          `json:"created_at"`
	UpdatedAt         *time.Time         `json:"updated_at"`
}

Cluster represents a cluster structure in list response.

type ClusterListWithPool

type ClusterListWithPool struct {
	Pools []pools.ClusterPoolList `json:"pools"`
	*ClusterList
}

func ExtractClusters

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

ExtractClusters 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

ListALL returns all magnum clusters.

type ClusterPage

type ClusterPage struct {
	pagination.LinkedPageBase
}

VersionPage 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 ClusterSignCertificate

type ClusterSignCertificate struct {
	ClusterUUID string `json:"cluster_uuid"`
	PEM         string `json:"pem"`
	CSR         string `json:"csr"`
}

ClusterSignCertificate represents a cluster signed certificate structure.

type ClusterSignCertificateOpts

type ClusterSignCertificateOpts struct {
	CSR string `json:"csr" validate:"required"`
}

ClusterSignCertificateOpts represents a options to sign cluster certificate.

func (ClusterSignCertificateOpts) ToClusterSignCertificateMap

func (opts ClusterSignCertificateOpts) ToClusterSignCertificateMap() (map[string]interface{}, error)

ToClusterSignCertificateMap builds a request body from ClusterSignCertificateOpts.

type ClusterSignCertificateOptsBuilder

type ClusterSignCertificateOptsBuilder interface {
	ToClusterSignCertificateMap() (map[string]interface{}, error)
}

ClusterSignCertificateOptsBuilder allows extensions to add additional parameters to the SignCertificate request.

type ClusterTaskResult

type ClusterTaskResult struct {
	K8sClusters []string `json:"k8s_clusters" mapstructure:"k8s_clusters"`
}

type ClusterWithPool

type ClusterWithPool struct {
	*Cluster
	Pools []pools.ClusterPool `json:"pools"`
}

type Config

type Config struct {
	Config string `json:"config,omitempty"`
}

Config represents a k8s config structure.

type ConfigResult

type ConfigResult struct {
	edgecloud.Result
}

ConfigResult represents the result of kubernetes config.

func GetConfig

func GetConfig(c *edgecloud.ServiceClient, clusterID string) (r ConfigResult)

GetConfig accepts a unique ID and get cluster k8s config.

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"`
	FixedNetwork              string             `json:"fixed_network" required:"true" validate:"required,uuid4"`
	FixedSubnet               string             `json:"fixed_subnet" required:"true" validate:"required,uuid4"`
	KeyPair                   string             `json:"keypair,omitempty"`
	PodsIPPool                *edgecloud.CIDR    `json:"pods_ip_pool,omitempty"`
	ServicesIPPool            *edgecloud.CIDR    `json:"services_ip_pool,omitempty"`
	AutoHealingEnabled        bool               `json:"auto_healing_enabled"`
	MasterLBFloatingIPEnabled bool               `json:"master_lb_floating_ip_enabled,omitempty"`
	Version                   string             `json:"version,omitempty" validate:"omitempty,sem"`
	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 *edgecloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific cluster based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*ClusterWithPool, 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 ListOpts

type ListOpts struct {
	Limit   int    `q:"limit"`
	Marker  string `q:"marker"`
	SortKey string `q:"sort_key"`
	SortDir string `q:"sort_dir"`
	Detail  bool   `q:"detail"`
}

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the clusters attributes you want to see returned. SortKey allows you to sort by a particular clusters attribute. SortDir sets the direction, and is either `asc' or `desc'. Marker and Limit are used for pagination.

func (ListOpts) ToClusterListQuery

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

ToClusterListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToClusterListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the Versions request.

type ResizeOpts

type ResizeOpts struct {
	NodeCount     *int     `json:"node_count" required:"true" validate:"required,gt=0"`
	NodesToRemove []string `json:"nodes_to_remove,omitempty" validate:"omitempty,dive,uuid4"`
}

ResizeOpts represents options used to update a cluster.

func (ResizeOpts) ToClusterResizeMap

func (opts ResizeOpts) ToClusterResizeMap() (map[string]interface{}, error)

ToClusterResizeMap builds a request body from ResizeOpts.

type ResizeOptsBuilder

type ResizeOptsBuilder interface {
	ToClusterResizeMap() (map[string]interface{}, error)
}

ResizeOptsBuilder allows extensions to add additional parameters to the Resize request.

type UpgradeOpts

type UpgradeOpts struct {
	Pool    string `json:"pool,omitempty" validate:"omitempty,uuid4"`
	Version string `json:"version" required:"true" validate:"required,sem"`
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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